]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amd/display: Fill plane attrs only for valid pxl format
authorRoman Li <Roman.Li@amd.com>
Thu, 25 Apr 2019 15:02:30 +0000 (11:02 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 24 May 2019 17:20:50 +0000 (12:20 -0500)
[Why]
In fill_plane_buffer_attributes() we calculate chroma/luma
assuming that the surface_pixel_format is always valid.
If it's not the case, there's a risk of divide by zero error.

[How]
Check if format valid before calculating pixel format attributes

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: David Francis <David.Francis@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 1e8b51d21feabe0e6933d1734f38fdd9abdd8f98..c6713432935e1ffe84cf53cbd4995c6a82d39b01 100644 (file)
@@ -2584,7 +2584,7 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev,
                address->type = PLN_ADDR_TYPE_GRAPHICS;
                address->grph.addr.low_part = lower_32_bits(afb->address);
                address->grph.addr.high_part = upper_32_bits(afb->address);
-       } else {
+       } else if (format < SURFACE_PIXEL_FORMAT_INVALID) {
                uint64_t chroma_addr = afb->address + fb->offsets[1];
 
                plane_size->video.luma_size.x = 0;