xf86-video-intel: 2 commits - src/sna/kgem.c src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jul 16 01:05:14 PDT 2013


 src/sna/kgem.c      |    1 +
 src/sna/sna_accel.c |   18 +++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 1323abcc2eb19df81a000d4a37af6949801a9076
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 16 09:02:01 2013 +0100

    sna: Make the assumption bpp>=8 explicit inside the bo size calculation
    
    Use an assert to document that we have a few rounding issues if bpp < 8.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 237ecf2..02d7481 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1395,6 +1395,7 @@ static uint32_t kgem_surface_size(struct kgem *kgem,
 
 	assert(width <= MAXSHORT);
 	assert(height <= MAXSHORT);
+	assert(bpp >= 8);
 
 	if (kgem->gen <= 030) {
 		if (tiling) {
commit 4a447c514b3193897e0d3ec4b3cf75f346d7438e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jul 16 08:58:21 2013 +0100

    sna: Create a pixmap in ordinary system memory for depth=1 uploads
    
    Since we will not sample depth=1 pixmaps from the GPU, we may as well
    directly allocate these in system memory and avoid tickling the upload
    cache. This then avoids an issue within the size calculation code which
    makes the assumption that bpp>=8.
    
    Reported-by: Jiri Slaby <jirislaby at gmail.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 2eb1699..fa28b6d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3449,7 +3449,6 @@ sna_pixmap_create_upload(ScreenPtr screen,
 	struct sna *sna = to_sna_from_screen(screen);
 	PixmapPtr pixmap;
 	struct sna_pixmap *priv;
-	int bpp = bits_per_pixel(depth);
 	void *ptr;
 
 	DBG(("%s(%d, %d, %d, flags=%x)\n", __FUNCTION__,
@@ -3457,6 +3456,10 @@ sna_pixmap_create_upload(ScreenPtr screen,
 	assert(width);
 	assert(height);
 
+	if (depth == 1)
+		return create_pixmap(sna, screen, width, height, depth,
+				     CREATE_PIXMAP_USAGE_SCRATCH);
+
 	if (sna->freed_pixmap) {
 		pixmap = sna->freed_pixmap;
 		sna->freed_pixmap = pixmap->devPrivate.ptr;
@@ -3477,11 +3480,17 @@ sna_pixmap_create_upload(ScreenPtr screen,
 		sna_set_pixmap(pixmap, priv);
 	}
 
+	pixmap->drawable.width = width;
+	pixmap->drawable.height = height;
+	pixmap->drawable.depth = depth;
+	pixmap->drawable.bitsPerPixel = bits_per_pixel(depth);
+
 	priv = _sna_pixmap_reset(pixmap);
 	priv->header = true;
 
 	priv->gpu_bo = kgem_create_buffer_2d(&sna->kgem,
-					     width, height, bpp,
+					     width, height,
+					     pixmap->drawable.bitsPerPixel,
 					     flags, &ptr);
 	if (!priv->gpu_bo) {
 		free(priv);
@@ -3497,11 +3506,6 @@ sna_pixmap_create_upload(ScreenPtr screen,
 	sna_damage_all(&priv->gpu_damage, width, height);
 	sna_damage_all(&priv->cpu_damage, width, height);
 
-	pixmap->drawable.width = width;
-	pixmap->drawable.height = height;
-	pixmap->drawable.depth = depth;
-	pixmap->drawable.bitsPerPixel = bpp;
-	pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
 	pixmap->devKind = priv->gpu_bo->pitch;
 	pixmap->devPrivate.ptr = ptr;
 


More information about the xorg-commit mailing list