modesetting: Detect whether damage tracking is needed

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@keithp.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
Keith Packard 2014-12-19 18:40:19 -08:00
parent 7804305673
commit 0d37c7e4b5

View File

@ -875,6 +875,7 @@ CreateScreenResources(ScreenPtr pScreen)
PixmapPtr rootPixmap; PixmapPtr rootPixmap;
Bool ret; Bool ret;
void *pixels = NULL; void *pixels = NULL;
int err;
pScreen->CreateScreenResources = ms->createScreenResources; pScreen->CreateScreenResources = ms->createScreenResources;
ret = pScreen->CreateScreenResources(pScreen); ret = pScreen->CreateScreenResources(pScreen);
@ -911,6 +912,9 @@ CreateScreenResources(ScreenPtr pScreen)
return FALSE; return FALSE;
} }
err = drmModeDirtyFB(ms->fd, ms->drmmode.fb_id, NULL, 0);
if (err != -EINVAL && err != -ENOSYS) {
ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE,
pScreen, rootPixmap); pScreen, rootPixmap);
@ -924,6 +928,7 @@ CreateScreenResources(ScreenPtr pScreen)
"Failed to create screen damage record\n"); "Failed to create screen damage record\n");
return FALSE; return FALSE;
} }
}
return ret; return ret;
} }