[Intel-gfx] [PATCH] drm/i915: Consider plane rotation when calculating stride in skl_do_mmio_flip

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Oct 7 05:15:43 PDT 2015


On 07/10/15 13:10, Jindal, Sonika wrote:
>
>
> On 10/7/2015 3:31 PM, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> Previously rotation was ignored and wrong stride programmed
>> into the plane registers resulting in a corrupt image on screen.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>> Cc: Sonika Jindal <sonika.jindal at intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++----
>>   1 file changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c
>> b/drivers/gpu/drm/i915/intel_display.c
>> index 539c3737e823..6328788193e4 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -11126,9 +11126,10 @@ static void skl_do_mmio_flip(struct
>> intel_crtc *intel_crtc)
>>   {
>>       struct drm_device *dev = intel_crtc->base.dev;
>>       struct drm_i915_private *dev_priv = dev->dev_private;
>> +    struct drm_plane *plane = intel_crtc->base.primary;
>>       struct drm_framebuffer *fb = intel_crtc->base.primary->fb;
>>       const enum pipe pipe = intel_crtc->pipe;
>> -    u32 ctl, stride;
>> +    u32 ctl, stride, tile_height;
>>
>>       ctl = I915_READ(PLANE_CTL(pipe, 0));
>>       ctl &= ~PLANE_CTL_TILED_MASK;
>> @@ -11152,9 +11153,16 @@ static void skl_do_mmio_flip(struct
>> intel_crtc *intel_crtc)
>>        * The stride is either expressed as a multiple of 64 bytes
>> chunks for
>>        * linear buffers or in number of tiles for tiled buffers.
>>        */
>> -    stride = fb->pitches[0] /
>> -         intel_fb_stride_alignment(dev, fb->modifier[0],
>> -                       fb->pixel_format);
>> +    if (intel_rotation_90_or_270(plane->state->rotation)) {
>> +        /* stride = Surface height in tiles */
>> +        tile_height = intel_tile_height(dev, fb->pixel_format,
>> +                        fb->modifier[0], 0);
>> +        stride = DIV_ROUND_UP(fb->height, tile_height);
> Wouldn't we need a PLANE_SIZE update somewhere in case of 90/270? For
> the cases where the plane is not square and can fit after rotation as well?

We can just say that orientation changes are not allowed between page 
flips. Or it can be improved later if I did not understand what you 
mean? Because without this patch page flipping when rotated 90/270 does 
not work at all.

Regards,

Tvrtko


More information about the Intel-gfx mailing list