summaryrefslogtreecommitdiff
path: root/hw/xfree86/drivers
diff options
context:
space:
mode:
authorAlex Goins <agoins@nvidia.com>2016-06-16 20:06:50 -0700
committerAdam Jackson <ajax@redhat.com>2016-06-28 12:56:25 -0400
commitb773a9c8126222e5fed2904d012fbf917a9f22fd (patch)
tree518e4986db9e64640d71f3c9778e9b1083b4edd9 /hw/xfree86/drivers
parentf4c37eeee7953df1fe0e3196eda452acf0078e61 (diff)
modesetting: Always tear down scanout pixmap
drmmode_set_scanout_pixmap_(cpu/gpu) would only do teardown if ppix == NULL. This meant that if there were consecutive calls to SetScanoutPixmap(ppix != NULL) without calls to SetScanoutPixmap(ppix == NULL) in between, earlier calls would be leaked. RRReplaceScanoutPixmap() does this today. Instead, when setting a scanout pixmap, always do teardown of the existing scanout pixmap before setting up the new one. Then, if there is no new one to set up, stop there. This maintains the previous behavior in all cases except those with multiple consecutive calls to SetScanoutPixmap(ppix != NULL). v1: N/A v2: N/A v3: N/A v4: N/A v5: Initial commit v6: Rebase onto ToT v7: Unchanged Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Alex Goins <agoins@nvidia.com>
Diffstat (limited to 'hw/xfree86/drivers')
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 89c468b34..cce9a3378 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -638,17 +638,18 @@ drmmode_set_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix)
drmmode_ptr drmmode = drmmode_crtc->drmmode;
int c, total_width = 0, max_height = 0, this_x = 0;
- if (!ppix) {
- if (drmmode_crtc->prime_pixmap) {
- PixmapStopDirtyTracking(drmmode_crtc->prime_pixmap, screenpix);
- if (drmmode->fb_id) {
- drmModeRmFB(drmmode->fd, drmmode->fb_id);
- drmmode->fb_id = 0;
- }
+ if (drmmode_crtc->prime_pixmap) {
+ PixmapStopDirtyTracking(drmmode_crtc->prime_pixmap, screenpix);
+ if (drmmode->fb_id) {
+ drmModeRmFB(drmmode->fd, drmmode->fb_id);
+ drmmode->fb_id = 0;
}
drmmode_crtc->prime_pixmap_x = 0;
- return TRUE;
}
+
+ if (!ppix)
+ return TRUE;
+
/* iterate over all the attached crtcs to work out the bounding box */
for (c = 0; c < xf86_config->num_crtc; c++) {
xf86CrtcPtr iter = xf86_config->crtc[c];
@@ -689,18 +690,18 @@ drmmode_set_scanout_pixmap_cpu(xf86CrtcPtr crtc, PixmapPtr ppix)
msPixmapPrivPtr ppriv;
void *ptr;
- if (!ppix) {
- if (drmmode_crtc->prime_pixmap) {
- ppriv = msGetPixmapPriv(drmmode, drmmode_crtc->prime_pixmap);
- drmModeRmFB(drmmode->fd, ppriv->fb_id);
- ppriv->fb_id = 0;
- }
- if (drmmode_crtc->slave_damage) {
- DamageUnregister(drmmode_crtc->slave_damage);
- drmmode_crtc->slave_damage = NULL;
- }
- return TRUE;
+ if (drmmode_crtc->prime_pixmap) {
+ ppriv = msGetPixmapPriv(drmmode, drmmode_crtc->prime_pixmap);
+ drmModeRmFB(drmmode->fd, ppriv->fb_id);
+ ppriv->fb_id = 0;
}
+ if (drmmode_crtc->slave_damage) {
+ DamageUnregister(drmmode_crtc->slave_damage);
+ drmmode_crtc->slave_damage = NULL;
+ }
+
+ if (!ppix)
+ return TRUE;
ppriv = msGetPixmapPriv(drmmode, ppix);
if (!drmmode_crtc->slave_damage) {