diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2017-07-12 12:13:03 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2017-07-28 12:00:35 +0900 |
commit | c2d26890691ec105858f086b63170ad94c6f7f05 (patch) | |
tree | ed9f94c522abd84e303538c297a5c63fb32f43f7 /src | |
parent | 377c9dc7e51cc8ebd06816b08682a8098a49508a (diff) |
Use root window (pixmap) instead of screen pixmap for scanout updates
Preparation for following changes, no functional change intended yet.
v2:
* Add drmmode_screen_damage_destroy callback to prevent use-after-free
on server shutdown
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/drmmode_display.c | 21 | ||||
-rw-r--r-- | src/radeon_kms.c | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 245a92fb..309ccbd6 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -529,11 +529,8 @@ drmmode_crtc_scanout_free(drmmode_crtc_private_ptr drmmode_crtc) &drmmode_crtc->scanout[1]); } - if (drmmode_crtc->scanout_damage) { + if (drmmode_crtc->scanout_damage) DamageDestroy(drmmode_crtc->scanout_damage); - drmmode_crtc->scanout_damage = NULL; - RegionUninit(&drmmode_crtc->scanout_last_region); - } } void @@ -605,6 +602,15 @@ radeon_screen_damage_report(DamagePtr damage, RegionPtr region, void *closure) damage->damage.data = NULL; } +static void +drmmode_screen_damage_destroy(DamagePtr damage, void *closure) +{ + drmmode_crtc_private_ptr drmmode_crtc = closure; + + drmmode_crtc->scanout_damage = NULL; + RegionUninit(&drmmode_crtc->scanout_last_region); +} + static Bool drmmode_can_use_hw_cursor(xf86CrtcPtr crtc) { @@ -793,9 +799,10 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode, if (!drmmode_crtc->scanout_damage) { drmmode_crtc->scanout_damage = DamageCreate(radeon_screen_damage_report, - NULL, DamageReportRawRegion, - TRUE, screen, NULL); - DamageRegister(&screen->GetScreenPixmap(screen)->drawable, + drmmode_screen_damage_destroy, + DamageReportRawRegion, + TRUE, screen, drmmode_crtc); + DamageRegister(&screen->root->drawable, drmmode_crtc->scanout_damage); } diff --git a/src/radeon_kms.c b/src/radeon_kms.c index b22c9840..f76d76a9 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -981,7 +981,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id) GCPtr gc = GetScratchGC(pDraw->depth, pScreen); ValidateGC(pDraw, gc); - (*gc->ops->CopyArea)(&pScreen->GetScreenPixmap(pScreen)->drawable, + (*gc->ops->CopyArea)(&pScreen->GetWindowPixmap(pScreen->root)->drawable, pDraw, gc, xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1, extents.x2 - extents.x1, extents.y2 - extents.y1, |