[Intel-gfx] [PATCH] drm/i915: Handle YUV subpixel support better

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Mar 18 15:13:57 UTC 2019


Op 18-03-2019 om 15:18 schreef Ville Syrjälä:
> On Mon, Mar 18, 2019 at 03:07:18PM +0100, Maarten Lankhorst wrote:
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_sprite.c | 29 +++++++++++++++++++----------
>>  1 file changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
>> index 268fb34ff0e2..862fc172042f 100644
>> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>> @@ -269,7 +269,8 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
>>  {
>>  	const struct drm_framebuffer *fb = plane_state->base.fb;
>>  	struct drm_rect *src = &plane_state->base.src;
>> -	u32 src_x, src_y, src_w, src_h;
>> +	u32 src_x, src_y, src_w, src_h, hsub, vsub;
>> +	bool rotated = drm_rotation_90_or_270(plane_state->base.rotation);
>>  
>>  	/*
>>  	 * Hardware doesn't handle subpixel coordinates.
>> @@ -287,18 +288,26 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
>>  	src->y1 = src_y << 16;
>>  	src->y2 = (src_y + src_h) << 16;
>>  
>> -	if (fb->format->is_yuv &&
>> -	    (src_x & 1 || src_w & 1)) {
>> -		DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n",
>> -			      src_x, src_w);
>> +	if (!fb->format->is_yuv)
>> +		return 0;
>> +
>> +	/* YUV specific checks */
>> +	if (!rotated) {
>> +		hsub = fb->format->hsub;
>> +		vsub = fb->format->vsub;
>> +	} else {
>> +		hsub = vsub = max(fb->format->hsub, fb->format->vsub);
> Why this? From the looks of things there should be no need to deal with
> rotation in this function at all.

I wrote a dumb test that fails if I rotate YUYV.

https://patchwork.freedesktop.org/patch/286170/

Corrupted image:

(kms_yuv:1155) igt_kms-DEBUG: display: A.0: plane_set_rotation(90°)
(kms_yuv:1155) igt_kms-DEBUG: display: A.0: src_set_position(18,33)
(kms_yuv:1155) igt_kms-DEBUG: display: A.0: src_set_size(44x65)
(kms_yuv:1155) igt_kms-DEBUG: display: A.0: plane_set_position(64,64)
(kms_yuv:1155) igt_kms-DEBUG: display: A.0: plane_set_size (256x256)

I had a 80x128 fb, only showing the center part which should be white, with a black border around it to cause CRC errors if we mess up clipping.

The scaling works fine, but the clipping does not in this case. I am getting a corrupted plane on screen which is mostly white, but with black dots in each tile.

Scaling just magnifies this corruption. :)



More information about the Intel-gfx mailing list