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>
This commit is contained in:
parent
f621b3de84
commit
7a6a2c5d4c
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue