summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-07-28 18:26:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-07-28 18:47:48 +0100
commit2100efa105e8c9615eda867d39471d78e500b1bb (patch)
tree4ce85664aea9e0a4d59f5bbfb8c70e3124cad336
parente436cf597d130dc65a60a450418b1fc20875aaf0 (diff)
sna/dri2: Don't cache allocate-as-scanout flag
commit 74c1e45ed579 ("sna/dri2: Look for potential flip targets when recreating backbuffers") cached the decision on whether to create the new back buffer as a scanout target believing that we would always get notified when the DRI2 drawable size changed. However, this is only true inside a composited environment where we see a change in the Window's pixmap. In a bare environment, we either need to chain into the screen->ResizeWindow or check every time whether we think a new backbuffer should be pre-allocated for use on the scanout. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_dri2.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 714595d8..08660c54 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -198,7 +198,6 @@ struct dri2_window {
int64_t msc_delta;
struct list cache;
uint32_t cache_size;
- int scanout;
};
static struct dri2_window *dri2_window(WindowPtr win)
@@ -214,14 +213,10 @@ static bool use_scanout(struct sna *sna,
if (priv->front)
return true;
- if (priv->scanout < 0)
- priv->scanout =
- (sna->flags & (SNA_LINEAR_FB | SNA_NO_WAIT | SNA_NO_FLIP)) == 0 &&
- draw->width == sna->front->drawable.width &&
- draw->height == sna->front->drawable.height &&
- draw->bitsPerPixel == sna->front->drawable.bitsPerPixel;
-
- return priv->scanout;
+ return (sna->flags & (SNA_LINEAR_FB | SNA_NO_WAIT | SNA_NO_FLIP)) == 0 &&
+ draw->width == sna->front->drawable.width &&
+ draw->height == sna->front->drawable.height &&
+ draw->bitsPerPixel == sna->front->drawable.bitsPerPixel;
}
static void
@@ -300,7 +295,8 @@ sna_dri2_get_back(struct sna *sna,
DBG(("%s: allocating new backbuffer\n", __FUNCTION__));
flags = CREATE_EXACT;
- if (use_scanout(sna, draw, priv)) {
+ if (get_private(back)->bo->scanout &&
+ use_scanout(sna, draw, priv)) {
DBG(("%s: requesting scanout compatible back\n", __FUNCTION__));
flags |= CREATE_SCANOUT;
}
@@ -1549,7 +1545,6 @@ draw_current_msc(DrawablePtr draw, xf86CrtcPtr crtc, uint64_t msc)
priv->crtc = crtc;
priv->msc_delta = 0;
priv->chain = NULL;
- priv->scanout = -1;
priv->cache_size = 0;
list_init(&priv->cache);
dri2_window_attach((WindowPtr)draw, priv);
@@ -1903,8 +1898,6 @@ void sna_dri2_decouple_window(WindowPtr win)
DBG(("%s: window=%ld\n", __FUNCTION__, win->drawable.id));
decouple_window(win, priv, to_sna_from_drawable(&win->drawable), true);
-
- priv->scanout = -1;
}
void sna_dri2_destroy_window(WindowPtr win)