aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display
diff options
context:
space:
mode:
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>2019-04-01 09:43:34 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-04-15 01:21:28 -0400
commit6491f0c05abd009631e0d0a33d671bb5a685847a (patch)
treefb35af18eb374dddcf045d0a4f9e9c041a7e8be7 /drivers/gpu/drm/amd/display
parent5ac4619b9d2fdbb54ef4b247db774637e347d46e (diff)
drm/amd/display: Add basic downscale and upscale valdiation
[Why] Planes have downscaling limits and upscaling limits per format and DM is expected to validate these using DC caps. We should fail atomic check validation if we aren't capable of doing the scaling. [How] We don't currently create store which DC plane maps to which DRM plane so we can't easily check the caps directly. For now add basic constraints that cover the absolute min and max downscale / upscale limits for most RGB and YUV formats across ASICs. Leave a TODO indicating that these should really be done with DC caps. We'll probably need to subclass DRM planes again in order to correctly identify which DC plane maps to it. Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Reviewed-by: Harry Wentland <Harry.Wentland@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Bhawanpreet Lakha <Bhawanpreet Lakha@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c15
1 files changed, 15 insertions, 0 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 5bf71a65f056..752179b359f1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2389,6 +2389,8 @@ static const struct drm_encoder_funcs amdgpu_dm_encoder_funcs = {
2389static int fill_dc_scaling_info(const struct drm_plane_state *state, 2389static int fill_dc_scaling_info(const struct drm_plane_state *state,
2390 struct dc_scaling_info *scaling_info) 2390 struct dc_scaling_info *scaling_info)
2391{ 2391{
2392 int scale_w, scale_h;
2393
2392 memset(scaling_info, 0, sizeof(*scaling_info)); 2394 memset(scaling_info, 0, sizeof(*scaling_info));
2393 2395
2394 /* Source is fixed 16.16 but we ignore mantissa for now... */ 2396 /* Source is fixed 16.16 but we ignore mantissa for now... */
@@ -2419,6 +2421,19 @@ static int fill_dc_scaling_info(const struct drm_plane_state *state,
2419 /* DRM doesn't specify clipping on destination output. */ 2421 /* DRM doesn't specify clipping on destination output. */
2420 scaling_info->clip_rect = scaling_info->dst_rect; 2422 scaling_info->clip_rect = scaling_info->dst_rect;
2421 2423
2424 /* TODO: Validate scaling per-format with DC plane caps */
2425 scale_w = scaling_info->dst_rect.width * 1000 /
2426 scaling_info->src_rect.width;
2427
2428 if (scale_w < 250 || scale_w > 16000)
2429 return -EINVAL;
2430
2431 scale_h = scaling_info->dst_rect.height * 1000 /
2432 scaling_info->src_rect.height;
2433
2434 if (scale_h < 250 || scale_h > 16000)
2435 return -EINVAL;
2436
2422 /* 2437 /*
2423 * The "scaling_quality" can be ignored for now, quality = 0 has DC 2438 * The "scaling_quality" can be ignored for now, quality = 0 has DC
2424 * assume reasonable defaults based on the format. 2439 * assume reasonable defaults based on the format.