diff options
author | Keith Packard <keithp@keithp.com> | 2014-12-19 18:40:19 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-12-25 12:59:56 -0800 |
commit | 0d37c7e4b5d63308a60ca59c9de981b380af8689 (patch) | |
tree | 7dbaf4c99b0cccb9f9565e30428fef6a6d3ad8a5 /hw/xfree86 | |
parent | 7804305673ca63720e8736c0c88afa711ebe208a (diff) |
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>
Diffstat (limited to 'hw/xfree86')
-rw-r--r-- | hw/xfree86/drivers/modesetting/driver.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index 5929c0356..be025bd07 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) { + 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; } |