[PATCH 2/3] drm: Add Stereo 3D properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Damien Lespiau <damien.lespiau at intel.com>

The "select 3D mode" property can be connected to connectors to signal
user space that 3D framebuffers can be scanned out to the said
connector.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 32 ++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h     |  4 ++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 6fbfc24..dcd6d81 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -841,6 +841,38 @@ int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
 }
 EXPORT_SYMBOL(drm_mode_create_tv_properties);
 
+static const struct drm_prop_enum_list s3d_modes_list[] =
+{
+	{ 0, "None" },
+	{ DRM_MODE_FLAG_3D_TOP_BOTTOM, "Top bottom" },
+	{ DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF, "Side by side (half)" },
+	{ DRM_MODE_FLAG_3D_FRAME_PACKING, "Frame packing" }
+};
+
+/**
+ * drm_mode_create_3d_property - create stereo 3D properties
+ * @dev: DRM device
+ *
+ * Called by a driver the first time it's needed, must be attached to modes
+ * that supports stereo 3D formats.
+ */
+int drm_mode_create_3d_property(struct drm_device *dev)
+{
+	struct drm_property *s3d_selector;
+
+	if (dev->mode_config.s3d_select_mode_property)
+		return 0;
+
+	s3d_selector = drm_property_create_enum(dev, 0,
+			"select 3D mode",
+			s3d_modes_list,
+			ARRAY_SIZE(s3d_modes_list));
+	dev->mode_config.s3d_select_mode_property = s3d_selector;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_3d_property);
+
 /**
  * drm_mode_create_scaling_mode_property - create scaling mode property
  * @dev: DRM device
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index bfacf0d..5a6e024 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -802,6 +802,9 @@ struct drm_mode_config {
 	struct drm_property *tv_saturation_property;
 	struct drm_property *tv_hue_property;
 
+	/* Stereo 3D properties */
+	struct drm_property *s3d_select_mode_property;
+
 	/* Optional properties */
 	struct drm_property *scaling_mode_property;
 	struct drm_property *dithering_mode_property;
@@ -950,6 +953,7 @@ extern int drm_property_add_enum(struct drm_property *property, int index,
 extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
 extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
 				     char *formats[]);
+extern int drm_mode_create_3d_property(struct drm_device *dev);
 extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
 extern int drm_mode_create_dithering_property(struct drm_device *dev);
 extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
-- 
1.7.11.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux