Skip to contentSkip to conversation

drm/amd/display: add HDMI Stereo 3D support

PATCH In review Jeff Smith 2 participants 8 messages May 8, 2017 – May 11, 2017

Subsystems (3)
lore
Share & tools
lore

Jeff Smith

author
#0 lore raw

v2 cover drm/amd/display: add HDMI Stereo 3D support

Changes: I have broken one patch into three.

Note: this only covers the display (not amdgpu) portion and does not
include the code to make it work over the card's DVI port.

I only have one Stereo-3D-capable display to test this on, an LG TV from about 2014. All 3 modes (side-by-side half, top-and-bottom, and frame-packing) appear to work as intended.

Jeff Smith (3):
drm/amd/display: translate drm's mode to display's stereo-3D timing drm/amd/display: use stereo-3D-aware methods when calculating
dimensions
drm/amd/display: enable stereo-3D modes/timings

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 33 +++++++++++++++-------
 .../display/dc/dce110/dce110_timing_generator.c    |  4 ---
 2 files changed, 23 insertions(+), 14 deletions(-)
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH v2 1/3 drm/amd/display: translate drm's mode to display's stereo-3D timing

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +16 -1
index 96f3cc1..a4d5536 100644
@@ -899,7 +899,22 @@ static void fill_stream_properties_from_drm_display_mode(
 	else
 		timing_out->pixel_encoding = PIXEL_ENCODING_RGB;
 
-	timing_out->timing_3d_format = TIMING_3D_FORMAT_NONE;
+	switch (mode_in->flags & DRM_MODE_FLAG_3D_MASK) {
+	case DRM_MODE_FLAG_3D_FRAME_PACKING:
+		timing_out->timing_3d_format = TIMING_3D_FORMAT_SW_FRAME_PACKING;
+		break;
+	case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM:
+		timing_out->timing_3d_format = TIMING_3D_FORMAT_TB_SW_PACKED;
+		break;
+	case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF:
+		timing_out->timing_3d_format = TIMING_3D_FORMAT_SBS_SW_PACKED;
+		break;
+	case DRM_MODE_FLAG_3D_NONE:
+	default:
+		timing_out->timing_3d_format = TIMING_3D_FORMAT_NONE;
+		break;
+	}
+
 	timing_out->display_color_depth = convert_color_depth_from_display_info(
 			connector);
 	timing_out->scan_type = SCANNING_TYPE_NODATA;
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH v2 2/3 drm/amd/display: use stereo-3D-aware methods to calculate dimensions

In reply to Jeff Smith
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +6 -8
index a4d5536..73aedd1 100644
@@ -691,8 +691,7 @@ static void update_stream_scaling_settings(
 		return;
 
 	/* Full screen scaling by default */
-	src.width = mode->hdisplay;
-	src.height = mode->vdisplay;
+	drm_crtc_get_hv_timing(mode, &src.width, &src.height);
 	dst.width = stream->timing.h_addressable;
 	dst.height = stream->timing.v_addressable;
 
@@ -1089,6 +1088,7 @@ static struct dc_stream *create_stream_for_sink(
 				dm_state->scaling != RMX_OFF);
 	}
 
+	drm_mode_set_crtcinfo(&mode, CRTC_STEREO_DOUBLE_ONLY);
 	fill_stream_properties_from_drm_display_mode(stream,
 			&mode, &aconnector->base);
 	update_stream_scaling_settings(&mode, dm_state, stream);
@@ -1579,13 +1579,12 @@ int amdgpu_dm_connector_mode_valid(
 		goto stream_create_fail;
 	}
 
-	drm_mode_set_crtcinfo(mode, 0);
+	drm_mode_set_crtcinfo(mode, CRTC_STEREO_DOUBLE);
 	fill_stream_properties_from_drm_display_mode(stream, mode, connector);
 
 	val_set.stream = stream;
 	val_set.surface_count = 0;
-	stream->src.width = mode->hdisplay;
-	stream->src.height = mode->vdisplay;
+	drm_crtc_get_hv_timing(mode, &stream->src.width, &stream->src.height);
 	stream->dst = stream->src;
 
 	context = dc_get_validate_context(adev->dm.dc, &val_set, 1);
@@ -1799,14 +1798,13 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
 		return result;
 	}
 
-	drm_mode_set_crtcinfo(mode, 0);
+	drm_mode_set_crtcinfo(mode, CRTC_STEREO_DOUBLE);
 
 	fill_stream_properties_from_drm_display_mode(stream, mode, connector);
 
 	val_set->stream = stream;
 
-	stream->src.width = mode->hdisplay;
-	stream->src.height = mode->vdisplay;
+	drm_crtc_get_hv_timing(mode, &stream->src.width, &stream->src.height);
 	stream->dst = stream->src;
 
 	return MODE_OK;
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#3 lore raw

PATCH v2 3/3 drm/amd/display: enable stereo-3D modes/timings

