diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-08 11:03:19 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-08 11:03:19 +0000 |
commit | aeaadb16093f83c9b830958c5946d4d048ffd26b (patch) | |
tree | f3158a57f8d82737ae966b200ffafe4579aa37ae /src | |
parent | 7577d6ea45794b83d2f84b175d453d8a460b0e9b (diff) |
sna: Handle creation of large Screen pixmap when the GPU is wedged
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=42606
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_accel.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 11ae4d25..7294e3fb 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -262,15 +262,21 @@ struct sna_pixmap *sna_pixmap_attach(PixmapPtr pixmap) case CREATE_PIXMAP_USAGE_SCRATCH_HEADER: #endif return NULL; - } - sna = to_sna_from_drawable(&pixmap->drawable); - if (!kgem_can_create_2d(&sna->kgem, - pixmap->drawable.width, - pixmap->drawable.height, - pixmap->drawable.bitsPerPixel, - sna_pixmap_choose_tiling(pixmap))) - return NULL; + case SNA_CREATE_FB: + /* We assume that the Screen pixmap will be pre-validated */ + break; + + default: + sna = to_sna_from_drawable(&pixmap->drawable); + if (!kgem_can_create_2d(&sna->kgem, + pixmap->drawable.width, + pixmap->drawable.height, + pixmap->drawable.bitsPerPixel, + sna_pixmap_choose_tiling(pixmap))) + return NULL; + break; + } return _sna_pixmap_attach(pixmap); } @@ -941,13 +947,20 @@ sna_pixmap_force_to_gpu(PixmapPtr pixmap) if (priv->gpu_bo == NULL) { struct sna *sna = to_sna_from_drawable(&pixmap->drawable); + unsigned flags; + + flags = 0; + if (priv->cpu_damage) + flags |= CREATE_INACTIVE; + if (pixmap->usage_hint == SNA_CREATE_FB) + flags |= CREATE_EXACT; priv->gpu_bo = kgem_create_2d(&sna->kgem, pixmap->drawable.width, pixmap->drawable.height, pixmap->drawable.bitsPerPixel, sna_pixmap_choose_tiling(pixmap), - priv->cpu_damage ? CREATE_INACTIVE : 0); + flags); if (priv->gpu_bo == NULL) return NULL; |