<p dir="ltr"><br>
On Dec 19, 2014 7:40 PM, "Keith Packard" <<a href="mailto:keithp@keithp.com">keithp@keithp.com</a>> wrote:<br>
><br>
> Call drmModeDirtyFB and check the return value to detect whether the<br>
> driver support for damage tracking is present, only initialize it in<br>
> that case.<br>
><br>
> Signed-off-by: Keith Packard <<a href="mailto:keithp@keithp.com">keithp@keithp.com</a>><br>
> ---<br>
> hw/xfree86/drivers/modesetting/driver.c | 27 ++++++++++++++++-----------<br>
> 1 file changed, 16 insertions(+), 11 deletions(-)<br>
><br>
> diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c<br>
> index 5929c03..be025bd 100644<br>
> --- a/hw/xfree86/drivers/modesetting/driver.c<br>
> +++ b/hw/xfree86/drivers/modesetting/driver.c<br>
> @@ -875,6 +875,7 @@ CreateScreenResources(ScreenPtr pScreen)<br>
> PixmapPtr rootPixmap;<br>
> Bool ret;<br>
> void *pixels = NULL;<br>
> + int err;<br>
><br>
> pScreen->CreateScreenResources = ms->createScreenResources;<br>
> ret = pScreen->CreateScreenResources(pScreen);<br>
> @@ -911,18 +912,22 @@ CreateScreenResources(ScreenPtr pScreen)<br>
> return FALSE;<br>
> }<br>
><br>
> - ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,<br>
> - pScreen, rootPixmap);<br>
> + err = drmModeDirtyFB(ms->fd, ms->drmmode.fb_id, NULL, 0);<br>
><br>
> - if (ms->damage) {<br>
> - DamageRegister(&rootPixmap->drawable, ms->damage);<br>
> - ms->dirty_enabled = TRUE;<br>
> - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n");<br>
> - }<br>
> - else {<br>
> - xf86DrvMsg(pScrn->scrnIndex, X_ERROR,<br>
> - "Failed to create screen damage record\n");<br>
> - return FALSE;<br>
> + if (err != -EINVAL && err != -ENOSYS) {</p>
<p dir="ltr">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.</p>
<p dir="ltr">Apart from this my limited X knowledge says it looks perfectly reasonable. Both patches</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>></p>
<p dir="ltr">> + ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,<br>
> + pScreen, rootPixmap);<br>
> +<br>
> + if (ms->damage) {<br>
> + DamageRegister(&rootPixmap->drawable, ms->damage);<br>
> + ms->dirty_enabled = TRUE;<br>
> + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n");<br>
> + }<br>
> + else {<br>
> + xf86DrvMsg(pScrn->scrnIndex, X_ERROR,<br>
> + "Failed to create screen damage record\n");<br>
> + return FALSE;<br>
> + }<br>
> }<br>
> return ret;<br>
> }<br>
> --<br>
> 2.1.3<br>
><br>
> _______________________________________________<br>
> <a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
> Archives: <a href="http://lists.x.org/archives/xorg-devel">http://lists.x.org/archives/xorg-devel</a><br>
> Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel">http://lists.x.org/mailman/listinfo/xorg-devel</a></p>