aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHarry Wentland <harry.wentland@amd.com>2017-12-18 13:48:12 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-03-07 16:27:30 -0500
commit52f401f9019975350bfd53e00026772fccde63fe (patch)
treeea9941ceef480cb3d3747e5f79ec48ddeab3217f /drivers
parentdb195488661ef397fe1a3af745a11aa2d1b20940 (diff)
drm/amd/display: Make create_stream_for_sink more consistent
We've got a helper function to call dc_create_stream_for_sink and one other place that calls it directly. Make sure we call the helper functions always since we need to update a bunch of things in stream and don't want to miss that. Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e635db87a1a0..ce541f53c22d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2016,30 +2016,32 @@ static void update_stream_scaling_settings(const struct drm_display_mode *mode,
2016 dst.width = stream->timing.h_addressable; 2016 dst.width = stream->timing.h_addressable;
2017 dst.height = stream->timing.v_addressable; 2017 dst.height = stream->timing.v_addressable;
2018 2018
2019 rmx_type = dm_state->scaling; 2019 if (dm_state) {
2020 if (rmx_type == RMX_ASPECT || rmx_type == RMX_OFF) { 2020 rmx_type = dm_state->scaling;
2021 if (src.width * dst.height < 2021 if (rmx_type == RMX_ASPECT || rmx_type == RMX_OFF) {
2022 src.height * dst.width) { 2022 if (src.width * dst.height <
2023 /* height needs less upscaling/more downscaling */ 2023 src.height * dst.width) {
2024 dst.width = src.width * 2024 /* height needs less upscaling/more downscaling */
2025 dst.height / src.height; 2025 dst.width = src.width *
2026 } else { 2026 dst.height / src.height;
2027 /* width needs less upscaling/more downscaling */ 2027 } else {
2028 dst.height = src.height * 2028 /* width needs less upscaling/more downscaling */
2029 dst.width / src.width; 2029 dst.height = src.height *
2030 dst.width / src.width;
2031 }
2032 } else if (rmx_type == RMX_CENTER) {
2033 dst = src;
2030 } 2034 }
2031 } else if (rmx_type == RMX_CENTER) {
2032 dst = src;
2033 }
2034 2035
2035 dst.x = (stream->timing.h_addressable - dst.width) / 2; 2036 dst.x = (stream->timing.h_addressable - dst.width) / 2;
2036 dst.y = (stream->timing.v_addressable - dst.height) / 2; 2037 dst.y = (stream->timing.v_addressable - dst.height) / 2;
2037 2038
2038 if (dm_state->underscan_enable) { 2039 if (dm_state->underscan_enable) {
2039 dst.x += dm_state->underscan_hborder / 2; 2040 dst.x += dm_state->underscan_hborder / 2;
2040 dst.y += dm_state->underscan_vborder / 2; 2041 dst.y += dm_state->underscan_vborder / 2;
2041 dst.width -= dm_state->underscan_hborder; 2042 dst.width -= dm_state->underscan_hborder;
2042 dst.height -= dm_state->underscan_vborder; 2043 dst.height -= dm_state->underscan_vborder;
2044 }
2043 } 2045 }
2044 2046
2045 stream->src = src; 2047 stream->src = src;
@@ -2367,11 +2369,6 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
2367 return stream; 2369 return stream;
2368 } 2370 }
2369 2371
2370 if (dm_state == NULL) {
2371 DRM_ERROR("dm_state is NULL!\n");
2372 return stream;
2373 }
2374
2375 drm_connector = &aconnector->base; 2372 drm_connector = &aconnector->base;
2376 2373
2377 if (!aconnector->dc_sink) { 2374 if (!aconnector->dc_sink) {
@@ -2418,7 +2415,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
2418 } else { 2415 } else {
2419 decide_crtc_timing_for_drm_display_mode( 2416 decide_crtc_timing_for_drm_display_mode(
2420 &mode, preferred_mode, 2417 &mode, preferred_mode,
2421 dm_state->scaling != RMX_OFF); 2418 dm_state ? (dm_state->scaling != RMX_OFF) : false);
2422 } 2419 }
2423 2420
2424 fill_stream_properties_from_drm_display_mode(stream, 2421 fill_stream_properties_from_drm_display_mode(stream,
@@ -2800,7 +2797,7 @@ int amdgpu_dm_connector_mode_valid(struct drm_connector *connector,
2800 goto fail; 2797 goto fail;
2801 } 2798 }
2802 2799
2803 stream = dc_create_stream_for_sink(dc_sink); 2800 stream = create_stream_for_sink(aconnector, mode, NULL);
2804 if (stream == NULL) { 2801 if (stream == NULL) {
2805 DRM_ERROR("Failed to create stream for sink!\n"); 2802 DRM_ERROR("Failed to create stream for sink!\n");
2806 goto fail; 2803 goto fail;