[PATCH 2/2] modesetting: Detect whether damage tracking is needed

Jason Ekstrand jason at jlekstrand.net
Fri Dec 19 21:35:51 PST 2014


On Dec 19, 2014 7:40 PM, "Keith Packard" <keithp at keithp.com> wrote:
>
> Call drmModeDirtyFB and check the return value to detect whether the
> driver support for damage tracking is present, only initialize it in
> that case.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  hw/xfree86/drivers/modesetting/driver.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/driver.c
b/hw/xfree86/drivers/modesetting/driver.c
> index 5929c03..be025bd 100644
> --- a/hw/xfree86/drivers/modesetting/driver.c
> +++ b/hw/xfree86/drivers/modesetting/driver.c
> @@ -875,6 +875,7 @@ CreateScreenResources(ScreenPtr pScreen)
>      PixmapPtr rootPixmap;
>      Bool ret;
>      void *pixels = NULL;
> +    int err;
>
>      pScreen->CreateScreenResources = ms->createScreenResources;
>      ret = pScreen->CreateScreenResources(pScreen);
> @@ -911,18 +912,22 @@ CreateScreenResources(ScreenPtr pScreen)
>              return FALSE;
>      }
>
> -    ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
> -                              pScreen, rootPixmap);
> +    err = drmModeDirtyFB(ms->fd, ms->drmmode.fb_id, NULL, 0);
>
> -    if (ms->damage) {
> -        DamageRegister(&rootPixmap->drawable, ms->damage);
> -        ms->dirty_enabled = TRUE;
> -        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking
initialized\n");
> -    }
> -    else {
> -        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> -                   "Failed to create screen damage record\n");
> -        return FALSE;
> +    if (err != -EINVAL && err != -ENOSYS) {

I'm not terribly familiar with the ioctls here, but why are we ignoring
EINVAL?  The previous patch made it sound like ENOSYS was the "I don't
support this" error and EINVAL was a genuine error.

Apart from this my limited X knowledge says it looks perfectly reasonable.
Both patches

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

> +        ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
> +                                  pScreen, rootPixmap);
> +
> +        if (ms->damage) {
> +            DamageRegister(&rootPixmap->drawable, ms->damage);
> +            ms->dirty_enabled = TRUE;
> +            xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking
initialized\n");
> +        }
> +        else {
> +            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
> +                       "Failed to create screen damage record\n");
> +            return FALSE;
> +        }
>      }
>      return ret;
>  }
> --
> 2.1.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20141219/e316d8f1/attachment-0001.html>


More information about the xorg-devel mailing list