* Stereo 3D modes support v2
@ 2012-09-27 18:41 Damien Lespiau
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Damien Lespiau @ 2012-09-27 18:41 UTC (permalink / raw)
To: intel-gfx, dri-devel
This series is the second revison of:
http://lists.freedesktop.org/archives/intel-gfx/2012-September/020457.html
It changes the way 3d modes are exposed to user-space:
- An "expose 3D modes" property can be installed on connectors that support
stereo 3D
- User space can indicate through that property if it wants to receive the
list of modes with the supported 3D layouts information
- In that case, the EDID parsing code adds the list of supported 3D layouts
in mode->flags
- When setting a 3D mode, user space can select which layout it wants by
clearing the list of supported layouts and setting the one it has selected
(still through mode->flags).
The rationale behind all that is:
- Setting the 3d mode should atomic and not 1/ set the mode, 2/ then set
the 3d layout through a connector property.
- To do that, mode->flags can be used, but current user space would not
do the correct thing with those extra added flags, hence the need for that
knob on the connector.
Updated kernel and intel-gpu-tools patches follow. This time, I've split the
patch adding the test images (i-g-t) in a separate commit and it won't be sent
to the mailing list. This commit can be grabbed from:
http://cgit.freedesktop.org/~damien/intel-gpu-tools/commit/?h=stereo-3d
--
Damien
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] drm: Add an "expose 3d modes" property
2012-09-27 18:41 Stereo 3D modes support v2 Damien Lespiau
@ 2012-09-27 18:41 ` Damien Lespiau
2012-09-29 0:45 ` [Intel-gfx] " Rodrigo Vivi
` (2 more replies)
2012-09-27 18:41 ` [PATCH 2/3] drm: Parse the HDMI cea vendor block for 3D present Damien Lespiau
2012-09-27 18:41 ` [PATCH 3/3] drm/i915: Add HDMI vendor info frame support Damien Lespiau
2 siblings, 3 replies; 10+ messages in thread
From: Damien Lespiau @ 2012-09-27 18:41 UTC (permalink / raw)
To: intel-gfx, dri-devel
From: Damien Lespiau <damien.lespiau@intel.com>
The "expose 3D modes" property can be attached to connectors to allow
user space to indicate it can deal with 3D modes and that the drm driver
should expose those 3D modes.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
drivers/gpu/drm/drm_crtc.c | 35 ++++++++++++++++++++++++++++++++++-
include/drm/drm_crtc.h | 6 ++++++
include/drm/drm_mode.h | 4 ++++
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 6fbfc24..10a289c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -841,6 +841,35 @@ 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 expose_3d_modes_list[] =
+{
+ { DRM_MODE_EXPOSE_3D_MODES_OFF, "Off" },
+ { DRM_MODE_EXPOSE_3D_MODES_ON, "On" }
+};
+
+/**
+ * drm_mode_create_s3d_properties - create stereo 3D properties
+ * @dev: DRM device
+ *
+ * This functions create properties that are used by the stereo 3D code. Those
+ * properties must be attached to the desired connectors afterwards.
+ */
+int drm_mode_create_s3d_properties(struct drm_device *dev)
+{
+ struct drm_property *prop;
+
+ if (dev->mode_config.s3d_expose_modes_property)
+ return 0;
+
+ prop = drm_property_create_enum(dev, 0, "expose 3D modes",
+ expose_3d_modes_list,
+ ARRAY_SIZE(expose_3d_modes_list));
+ dev->mode_config.s3d_expose_modes_property = prop;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_mode_create_s3d_properties);
+
/**
* drm_mode_create_scaling_mode_property - create scaling mode property
* @dev: DRM device
@@ -3170,12 +3199,16 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
{
int ret = -EINVAL;
struct drm_connector *connector = obj_to_connector(obj);
+ struct drm_device *dev = connector->dev;
/* Do DPMS ourselves */
- if (property == connector->dev->mode_config.dpms_property) {
+ if (property == dev->mode_config.dpms_property) {
if (connector->funcs->dpms)
(*connector->funcs->dpms)(connector, (int)value);
ret = 0;
+ } else if (property == dev->mode_config.s3d_expose_modes_property) {
+ connector->expose_3d_modes = value;
+ ret = 0;
} else if (connector->funcs->set_property)
ret = connector->funcs->set_property(connector, property, value);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index bfacf0d..34372cb 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -578,6 +578,8 @@ struct drm_connector {
/* requested DPMS state */
int dpms;
+ int expose_3d_modes;
+
void *helper_private;
/* forced on connector */
@@ -802,6 +804,9 @@ struct drm_mode_config {
struct drm_property *tv_saturation_property;
struct drm_property *tv_hue_property;
+ /* Stereo 3D properties */
+ struct drm_property *s3d_expose_modes_property;
+
/* Optional properties */
struct drm_property *scaling_mode_property;
struct drm_property *dithering_mode_property;
@@ -950,6 +955,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_s3d_properties(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);
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 3d6301b..45b19c6 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -83,6 +83,10 @@
#define DRM_MODE_DIRTY_ON 1
#define DRM_MODE_DIRTY_ANNOTATE 2
+/* Expose 3D modes */
+#define DRM_MODE_EXPOSE_3D_MODES_OFF 0
+#define DRM_MODE_EXPOSE_3D_MODES_ON 1
+
struct drm_mode_modeinfo {
__u32 clock;
__u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
--
1.7.11.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] drm: Parse the HDMI cea vendor block for 3D present
2012-09-27 18:41 Stereo 3D modes support v2 Damien Lespiau
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
@ 2012-09-27 18:41 ` Damien Lespiau
2012-09-29 0:46 ` Rodrigo Vivi
2012-09-27 18:41 ` [PATCH 3/3] drm/i915: Add HDMI vendor info frame support Damien Lespiau
2 siblings, 1 reply; 10+ messages in thread
From: Damien Lespiau @ 2012-09-27 18:41 UTC (permalink / raw)
To: intel-gfx, dri-devel
From: Damien Lespiau <damien.lespiau@intel.com>
For now, let's just look at the 3D_present flag of the CEA HDMI vendor
block to detect if the sink supports a small list of then mandatory 3D
formats.
See the HDMI 1.4a 3D extraction for detail:
http://www.hdmi.org/manufacturer/specification.aspx
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
drivers/gpu/drm/drm_edid.c | 87 ++++++++++++++++++++++++++++++++++++++++++++--
include/drm/drm_mode.h | 35 +++++++++++--------
2 files changed, 105 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b7ee230..7eecfa0 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1522,21 +1522,102 @@ do_cea_modes (struct drm_connector *connector, u8 *db, u8 len)
return modes;
}
+static bool cea_hdmi_3d_present(u8 *hdmi)
+{
+ u8 len, skip = 0;
+
+ len = hdmi[0] & 0x1f;
+
+ if (len < 8)
+ return false;
+
+ /* no HDMI_Video_present */
+ if (!(hdmi[8] & (1<<5)))
+ return false;
+
+ /* Latency_fields_present */
+ if (hdmi[8] & (1 << 7))
+ skip += 2;
+
+ /* I_Latency_fields_present */
+ if (hdmi[8] & (1 << 6))
+ skip += 2;
+
+ /* the declared length is not long enough */
+ if (len < (9 + skip))
+ return false;
+
+ return (hdmi[9 + skip] & (1 << 7)) != 0;
+}
+
+static const struct {
+ int width, height, freq;
+ unsigned int select, value;
+ unsigned int formats;
+} s3d_mandatory_modes[] = {
+ { 1920, 1080, 24, DRM_MODE_FLAG_INTERLACE, 0,
+ DRM_MODE_FLAG_3D_TOP_BOTTOM | DRM_MODE_FLAG_3D_FRAME_PACKING },
+ { 1920, 1080, 50, DRM_MODE_FLAG_INTERLACE, DRM_MODE_FLAG_INTERLACE,
+ DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
+ { 1920, 1080, 60, DRM_MODE_FLAG_INTERLACE, DRM_MODE_FLAG_INTERLACE,
+ DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
+ { 1280, 720, 50, DRM_MODE_FLAG_INTERLACE, 0,
+ DRM_MODE_FLAG_3D_TOP_BOTTOM | DRM_MODE_FLAG_3D_FRAME_PACKING },
+ { 1280, 720, 60, DRM_MODE_FLAG_INTERLACE, 0,
+ DRM_MODE_FLAG_3D_TOP_BOTTOM | DRM_MODE_FLAG_3D_FRAME_PACKING }
+};
+
+static void cea_hdmi_patch_mandatory_3d_mode(struct drm_display_mode *mode)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(s3d_mandatory_modes); i++) {
+ if (mode->hdisplay == s3d_mandatory_modes[i].width &&
+ mode->vdisplay == s3d_mandatory_modes[i].height &&
+ (mode->flags & s3d_mandatory_modes[i].select) ==
+ s3d_mandatory_modes[i].value &&
+ drm_mode_vrefresh(mode) == s3d_mandatory_modes[i].freq) {
+ mode->flags |= s3d_mandatory_modes[i].formats;
+ }
+ }
+}
+
+static void cea_hdmi_patch_mandatory_3d_modes(struct drm_connector *connector)
+{
+ struct drm_display_mode *mode;
+
+ list_for_each_entry(mode, &connector->probed_modes, head)
+ cea_hdmi_patch_mandatory_3d_mode(mode);
+}
+
static int
add_cea_modes(struct drm_connector *connector, struct edid *edid)
{
u8 * cea = drm_find_cea_extension(edid);
- u8 * db, dbl;
- int modes = 0;
+ u8 * db, *hdmi = NULL, dbl;
+ int modes = 0, vendor_id;
+ /* let's find the cea modes before looking at the hdmi vendor block
+ * as the 3d_present flag needs to know about the supported modes
+ * to infer the 3D modes */
if (cea && cea[1] >= 3) {
for (db = cea + 4; db < cea + cea[2]; db += dbl + 1) {
dbl = db[0] & 0x1f;
- if (((db[0] & 0xe0) >> 5) == VIDEO_BLOCK)
+ switch ((db[0] & 0xe0) >> 5) {
+ case VIDEO_BLOCK:
modes += do_cea_modes (connector, db+1, dbl);
+ break;
+ case VENDOR_BLOCK:
+ vendor_id = db[1] | db[2] << 8 | db[3] << 16;
+ if (vendor_id == HDMI_IDENTIFIER)
+ hdmi = db;
+ }
}
}
+ if (connector->expose_3d_modes && hdmi && cea_hdmi_3d_present(hdmi))
+ cea_hdmi_patch_mandatory_3d_modes(connector);
+
return modes;
}
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 45b19c6..d5d22de 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -44,20 +44,27 @@
/* Video mode flags */
/* bit compatible with the xorg definitions. */
-#define DRM_MODE_FLAG_PHSYNC (1<<0)
-#define DRM_MODE_FLAG_NHSYNC (1<<1)
-#define DRM_MODE_FLAG_PVSYNC (1<<2)
-#define DRM_MODE_FLAG_NVSYNC (1<<3)
-#define DRM_MODE_FLAG_INTERLACE (1<<4)
-#define DRM_MODE_FLAG_DBLSCAN (1<<5)
-#define DRM_MODE_FLAG_CSYNC (1<<6)
-#define DRM_MODE_FLAG_PCSYNC (1<<7)
-#define DRM_MODE_FLAG_NCSYNC (1<<8)
-#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
-#define DRM_MODE_FLAG_BCAST (1<<10)
-#define DRM_MODE_FLAG_PIXMUX (1<<11)
-#define DRM_MODE_FLAG_DBLCLK (1<<12)
-#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
+#define DRM_MODE_FLAG_PHSYNC (1<<0)
+#define DRM_MODE_FLAG_NHSYNC (1<<1)
+#define DRM_MODE_FLAG_PVSYNC (1<<2)
+#define DRM_MODE_FLAG_NVSYNC (1<<3)
+#define DRM_MODE_FLAG_INTERLACE (1<<4)
+#define DRM_MODE_FLAG_DBLSCAN (1<<5)
+#define DRM_MODE_FLAG_CSYNC (1<<6)
+#define DRM_MODE_FLAG_PCSYNC (1<<7)
+#define DRM_MODE_FLAG_NCSYNC (1<<8)
+#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
+#define DRM_MODE_FLAG_BCAST (1<<10)
+#define DRM_MODE_FLAG_PIXMUX (1<<11)
+#define DRM_MODE_FLAG_DBLCLK (1<<12)
+#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
+#define DRM_MODE_FLAG_3D_TOP_BOTTOM (1<<14)
+#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (1<<15)
+#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<16)
+
+#define DRM_MODE_FLAG_3D_MASK (DRM_MODE_FLAG_3D_TOP_BOTTOM | \
+ DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF | \
+ DRM_MODE_FLAG_3D_FRAME_PACKING)
/* DPMS flags */
/* bit compatible with the xorg definitions. */
--
1.7.11.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] drm/i915: Add HDMI vendor info frame support
2012-09-27 18:41 Stereo 3D modes support v2 Damien Lespiau
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
2012-09-27 18:41 ` [PATCH 2/3] drm: Parse the HDMI cea vendor block for 3D present Damien Lespiau
@ 2012-09-27 18:41 ` Damien Lespiau
2012-09-29 0:50 ` [Intel-gfx] " Rodrigo Vivi
2 siblings, 1 reply; 10+ messages in thread
From: Damien Lespiau @ 2012-09-27 18:41 UTC (permalink / raw)
To: intel-gfx, dri-devel
From: Damien Lespiau <damien.lespiau@intel.com>
When scanning out a 3D framebuffer, send the corresponding infoframe to
the HDMI sink.
See http://www.hdmi.org/manufacturer/specification.aspx for details.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
drivers/gpu/drm/i915/intel_drv.h | 14 +++++++++++
drivers/gpu/drm/i915/intel_hdmi.c | 49 +++++++++++++++++++++++++++++++++++++-
drivers/gpu/drm/i915/intel_modes.c | 12 ++++++++++
3 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index cd54cf8..c326d30e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -263,6 +263,13 @@ struct cxsr_latency {
#define DIP_SPD_BD 0xa
#define DIP_SPD_SCD 0xb
+#define DIP_TYPE_VENDOR 0x81
+#define DIP_VERSION_VENDOR 0x1
+#define DIP_HDMI_3D_PRESENT (0x2<<5)
+#define DIP_HDMI_3D_STRUCT_FP (0x0<<4)
+#define DIP_HDMI_3D_STRUCT_TB (0x6<<4)
+#define DIP_HDMI_3D_STRUCT_SBSH (0x8<<4)
+
struct dip_infoframe {
uint8_t type; /* HB0 */
uint8_t ver; /* HB1 */
@@ -292,6 +299,12 @@ struct dip_infoframe {
uint8_t pd[16];
uint8_t sdi;
} __attribute__ ((packed)) spd;
+ struct {
+ uint8_t vendor_id[3];
+ uint8_t video_format;
+ uint8_t s3d_struct;
+ uint8_t s3d_ext_data;
+ } __attribute__ ((packed)) hdmi;
uint8_t payload[27];
} __attribute__ ((packed)) body;
} __attribute__((packed));
@@ -348,6 +361,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
extern void intel_attach_force_audio_property(struct drm_connector *connector);
extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
+extern void intel_attach_expose_3d_modes_property(struct drm_connector *connector);
extern void intel_crt_init(struct drm_device *dev);
extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 98f6024..2d51b7e 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -83,6 +83,8 @@ static u32 g4x_infoframe_index(struct dip_infoframe *frame)
return VIDEO_DIP_SELECT_AVI;
case DIP_TYPE_SPD:
return VIDEO_DIP_SELECT_SPD;
+ case DIP_TYPE_VENDOR:
+ return VIDEO_DIP_SELECT_VENDOR;
default:
DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
return 0;
@@ -96,6 +98,8 @@ static u32 g4x_infoframe_enable(struct dip_infoframe *frame)
return VIDEO_DIP_ENABLE_AVI;
case DIP_TYPE_SPD:
return VIDEO_DIP_ENABLE_SPD;
+ case DIP_TYPE_VENDOR:
+ return VIDEO_DIP_ENABLE_VENDOR;
default:
DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
return 0;
@@ -338,6 +342,42 @@ static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder)
intel_set_infoframe(encoder, &spd_if);
}
+static void intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder,
+ struct drm_display_mode *adjusted_mode)
+{
+ struct dip_infoframe hdmi_if;
+
+ /* We really only need to send a HDMI vendor info frame when having
+ * a 3D format to describe */
+ if (!(adjusted_mode->flags & DRM_MODE_FLAG_3D_MASK))
+ return;
+
+ memset(&hdmi_if, 0, sizeof(hdmi_if));
+ hdmi_if.type = DIP_TYPE_VENDOR;
+ hdmi_if.ver = DIP_VERSION_VENDOR;
+ /* HDMI IEEE registration id, least significant bit first */
+ hdmi_if.body.hdmi.vendor_id[0] = 0x03;
+ hdmi_if.body.hdmi.vendor_id[1] = 0x0c;
+ hdmi_if.body.hdmi.vendor_id[2] = 0x00;
+ hdmi_if.body.hdmi.video_format = DIP_HDMI_3D_PRESENT;
+ if (adjusted_mode->flags & DRM_MODE_FLAG_3D_FRAME_PACKING)
+ hdmi_if.body.hdmi.s3d_struct = DIP_HDMI_3D_STRUCT_FP;
+ else if (adjusted_mode->flags & DRM_MODE_FLAG_3D_TOP_BOTTOM)
+ hdmi_if.body.hdmi.s3d_struct = DIP_HDMI_3D_STRUCT_TB;
+ else if (adjusted_mode->flags & DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF)
+ hdmi_if.body.hdmi.s3d_struct = DIP_HDMI_3D_STRUCT_SBSH;
+ /* len is the payload len, not including checksum. Side by side (half)
+ * has an extra byte for 3D_Ext_Data */
+ if (adjusted_mode->flags & DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF) {
+ hdmi_if.len = 6;
+ /* SBSH is subsampled by a factor of 2 */
+ hdmi_if.body.hdmi.s3d_ext_data = 2 << 4;
+ } else
+ hdmi_if.len = 5;
+
+ intel_set_infoframe(encoder, &hdmi_if);
+}
+
static void g4x_set_infoframes(struct drm_encoder *encoder,
struct drm_display_mode *adjusted_mode)
{
@@ -398,6 +438,7 @@ static void g4x_set_infoframes(struct drm_encoder *encoder,
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
intel_hdmi_set_spd_infoframe(encoder);
+ intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
}
static void ibx_set_infoframes(struct drm_encoder *encoder,
@@ -457,6 +498,7 @@ static void ibx_set_infoframes(struct drm_encoder *encoder,
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
intel_hdmi_set_spd_infoframe(encoder);
+ intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
}
static void cpt_set_infoframes(struct drm_encoder *encoder,
@@ -492,6 +534,7 @@ static void cpt_set_infoframes(struct drm_encoder *encoder,
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
intel_hdmi_set_spd_infoframe(encoder);
+ intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
}
static void vlv_set_infoframes(struct drm_encoder *encoder,
@@ -526,6 +569,7 @@ static void vlv_set_infoframes(struct drm_encoder *encoder,
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
intel_hdmi_set_spd_infoframe(encoder);
+ intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
}
static void hsw_set_infoframes(struct drm_encoder *encoder,
@@ -792,7 +836,8 @@ intel_hdmi_set_property(struct drm_connector *connector,
uint64_t val)
{
struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
- struct drm_i915_private *dev_priv = connector->dev->dev_private;
+ struct drm_device *dev = connector->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
ret = drm_connector_property_set_value(connector, property, val);
@@ -828,6 +873,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
goto done;
}
+
return -EINVAL;
done:
@@ -887,6 +933,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
{
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
+ intel_attach_expose_3d_modes_property(connector);
}
void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 29b7259..50216af 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -124,3 +124,15 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector)
drm_connector_attach_property(connector, prop, 0);
}
+
+void
+intel_attach_expose_3d_modes_property(struct drm_connector *connector)
+{
+ struct drm_device *dev = connector->dev;
+ struct drm_property *prop;
+
+ drm_mode_create_s3d_properties(dev);
+ prop = dev->mode_config.s3d_expose_modes_property;
+ drm_connector_attach_property(connector, prop,
+ DRM_MODE_EXPOSE_3D_MODES_OFF);
+}
--
1.7.11.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm: Add an "expose 3d modes" property
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
@ 2012-09-29 0:45 ` Rodrigo Vivi
2012-09-29 9:01 ` Chris Wilson
2012-10-04 13:35 ` Daniel Vetter
2 siblings, 0 replies; 10+ messages in thread
From: Rodrigo Vivi @ 2012-09-29 0:45 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx, dri-devel
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Tested-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
On Thu, Sep 27, 2012 at 3:41 PM, Damien Lespiau
<damien.lespiau@gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> The "expose 3D modes" property can be attached to connectors to allow
> user space to indicate it can deal with 3D modes and that the drm driver
> should expose those 3D modes.
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> drivers/gpu/drm/drm_crtc.c | 35 ++++++++++++++++++++++++++++++++++-
> include/drm/drm_crtc.h | 6 ++++++
> include/drm/drm_mode.h | 4 ++++
> 3 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 6fbfc24..10a289c 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -841,6 +841,35 @@ 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 expose_3d_modes_list[] =
> +{
> + { DRM_MODE_EXPOSE_3D_MODES_OFF, "Off" },
> + { DRM_MODE_EXPOSE_3D_MODES_ON, "On" }
> +};
> +
> +/**
> + * drm_mode_create_s3d_properties - create stereo 3D properties
> + * @dev: DRM device
> + *
> + * This functions create properties that are used by the stereo 3D code. Those
> + * properties must be attached to the desired connectors afterwards.
> + */
> +int drm_mode_create_s3d_properties(struct drm_device *dev)
> +{
> + struct drm_property *prop;
> +
> + if (dev->mode_config.s3d_expose_modes_property)
> + return 0;
> +
> + prop = drm_property_create_enum(dev, 0, "expose 3D modes",
> + expose_3d_modes_list,
> + ARRAY_SIZE(expose_3d_modes_list));
> + dev->mode_config.s3d_expose_modes_property = prop;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_create_s3d_properties);
> +
> /**
> * drm_mode_create_scaling_mode_property - create scaling mode property
> * @dev: DRM device
> @@ -3170,12 +3199,16 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
> {
> int ret = -EINVAL;
> struct drm_connector *connector = obj_to_connector(obj);
> + struct drm_device *dev = connector->dev;
>
> /* Do DPMS ourselves */
> - if (property == connector->dev->mode_config.dpms_property) {
> + if (property == dev->mode_config.dpms_property) {
> if (connector->funcs->dpms)
> (*connector->funcs->dpms)(connector, (int)value);
> ret = 0;
> + } else if (property == dev->mode_config.s3d_expose_modes_property) {
> + connector->expose_3d_modes = value;
> + ret = 0;
> } else if (connector->funcs->set_property)
> ret = connector->funcs->set_property(connector, property, value);
>
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index bfacf0d..34372cb 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -578,6 +578,8 @@ struct drm_connector {
> /* requested DPMS state */
> int dpms;
>
> + int expose_3d_modes;
> +
> void *helper_private;
>
> /* forced on connector */
> @@ -802,6 +804,9 @@ struct drm_mode_config {
> struct drm_property *tv_saturation_property;
> struct drm_property *tv_hue_property;
>
> + /* Stereo 3D properties */
> + struct drm_property *s3d_expose_modes_property;
> +
> /* Optional properties */
> struct drm_property *scaling_mode_property;
> struct drm_property *dithering_mode_property;
> @@ -950,6 +955,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_s3d_properties(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);
> diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
> index 3d6301b..45b19c6 100644
> --- a/include/drm/drm_mode.h
> +++ b/include/drm/drm_mode.h
> @@ -83,6 +83,10 @@
> #define DRM_MODE_DIRTY_ON 1
> #define DRM_MODE_DIRTY_ANNOTATE 2
>
> +/* Expose 3D modes */
> +#define DRM_MODE_EXPOSE_3D_MODES_OFF 0
> +#define DRM_MODE_EXPOSE_3D_MODES_ON 1
> +
> struct drm_mode_modeinfo {
> __u32 clock;
> __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
> --
> 1.7.11.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] drm: Parse the HDMI cea vendor block for 3D present
2012-09-27 18:41 ` [PATCH 2/3] drm: Parse the HDMI cea vendor block for 3D present Damien Lespiau
@ 2012-09-29 0:46 ` Rodrigo Vivi
0 siblings, 0 replies; 10+ messages in thread
From: Rodrigo Vivi @ 2012-09-29 0:46 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx, dri-devel
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Tested-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
On Thu, Sep 27, 2012 at 3:41 PM, Damien Lespiau
<damien.lespiau@gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> For now, let's just look at the 3D_present flag of the CEA HDMI vendor
> block to detect if the sink supports a small list of then mandatory 3D
> formats.
>
> See the HDMI 1.4a 3D extraction for detail:
> http://www.hdmi.org/manufacturer/specification.aspx
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> drivers/gpu/drm/drm_edid.c | 87 ++++++++++++++++++++++++++++++++++++++++++++--
> include/drm/drm_mode.h | 35 +++++++++++--------
> 2 files changed, 105 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index b7ee230..7eecfa0 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1522,21 +1522,102 @@ do_cea_modes (struct drm_connector *connector, u8 *db, u8 len)
> return modes;
> }
>
> +static bool cea_hdmi_3d_present(u8 *hdmi)
> +{
> + u8 len, skip = 0;
> +
> + len = hdmi[0] & 0x1f;
> +
> + if (len < 8)
> + return false;
> +
> + /* no HDMI_Video_present */
> + if (!(hdmi[8] & (1<<5)))
> + return false;
> +
> + /* Latency_fields_present */
> + if (hdmi[8] & (1 << 7))
> + skip += 2;
> +
> + /* I_Latency_fields_present */
> + if (hdmi[8] & (1 << 6))
> + skip += 2;
> +
> + /* the declared length is not long enough */
> + if (len < (9 + skip))
> + return false;
> +
> + return (hdmi[9 + skip] & (1 << 7)) != 0;
> +}
> +
> +static const struct {
> + int width, height, freq;
> + unsigned int select, value;
> + unsigned int formats;
> +} s3d_mandatory_modes[] = {
> + { 1920, 1080, 24, DRM_MODE_FLAG_INTERLACE, 0,
> + DRM_MODE_FLAG_3D_TOP_BOTTOM | DRM_MODE_FLAG_3D_FRAME_PACKING },
> + { 1920, 1080, 50, DRM_MODE_FLAG_INTERLACE, DRM_MODE_FLAG_INTERLACE,
> + DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
> + { 1920, 1080, 60, DRM_MODE_FLAG_INTERLACE, DRM_MODE_FLAG_INTERLACE,
> + DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF },
> + { 1280, 720, 50, DRM_MODE_FLAG_INTERLACE, 0,
> + DRM_MODE_FLAG_3D_TOP_BOTTOM | DRM_MODE_FLAG_3D_FRAME_PACKING },
> + { 1280, 720, 60, DRM_MODE_FLAG_INTERLACE, 0,
> + DRM_MODE_FLAG_3D_TOP_BOTTOM | DRM_MODE_FLAG_3D_FRAME_PACKING }
> +};
> +
> +static void cea_hdmi_patch_mandatory_3d_mode(struct drm_display_mode *mode)
> +{
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(s3d_mandatory_modes); i++) {
> + if (mode->hdisplay == s3d_mandatory_modes[i].width &&
> + mode->vdisplay == s3d_mandatory_modes[i].height &&
> + (mode->flags & s3d_mandatory_modes[i].select) ==
> + s3d_mandatory_modes[i].value &&
> + drm_mode_vrefresh(mode) == s3d_mandatory_modes[i].freq) {
> + mode->flags |= s3d_mandatory_modes[i].formats;
> + }
> + }
> +}
> +
> +static void cea_hdmi_patch_mandatory_3d_modes(struct drm_connector *connector)
> +{
> + struct drm_display_mode *mode;
> +
> + list_for_each_entry(mode, &connector->probed_modes, head)
> + cea_hdmi_patch_mandatory_3d_mode(mode);
> +}
> +
> static int
> add_cea_modes(struct drm_connector *connector, struct edid *edid)
> {
> u8 * cea = drm_find_cea_extension(edid);
> - u8 * db, dbl;
> - int modes = 0;
> + u8 * db, *hdmi = NULL, dbl;
> + int modes = 0, vendor_id;
>
> + /* let's find the cea modes before looking at the hdmi vendor block
> + * as the 3d_present flag needs to know about the supported modes
> + * to infer the 3D modes */
> if (cea && cea[1] >= 3) {
> for (db = cea + 4; db < cea + cea[2]; db += dbl + 1) {
> dbl = db[0] & 0x1f;
> - if (((db[0] & 0xe0) >> 5) == VIDEO_BLOCK)
> + switch ((db[0] & 0xe0) >> 5) {
> + case VIDEO_BLOCK:
> modes += do_cea_modes (connector, db+1, dbl);
> + break;
> + case VENDOR_BLOCK:
> + vendor_id = db[1] | db[2] << 8 | db[3] << 16;
> + if (vendor_id == HDMI_IDENTIFIER)
> + hdmi = db;
> + }
> }
> }
>
> + if (connector->expose_3d_modes && hdmi && cea_hdmi_3d_present(hdmi))
> + cea_hdmi_patch_mandatory_3d_modes(connector);
> +
> return modes;
> }
>
> diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
> index 45b19c6..d5d22de 100644
> --- a/include/drm/drm_mode.h
> +++ b/include/drm/drm_mode.h
> @@ -44,20 +44,27 @@
>
> /* Video mode flags */
> /* bit compatible with the xorg definitions. */
> -#define DRM_MODE_FLAG_PHSYNC (1<<0)
> -#define DRM_MODE_FLAG_NHSYNC (1<<1)
> -#define DRM_MODE_FLAG_PVSYNC (1<<2)
> -#define DRM_MODE_FLAG_NVSYNC (1<<3)
> -#define DRM_MODE_FLAG_INTERLACE (1<<4)
> -#define DRM_MODE_FLAG_DBLSCAN (1<<5)
> -#define DRM_MODE_FLAG_CSYNC (1<<6)
> -#define DRM_MODE_FLAG_PCSYNC (1<<7)
> -#define DRM_MODE_FLAG_NCSYNC (1<<8)
> -#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
> -#define DRM_MODE_FLAG_BCAST (1<<10)
> -#define DRM_MODE_FLAG_PIXMUX (1<<11)
> -#define DRM_MODE_FLAG_DBLCLK (1<<12)
> -#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
> +#define DRM_MODE_FLAG_PHSYNC (1<<0)
> +#define DRM_MODE_FLAG_NHSYNC (1<<1)
> +#define DRM_MODE_FLAG_PVSYNC (1<<2)
> +#define DRM_MODE_FLAG_NVSYNC (1<<3)
> +#define DRM_MODE_FLAG_INTERLACE (1<<4)
> +#define DRM_MODE_FLAG_DBLSCAN (1<<5)
> +#define DRM_MODE_FLAG_CSYNC (1<<6)
> +#define DRM_MODE_FLAG_PCSYNC (1<<7)
> +#define DRM_MODE_FLAG_NCSYNC (1<<8)
> +#define DRM_MODE_FLAG_HSKEW (1<<9) /* hskew provided */
> +#define DRM_MODE_FLAG_BCAST (1<<10)
> +#define DRM_MODE_FLAG_PIXMUX (1<<11)
> +#define DRM_MODE_FLAG_DBLCLK (1<<12)
> +#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
> +#define DRM_MODE_FLAG_3D_TOP_BOTTOM (1<<14)
> +#define DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF (1<<15)
> +#define DRM_MODE_FLAG_3D_FRAME_PACKING (1<<16)
> +
> +#define DRM_MODE_FLAG_3D_MASK (DRM_MODE_FLAG_3D_TOP_BOTTOM | \
> + DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF | \
> + DRM_MODE_FLAG_3D_FRAME_PACKING)
>
> /* DPMS flags */
> /* bit compatible with the xorg definitions. */
> --
> 1.7.11.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Intel-gfx] [PATCH 3/3] drm/i915: Add HDMI vendor info frame support
2012-09-27 18:41 ` [PATCH 3/3] drm/i915: Add HDMI vendor info frame support Damien Lespiau
@ 2012-09-29 0:50 ` Rodrigo Vivi
0 siblings, 0 replies; 10+ messages in thread
From: Rodrigo Vivi @ 2012-09-29 0:50 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx, dri-devel
On Thu, Sep 27, 2012 at 3:41 PM, Damien Lespiau
<damien.lespiau@gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> When scanning out a 3D framebuffer, send the corresponding infoframe to
> the HDMI sink.
>
> See http://www.hdmi.org/manufacturer/specification.aspx for details.
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> drivers/gpu/drm/i915/intel_drv.h | 14 +++++++++++
> drivers/gpu/drm/i915/intel_hdmi.c | 49 +++++++++++++++++++++++++++++++++++++-
> drivers/gpu/drm/i915/intel_modes.c | 12 ++++++++++
> 3 files changed, 74 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index cd54cf8..c326d30e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -263,6 +263,13 @@ struct cxsr_latency {
> #define DIP_SPD_BD 0xa
> #define DIP_SPD_SCD 0xb
>
> +#define DIP_TYPE_VENDOR 0x81
> +#define DIP_VERSION_VENDOR 0x1
> +#define DIP_HDMI_3D_PRESENT (0x2<<5)
> +#define DIP_HDMI_3D_STRUCT_FP (0x0<<4)
> +#define DIP_HDMI_3D_STRUCT_TB (0x6<<4)
> +#define DIP_HDMI_3D_STRUCT_SBSH (0x8<<4)
> +
> struct dip_infoframe {
> uint8_t type; /* HB0 */
> uint8_t ver; /* HB1 */
> @@ -292,6 +299,12 @@ struct dip_infoframe {
> uint8_t pd[16];
> uint8_t sdi;
> } __attribute__ ((packed)) spd;
> + struct {
> + uint8_t vendor_id[3];
> + uint8_t video_format;
> + uint8_t s3d_struct;
> + uint8_t s3d_ext_data;
> + } __attribute__ ((packed)) hdmi;
> uint8_t payload[27];
> } __attribute__ ((packed)) body;
> } __attribute__((packed));
> @@ -348,6 +361,7 @@ int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
>
> extern void intel_attach_force_audio_property(struct drm_connector *connector);
> extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
> +extern void intel_attach_expose_3d_modes_property(struct drm_connector *connector);
>
> extern void intel_crt_init(struct drm_device *dev);
> extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg);
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 98f6024..2d51b7e 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -83,6 +83,8 @@ static u32 g4x_infoframe_index(struct dip_infoframe *frame)
> return VIDEO_DIP_SELECT_AVI;
> case DIP_TYPE_SPD:
> return VIDEO_DIP_SELECT_SPD;
> + case DIP_TYPE_VENDOR:
> + return VIDEO_DIP_SELECT_VENDOR;
> default:
> DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
> return 0;
> @@ -96,6 +98,8 @@ static u32 g4x_infoframe_enable(struct dip_infoframe *frame)
> return VIDEO_DIP_ENABLE_AVI;
> case DIP_TYPE_SPD:
> return VIDEO_DIP_ENABLE_SPD;
> + case DIP_TYPE_VENDOR:
> + return VIDEO_DIP_ENABLE_VENDOR;
> default:
> DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
> return 0;
> @@ -338,6 +342,42 @@ static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder)
> intel_set_infoframe(encoder, &spd_if);
> }
>
> +static void intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder,
> + struct drm_display_mode *adjusted_mode)
> +{
> + struct dip_infoframe hdmi_if;
> +
> + /* We really only need to send a HDMI vendor info frame when having
> + * a 3D format to describe */
> + if (!(adjusted_mode->flags & DRM_MODE_FLAG_3D_MASK))
> + return;
> +
> + memset(&hdmi_if, 0, sizeof(hdmi_if));
> + hdmi_if.type = DIP_TYPE_VENDOR;
> + hdmi_if.ver = DIP_VERSION_VENDOR;
> + /* HDMI IEEE registration id, least significant bit first */
> + hdmi_if.body.hdmi.vendor_id[0] = 0x03;
> + hdmi_if.body.hdmi.vendor_id[1] = 0x0c;
> + hdmi_if.body.hdmi.vendor_id[2] = 0x00;
> + hdmi_if.body.hdmi.video_format = DIP_HDMI_3D_PRESENT;
> + if (adjusted_mode->flags & DRM_MODE_FLAG_3D_FRAME_PACKING)
> + hdmi_if.body.hdmi.s3d_struct = DIP_HDMI_3D_STRUCT_FP;
> + else if (adjusted_mode->flags & DRM_MODE_FLAG_3D_TOP_BOTTOM)
> + hdmi_if.body.hdmi.s3d_struct = DIP_HDMI_3D_STRUCT_TB;
> + else if (adjusted_mode->flags & DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF)
> + hdmi_if.body.hdmi.s3d_struct = DIP_HDMI_3D_STRUCT_SBSH;
> + /* len is the payload len, not including checksum. Side by side (half)
> + * has an extra byte for 3D_Ext_Data */
> + if (adjusted_mode->flags & DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF) {
> + hdmi_if.len = 6;
> + /* SBSH is subsampled by a factor of 2 */
> + hdmi_if.body.hdmi.s3d_ext_data = 2 << 4;
> + } else
> + hdmi_if.len = 5;
> +
> + intel_set_infoframe(encoder, &hdmi_if);
> +}
> +
> static void g4x_set_infoframes(struct drm_encoder *encoder,
> struct drm_display_mode *adjusted_mode)
> {
> @@ -398,6 +438,7 @@ static void g4x_set_infoframes(struct drm_encoder *encoder,
>
> intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
> intel_hdmi_set_spd_infoframe(encoder);
> + intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
> }
>
> static void ibx_set_infoframes(struct drm_encoder *encoder,
> @@ -457,6 +498,7 @@ static void ibx_set_infoframes(struct drm_encoder *encoder,
>
> intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
> intel_hdmi_set_spd_infoframe(encoder);
> + intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
> }
>
> static void cpt_set_infoframes(struct drm_encoder *encoder,
> @@ -492,6 +534,7 @@ static void cpt_set_infoframes(struct drm_encoder *encoder,
>
> intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
> intel_hdmi_set_spd_infoframe(encoder);
> + intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
> }
>
> static void vlv_set_infoframes(struct drm_encoder *encoder,
> @@ -526,6 +569,7 @@ static void vlv_set_infoframes(struct drm_encoder *encoder,
>
> intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
> intel_hdmi_set_spd_infoframe(encoder);
> + intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
set hdmi infoframes on hsw is missing. I can send my patch here, but
maybe it is better to keep everything together
> }
>
> static void hsw_set_infoframes(struct drm_encoder *encoder,
> @@ -792,7 +836,8 @@ intel_hdmi_set_property(struct drm_connector *connector,
> uint64_t val)
> {
> struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
> - struct drm_i915_private *dev_priv = connector->dev->dev_private;
> + struct drm_device *dev = connector->dev;
> + struct drm_i915_private *dev_priv = dev->dev_private;
> int ret;
>
> ret = drm_connector_property_set_value(connector, property, val);
> @@ -828,6 +873,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
> goto done;
> }
>
> +
> return -EINVAL;
>
> done:
> @@ -887,6 +933,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
> {
> intel_attach_force_audio_property(connector);
> intel_attach_broadcast_rgb_property(connector);
> + intel_attach_expose_3d_modes_property(connector);
> }
>
> void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
> diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
> index 29b7259..50216af 100644
> --- a/drivers/gpu/drm/i915/intel_modes.c
> +++ b/drivers/gpu/drm/i915/intel_modes.c
> @@ -124,3 +124,15 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector)
>
> drm_connector_attach_property(connector, prop, 0);
> }
> +
> +void
> +intel_attach_expose_3d_modes_property(struct drm_connector *connector)
> +{
> + struct drm_device *dev = connector->dev;
> + struct drm_property *prop;
> +
> + drm_mode_create_s3d_properties(dev);
> + prop = dev->mode_config.s3d_expose_modes_property;
> + drm_connector_attach_property(connector, prop,
> + DRM_MODE_EXPOSE_3D_MODES_OFF);
> +}
> --
> 1.7.11.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Tested-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm: Add an "expose 3d modes" property
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
2012-09-29 0:45 ` [Intel-gfx] " Rodrigo Vivi
@ 2012-09-29 9:01 ` Chris Wilson
2012-10-04 13:35 ` Daniel Vetter
2 siblings, 0 replies; 10+ messages in thread
From: Chris Wilson @ 2012-09-29 9:01 UTC (permalink / raw)
To: Damien Lespiau, intel-gfx, dri-devel
On Thu, 27 Sep 2012 19:41:06 +0100, Damien Lespiau <damien.lespiau@gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> The "expose 3D modes" property can be attached to connectors to allow
> user space to indicate it can deal with 3D modes and that the drm driver
> should expose those 3D modes.
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index bfacf0d..34372cb 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -578,6 +578,8 @@ struct drm_connector {
> /* requested DPMS state */
> int dpms;
>
> + int expose_3d_modes;
Looking at the surrounding code, this should be moved up and called
bool stereo_allowed;
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm: Add an "expose 3d modes" property
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
2012-09-29 0:45 ` [Intel-gfx] " Rodrigo Vivi
2012-09-29 9:01 ` Chris Wilson
@ 2012-10-04 13:35 ` Daniel Vetter
2012-10-04 13:56 ` Imre Deak
2 siblings, 1 reply; 10+ messages in thread
From: Daniel Vetter @ 2012-10-04 13:35 UTC (permalink / raw)
To: Damien Lespiau; +Cc: intel-gfx, dri-devel
On Thu, Sep 27, 2012 at 07:41:06PM +0100, Damien Lespiau wrote:
> From: Damien Lespiau <damien.lespiau@intel.com>
>
> The "expose 3D modes" property can be attached to connectors to allow
> user space to indicate it can deal with 3D modes and that the drm driver
> should expose those 3D modes.
>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
I've thought a bit more about this and I don't like the connector prop so
much any more:
- connector properties stick around, so if you mix up your userspace
things could go wrong (e.g. i-g-t tests and ddx).
- connector properties are exposed to users by default.
- it makes little sense for userspace to not enable this on all
connectors.
So I think a per-file_priv option to not filter out 3d modes would be
better suited.
We don't yet have any driver-agnostic ioctl yet for such things, so would
require a bit more work ...
-Daniel
> ---
> drivers/gpu/drm/drm_crtc.c | 35 ++++++++++++++++++++++++++++++++++-
> include/drm/drm_crtc.h | 6 ++++++
> include/drm/drm_mode.h | 4 ++++
> 3 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 6fbfc24..10a289c 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -841,6 +841,35 @@ 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 expose_3d_modes_list[] =
> +{
> + { DRM_MODE_EXPOSE_3D_MODES_OFF, "Off" },
> + { DRM_MODE_EXPOSE_3D_MODES_ON, "On" }
> +};
> +
> +/**
> + * drm_mode_create_s3d_properties - create stereo 3D properties
> + * @dev: DRM device
> + *
> + * This functions create properties that are used by the stereo 3D code. Those
> + * properties must be attached to the desired connectors afterwards.
> + */
> +int drm_mode_create_s3d_properties(struct drm_device *dev)
> +{
> + struct drm_property *prop;
> +
> + if (dev->mode_config.s3d_expose_modes_property)
> + return 0;
> +
> + prop = drm_property_create_enum(dev, 0, "expose 3D modes",
> + expose_3d_modes_list,
> + ARRAY_SIZE(expose_3d_modes_list));
> + dev->mode_config.s3d_expose_modes_property = prop;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_create_s3d_properties);
> +
> /**
> * drm_mode_create_scaling_mode_property - create scaling mode property
> * @dev: DRM device
> @@ -3170,12 +3199,16 @@ static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
> {
> int ret = -EINVAL;
> struct drm_connector *connector = obj_to_connector(obj);
> + struct drm_device *dev = connector->dev;
>
> /* Do DPMS ourselves */
> - if (property == connector->dev->mode_config.dpms_property) {
> + if (property == dev->mode_config.dpms_property) {
> if (connector->funcs->dpms)
> (*connector->funcs->dpms)(connector, (int)value);
> ret = 0;
> + } else if (property == dev->mode_config.s3d_expose_modes_property) {
> + connector->expose_3d_modes = value;
> + ret = 0;
> } else if (connector->funcs->set_property)
> ret = connector->funcs->set_property(connector, property, value);
>
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index bfacf0d..34372cb 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -578,6 +578,8 @@ struct drm_connector {
> /* requested DPMS state */
> int dpms;
>
> + int expose_3d_modes;
> +
> void *helper_private;
>
> /* forced on connector */
> @@ -802,6 +804,9 @@ struct drm_mode_config {
> struct drm_property *tv_saturation_property;
> struct drm_property *tv_hue_property;
>
> + /* Stereo 3D properties */
> + struct drm_property *s3d_expose_modes_property;
> +
> /* Optional properties */
> struct drm_property *scaling_mode_property;
> struct drm_property *dithering_mode_property;
> @@ -950,6 +955,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_s3d_properties(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);
> diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
> index 3d6301b..45b19c6 100644
> --- a/include/drm/drm_mode.h
> +++ b/include/drm/drm_mode.h
> @@ -83,6 +83,10 @@
> #define DRM_MODE_DIRTY_ON 1
> #define DRM_MODE_DIRTY_ANNOTATE 2
>
> +/* Expose 3D modes */
> +#define DRM_MODE_EXPOSE_3D_MODES_OFF 0
> +#define DRM_MODE_EXPOSE_3D_MODES_ON 1
> +
> struct drm_mode_modeinfo {
> __u32 clock;
> __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
> --
> 1.7.11.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Intel-gfx] [PATCH 1/3] drm: Add an "expose 3d modes" property
2012-10-04 13:35 ` Daniel Vetter
@ 2012-10-04 13:56 ` Imre Deak
0 siblings, 0 replies; 10+ messages in thread
From: Imre Deak @ 2012-10-04 13:56 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx, dri-devel
On Thu, 2012-10-04 at 15:35 +0200, Daniel Vetter wrote:
> On Thu, Sep 27, 2012 at 07:41:06PM +0100, Damien Lespiau wrote:
> > From: Damien Lespiau <damien.lespiau@intel.com>
> >
> > The "expose 3D modes" property can be attached to connectors to allow
> > user space to indicate it can deal with 3D modes and that the drm driver
> > should expose those 3D modes.
> >
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
>
> I've thought a bit more about this and I don't like the connector prop so
> much any more:
> - connector properties stick around, so if you mix up your userspace
> things could go wrong (e.g. i-g-t tests and ddx).
> - connector properties are exposed to users by default.
> - it makes little sense for userspace to not enable this on all
> connectors.
>
> So I think a per-file_priv option to not filter out 3d modes would be
> better suited.
>
> We don't yet have any driver-agnostic ioctl yet for such things, so would
> require a bit more work ...
This would be useful for the monotonic time stamp support too. At the
moment the client would have to set a flag whether it wants real or raw
timestamp for each wait-for-vblank and page-flip ioctl, though what it
really needs is a one time setting.
--Imre
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-10-04 13:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27 18:41 Stereo 3D modes support v2 Damien Lespiau
2012-09-27 18:41 ` [PATCH 1/3] drm: Add an "expose 3d modes" property Damien Lespiau
2012-09-29 0:45 ` [Intel-gfx] " Rodrigo Vivi
2012-09-29 9:01 ` Chris Wilson
2012-10-04 13:35 ` Daniel Vetter
2012-10-04 13:56 ` Imre Deak
2012-09-27 18:41 ` [PATCH 2/3] drm: Parse the HDMI cea vendor block for 3D present Damien Lespiau
2012-09-29 0:46 ` Rodrigo Vivi
2012-09-27 18:41 ` [PATCH 3/3] drm/i915: Add HDMI vendor info frame support Damien Lespiau
2012-09-29 0:50 ` [Intel-gfx] " Rodrigo Vivi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).