sna: Do not set CAN_CREATE_GPU flag for untiled allocations
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 23 Jun 2014 08:20:55 +0000 (09:20 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 23 Jun 2014 08:43:10 +0000 (09:43 +0100)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/kgem.c
src/sna/sna_accel.c
src/sna/sna_glyphs.c

index 5e3c9f0..b54084c 100644 (file)
@@ -4260,7 +4260,7 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
        if (size > 0) {
                if (size <= kgem->max_cpu_size)
                        flags |= KGEM_CAN_CREATE_CPU;
-               if (size <= kgem->max_gpu_size)
+               else if (size <= kgem->max_gpu_size)
                        flags |= KGEM_CAN_CREATE_GPU;
                if (size <= PAGE_SIZE*kgem->aperture_mappable/4)
                        flags |= KGEM_CAN_CREATE_GTT;
@@ -4282,8 +4282,6 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
                DBG(("%s: tiled[%d] size=%d\n", __FUNCTION__, tiling, size));
                if (size > 0 && size <= kgem->max_gpu_size)
                        flags |= KGEM_CAN_CREATE_GPU;
-               if (size > kgem->max_gpu_size)
-                       flags &= ~KGEM_CAN_CREATE_GPU;
                if (size > 0 && size <= PAGE_SIZE*kgem->aperture_mappable/4)
                        flags |= KGEM_CAN_CREATE_GTT;
                if (size > PAGE_SIZE*kgem->aperture_mappable/4)
index f481c19..067f7dd 100644 (file)
@@ -3502,10 +3502,6 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
                DBG(("%s: last on cpu and needs damage, discard PREFER_GPU\n", __FUNCTION__));
                flags &= ~PREFER_GPU;
        }
-       if ((flags & FORCE_GPU) == 0 && priv->gpu_bo == NULL && sna_pixmap_choose_tiling(pixmap, DEFAULT_TILING) == I915_TILING_NONE) {
-               DBG(("%s: no gpu bo and linear, discard PREFER_GPU\n", __FUNCTION__));
-               flags &= ~PREFER_GPU;
-       }
 
        if ((flags & (PREFER_GPU | IGNORE_DAMAGE)) == IGNORE_DAMAGE) {
                if (priv->gpu_bo && (box_covers_pixmap(pixmap, box) || box_inplace(pixmap, box))) {
index fb4d7f1..5587fcc 100644 (file)
@@ -1161,6 +1161,7 @@ glyphs_via_mask(struct sna *sna,
        if (use_small_mask(sna, width, height, format->depth)) {
                pixman_image_t *mask_image;
 
+use_small_mask:
                DBG(("%s: small mask [format=%lx, depth=%d, size=%d], rendering glyphs to upload buffer\n",
                     __FUNCTION__, (unsigned long)format->format,
                     format->depth, (uint32_t)width*height*format->depth));
@@ -1340,6 +1341,11 @@ next_image:
                if (!pixmap)
                        return false;
 
+               if (sna_pixmap(pixmap) == NULL) {
+                       sna_pixmap_destroy(pixmap);
+                       goto use_small_mask;
+               }
+
                mask = CreatePicture(0, &pixmap->drawable,
                                     format, CPComponentAlpha,
                                     &component_alpha, serverClient, &error);