sna/dri2: Don't cache allocate-as-scanout flag

commit 74c1e45ed5 ("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>
This commit is contained in:
Chris Wilson 2017-07-28 18:26:17 +01:00
parent e436cf597d
commit 2100efa105
1 changed files with 6 additions and 13 deletions

View File

@ -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)