In reply to Jeff Smith
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c         | 2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +1 -1
index 73aedd1..ff3971e 100644
@@ -2104,7 +2104,7 @@ void amdgpu_dm_connector_init_helper(
 	aconnector->dc_link = link;
 	aconnector->base.interlace_allowed = false;
 	aconnector->base.doublescan_allowed = false;
-	aconnector->base.stereo_allowed = false;
+	aconnector->base.stereo_allowed = true;
 	aconnector->base.dpms = DRM_MODE_DPMS_OFF;
 	aconnector->hpd.hpd = AMDGPU_HPD_NONE; /* not used */
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +0 -4
index 7070aaf..f016661 100644
@@ -1110,10 +1110,6 @@ bool dce110_timing_generator_validate_timing(
 	if (!timing)
 		return false;
 
-	/* Currently we don't support 3D, so block all 3D timings */
-	if (timing->timing_3d_format != TIMING_3D_FORMAT_NONE)
-		return false;
-
 	/* Temporarily blocking interlacing mode until it's supported */
 	if (timing->flags.INTERLACE == 1)
 		return false;
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#4 lore raw
In reply to Jeff Smith

Series is Reviewed-by: Harry Wentland <[email protected]>

Harry

Quoted 15 lines · Jeff Smith

Changes: I have broken one patch into three.

Note: this only covers the display (not amdgpu) portion and does not
include the code to make it work over the card's DVI port.

I only have one Stereo-3D-capable display to test this on, an LG TV from about 2014. All 3 modes (side-by-side half, top-and-bottom, and frame-packing) appear to work as intended.

Jeff Smith (3):
drm/amd/display: translate drm's mode to display's stereo-3D timing drm/amd/display: use stereo-3D-aware methods when calculating
dimensions
drm/amd/display: enable stereo-3D modes/timings

Quoted 4 lines
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 33 +++++++++++++++-------
 .../display/dc/dce110/dce110_timing_generator.c    |  4 ---
 2 files changed, 23 insertions(+), 14 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#5 lore raw
In reply to Jeff Smith
Quoted 9 lines · Jeff Smith

Changes: I have broken one patch into three.

Note: this only covers the display (not amdgpu) portion and does not
include the code to make it work over the card's DVI port.

I only have one Stereo-3D-capable display to test this on, an LG TV from about 2014. All 3 modes (side-by-side half, top-and-bottom, and frame-packing) appear to work as intended.

Hi Jeff,

how do you test this? Which app, etc, are you using? I've never tested stereo 3D before on Linux but would really love to give this a quick spin before pulling these patches. Everything that pops up on google points me to the bino video player but that segfaults on Ubuntu 17.04 with any video.

Harry

Quoted 10 lines

Jeff Smith (3):
drm/amd/display: translate drm's mode to display's stereo-3D timing drm/amd/display: use stereo-3D-aware methods when calculating
dimensions
drm/amd/display: enable stereo-3D modes/timings

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 33 +++++++++++++++-------
 .../display/dc/dce110/dce110_timing_generator.c    |  4 ---
 2 files changed, 23 insertions(+), 14 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

I took the work from https://patchwork.freedesktop.org/patch/27065/
and cleaned it up. I've been meaning to take what I'd done and post it. Your question inspired me to take care of that and here is the result:
https://github.com/whydoubt/stereo-es2gears

Also, Alastair Bridgewater pointed out to me that intel-gpu-tools has some testing modes, but I only messed with it a little.
https://github.com/tiagovignatti/intel-gpu-tools

I have also played around with creating test patterns by extending
https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset.c
but that is some very raw stuff and probably not particularly helpful in the current state.

Quoted 12 lines · Harry Wentland
Quoted 10 lines · Jeff Smith

Changes: I have broken one patch into three.

Note: this only covers the display (not amdgpu) portion and does not
include the code to make it work over the card's DVI port.

I only have one Stereo-3D-capable display to test this on, an LG TV from about 2014. All 3 modes (side-by-side half, top-and-bottom, and frame-packing) appear to work as intended.

Quoted 23 lines

Hi Jeff,

how do you test this? Which app, etc, are you using? I've never tested stereo 3D before on Linux but would really love to give this a quick spin before pulling these patches. Everything that pops up on google points me to the bino video player but that segfaults on Ubuntu 17.04 with any video.

Harry

Quoted 11 lines

Jeff Smith (3):
drm/amd/display: translate drm's mode to display's stereo-3D timing drm/amd/display: use stereo-3D-aware methods when calculating
dimensions
drm/amd/display: enable stereo-3D modes/timings

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 33
+++++++++++++++-------
 .../display/dc/dce110/dce110_timing_generator.c    |  4 ---
 2 files changed, 23 insertions(+), 14 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Note, the higher level pieces are not yet in place, for this to work on X for instance.
I started to look at that a while back, only to realize the kernel driver needed help first.

Quoted 9 lines · Jeffrey Smith

I took the work from https://patchwork.freedesktop.org/patch/27065/
and cleaned it up. I've been meaning to take what I'd done and post it. Your question inspired me to take care of that and here is the result:
https://github.com/whydoubt/stereo-es2gears

Also, Alastair Bridgewater pointed out to me that intel-gpu-tools has some testing modes, but I only messed with it a little.
https://github.com/tiagovignatti/intel-gpu-tools

Quoted 41 lines

I have also played around with creating test patterns by extending
https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset.c
but that is some very raw stuff and probably not particularly helpful in the current state.

Quoted 35 lines · Harry Wentland
Quoted 10 lines · Jeff Smith

Changes: I have broken one patch into three.

Note: this only covers the display (not amdgpu) portion and does not
include the code to make it work over the card's DVI port.

I only have one Stereo-3D-capable display to test this on, an LG TV from about 2014. All 3 modes (side-by-side half, top-and-bottom, and frame-packing) appear to work as intended.

Hi Jeff,

how do you test this? Which app, etc, are you using? I've never tested stereo 3D before on Linux but would really love to give this a quick spin before pulling these patches. Everything that pops up on google points me to the bino video player but that segfaults on Ubuntu 17.04 with any video.

Harry

Quoted 11 lines

Jeff Smith (3):
drm/amd/display: translate drm's mode to display's stereo-3D timing drm/amd/display: use stereo-3D-aware methods when calculating
dimensions
drm/amd/display: enable stereo-3D modes/timings

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 33
+++++++++++++++-------
 .../display/dc/dce110/dce110_timing_generator.c    |  4 ---
 2 files changed, 23 insertions(+), 14 deletions(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel