summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-22 13:24:07 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-22 14:13:00 +0000
commit7a6a2c5d4cc98da76c73152cb7eafcbdb0c088ec (patch)
tree3573ebf7e2fa7cf91bb53e8039feaaadd782fa97
parentf621b3de841f6037d387ca1439a0abe12ef29811 (diff)
sna: Setup the pixmap correctly in order to attach our private
During creation of sna_pixmap we validate that we can use a GPU bo with the target pixmap. This fails if we pass in a raw pixmap header, so make sure the scratch pixmap is fully initialised first. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index b3fc05ba..e8997602 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -508,9 +508,14 @@ sna_pixmap_create_scratch(ScreenPtr screen,
sna->freed_pixmap = NULL;
pixmap->usage_hint = CREATE_PIXMAP_USAGE_SCRATCH;
- pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pixmap->refcnt = 1;
+ pixmap->drawable.width = width;
+ pixmap->drawable.height = height;
+ pixmap->drawable.depth = depth;
+ pixmap->drawable.bitsPerPixel = bpp;
+ pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
priv = _sna_pixmap_reset(pixmap);
} else {
pixmap = create_pixmap(sna, screen, 0, 0, depth,
@@ -518,6 +523,11 @@ sna_pixmap_create_scratch(ScreenPtr screen,
if (pixmap == NullPixmap)
return NullPixmap;
+ pixmap->drawable.width = width;
+ pixmap->drawable.height = height;
+ pixmap->drawable.depth = depth;
+ pixmap->drawable.bitsPerPixel = bpp;
+
priv = _sna_pixmap_attach(sna, pixmap);
if (!priv) {
fbDestroyPixmap(pixmap);
@@ -525,6 +535,9 @@ sna_pixmap_create_scratch(ScreenPtr screen,
}
}
+ pixmap->devKind = PixmapBytePad(width, depth);
+ pixmap->devPrivate.ptr = NULL;
+
priv->gpu_bo = kgem_create_2d(&sna->kgem,
width, height, bpp, tiling,
0);
@@ -537,12 +550,6 @@ sna_pixmap_create_scratch(ScreenPtr screen,
priv->header = true;
sna_damage_all(&priv->gpu_damage, width, height);
- pixmap->drawable.width = width;
- pixmap->drawable.height = height;
- pixmap->drawable.depth = depth;
- pixmap->drawable.bitsPerPixel = bpp;
- pixmap->devKind = PixmapBytePad(width, depth);
- pixmap->devPrivate.ptr = NULL;
return pixmap;
}