[PATCHv3] modesetting: Update fb_id from shadow allocate and destroy if not set

Lyude Paul lyude at redhat.com
Thu Jul 5 13:42:49 UTC 2018


Reviewed-by: Lyude Paul <lyude at redhat.com>

On Thu, 2018-07-05 at 02:27 -0700, Tony Lindgren wrote:
> Looks like drmModeDirtyFB() stopped working at some point and we now
> call it with fb_id of zero for rotated displays. This will stop displays
> relying on DRM_IOCTL_MODE_DIRTYFB ioctl to display anything.
> 
> This regression probably with commit 3dcd591fa9b7 ("modesetting: Add
> support for using RandR shadow buffers") that inroduced rotate_fb_id.
> 
> Let's fix this issue by going through all the displays.
> 
> Cc: Hans De Goede <hdegoede at redhat.com>
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> Cc: Keith Packard <keithp at keithp.com>
> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Cc: Lyude Paul <lyude at redhat.com>
> Cc: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
> Cc: Tomi Valkeinen <tomi.valkeinen at ti.com>
> Signed-off-by: Tony Lindgren <tony at atomide.com>
> ---
> 
> Here's this one resent with proper patch description, sorry
> for the delays sending it out.
> 
> ---
> 
>  hw/xfree86/drivers/modesetting/driver.c | 41 +++++++++++++++++++++++--
>  1 file changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xfree86/drivers/modesetting/driver.c
> b/hw/xfree86/drivers/modesetting/driver.c
> --- a/hw/xfree86/drivers/modesetting/driver.c
> +++ b/hw/xfree86/drivers/modesetting/driver.c
> @@ -531,12 +531,11 @@ dispatch_dirty_region(ScrnInfoPtr scrn,
>  }
>  
>  static void
> -dispatch_dirty(ScreenPtr pScreen)
> +dispatch_dirty_fb_id(ScreenPtr pScreen, int fb_id)
>  {
>      ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
>      modesettingPtr ms = modesettingPTR(scrn);
>      PixmapPtr pixmap = pScreen->GetScreenPixmap(pScreen);
> -    int fb_id = ms->drmmode.fb_id;
>      int ret;
>  
>      ret = dispatch_dirty_region(scrn, pixmap, ms->damage, fb_id);
> @@ -547,7 +546,43 @@ dispatch_dirty(ScreenPtr pScreen)
>          ms->damage = NULL;
>          xf86DrvMsg(scrn->scrnIndex, X_INFO,
>                     "Disabling kernel dirty updates, not required.\n");
> -        return;
> +    }
> +}
> +
> +static void
> +dispatch_dirty(ScreenPtr pScreen)
> +{
> +    ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
> +    modesettingPtr ms = modesettingPTR(scrn);
> +    modesettingEntPtr ms_ent = ms_ent_priv(scrn);
> +    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> +    xf86CrtcPtr crtc;
> +    drmmode_crtc_private_ptr drmmode_crtc;
> +    unsigned int mask;
> +
> +    mask = ms_ent->assigned_crtcs;
> +
> +    while (mask) {
> +        int i, fb_id = 0;
> +
> +        i = ffs(mask) - 1;
> +
> +        crtc = xf86_config->crtc[i];
> +        if (!ms_crtc_on(crtc))
> +            goto skip;
> +
> +        drmmode_crtc = crtc->driver_private;
> +
> +        if (drmmode_crtc->rotate_fb_id)
> +            fb_id = drmmode_crtc->rotate_fb_id;
> +        else
> +            fb_id = ms->drmmode.fb_id;
> +
> +        if (fb_id)
> +            dispatch_dirty_fb_id(pScreen, fb_id);
> +
> +    skip:
> +        mask &= ~(1 << i);
>      }
>  }
>  
-- 
Cheers,
	Lyude Paul


More information about the xorg-devel mailing list