xf86-video-intel: 4 commits - uxa/uxa-accel.c uxa/uxa.c uxa/uxa-priv.h uxa/uxa-render.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Jun 19 05:41:53 PDT 2010


 uxa/uxa-accel.c  |  122 ++++++++++++++++++-------------------------------------
 uxa/uxa-priv.h   |   31 -------------
 uxa/uxa-render.c |    3 +
 uxa/uxa.c        |    8 ---
 4 files changed, 43 insertions(+), 121 deletions(-)

New commits:
commit 4b7142baa0b3bf6f38843d06aadc579d8624cefc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 19 12:30:23 2010 +0100

    uxa: Enable SHM pixmaps
    
    Now with streaming uploads and downloads for composite operations in
    place, shared memory pixmaps are no longer that dire performance wise.
    With careful use these can in fact be the most efficient means of
    transfer between a wholly software renderer in the client and a backing
    store. For instance, Chromium renders internally to an ARGB32 image
    buffer and uses a shared pixmap to composite dirty regions into the
    backing store. Thereby using the GPU to either perform the blit or the
    format conversion. Enabling shared pixmaps, reduces our CPU overhead
    whilst scrolling by a factor of 5 or so.
    
    And this is achieved simply by deleting obsolete code!
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index acbc69f..00a43b1 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -361,92 +361,12 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 	return TRUE;
 }
 
-#ifdef MITSHM
-
-#include "xorgVersion.h"
-
-static Bool
-uxa_do_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
-		     unsigned int format, int w, int h, int sx, int sy, int sw,
-		     int sh, int dx, int dy, char *data)
-{
-	int src_stride = PixmapBytePad(w, depth);
-
-	if (uxa_do_put_image
-	    (pDrawable, pGC, depth, dx, dy, sw, sh, format,
-	     data + sy * src_stride + sx * BitsPerPixel(depth) / 8, src_stride))
-		return TRUE;
-
-	if (format == ZPixmap) {
-		PixmapPtr pPixmap;
-
-		pPixmap =
-		    GetScratchPixmapHeader(pDrawable->pScreen, w, h, depth,
-					   BitsPerPixel(depth), PixmapBytePad(w,
-									      depth),
-					   (pointer) data);
-		if (!pPixmap)
-			return FALSE;
-
-		if (!uxa_prepare_access(pDrawable, UXA_ACCESS_RW)) {
-			FreeScratchPixmapHeader(pPixmap);
-			return FALSE;
-		}
-
-		fbCopyArea((DrawablePtr) pPixmap, pDrawable, pGC, sx, sy, sw,
-			   sh, dx, dy);
-		uxa_finish_access(pDrawable);
-
-		FreeScratchPixmapHeader(pPixmap);
-
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,5,99,0,0)
-
-/* The actual ShmPutImage isn't wrapped by the damage layer, so we need to
- * inform any interested parties of the damage incurred to the drawable.
- *
- * We also need to set the pending damage to ensure correct migration in all
- * cases.
- */
-void
-uxa_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
-		  unsigned int format, int w, int h, int sx, int sy, int sw,
-		  int sh, int dx, int dy, char *data)
-{
-	if (!uxa_do_shm_put_image
-	    (pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
-	     data)) {
-		if (!uxa_prepare_access(pDrawable, UXA_ACCESS_RW))
-			return;
-		fbShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw,
-			      sh, dx, dy, data);
-		uxa_finish_access(pDrawable);
-	}
-}
-#else
-#define uxa_shm_put_image NULL
-#endif
-
-ShmFuncs uxa_shm_funcs = { NULL, uxa_shm_put_image };
-
-#endif
-
 static void
 uxa_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 	      int w, int h, int leftPad, int format, char *bits)
 {
-#ifdef MITSHM
-	if (!uxa_do_shm_put_image
-	    (pDrawable, pGC, depth, format, w, h, 0, 0, w, h, x, y, bits))
-#else
 	if (!uxa_do_put_image(pDrawable, pGC, depth, x, y, w, h, format, bits,
 			      PixmapBytePad(w, pDrawable->depth)))
-#endif
 		uxa_check_put_image(pDrawable, pGC, depth, x, y, w, h, leftPad,
 				    format, bits);
 }
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 626823f..b107928 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -41,14 +41,6 @@
 #include <X11/X.h>
 #define NEED_EVENTS
 #include <X11/Xproto.h>
-#ifdef MITSHM
-#ifdef HAVE_XEXTPROTO_71
-#include <X11/extensions/shm.h>
-#else
-#define _XSHM_SERVER_
-#include <X11/extensions/shmstr.h>
-#endif
-#endif
 #include "scrnintstr.h"
 #include "pixmapstr.h"
 #include "windowstr.h"
@@ -294,11 +286,6 @@ Bool
 uxa_fill_region_tiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
 		      DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu);
 
-void
-uxa_shm_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth,
-		  unsigned int format, int w, int h, int sx, int sy, int sw,
-		  int sh, int dx, int dy, char *data);
-
 void uxa_paint_window(WindowPtr pWin, RegionPtr pRegion, int what);
 
 void
@@ -307,24 +294,6 @@ uxa_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
 
 extern const GCOps uxa_ops;
 
-#ifdef MITSHM
-/* XXX these come from shmint.h, which isn't exported by the server */
-
-#ifdef HAVE_XEXTPROTO_71
-#include "shmint.h"
-#else
-
-void ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
-
-void ShmSetPixmapFormat(ScreenPtr pScreen, int format);
-
-void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
-#endif
-
-extern ShmFuncs uxa_shm_funcs;
-
-#endif
-
 #ifdef RENDER
 
 /* XXX these are in fbpict.h, which is not installed */
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 8689933..2321a7f 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -553,14 +553,6 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
 	}
 #endif
 
-#ifdef MITSHM
-	/* Re-register with the MI funcs, which don't allow shared pixmaps.
-	 * Shared pixmaps are almost always a performance loss for us, but this
-	 * still allows for SHM PutImage.
-	 */
-	ShmRegisterFuncs(screen, &uxa_shm_funcs);
-#endif
-
 	LogMessage(X_INFO,
 		   "UXA(%d): Driver registered support for the following"
 		   " operations:\n", screen->myNum);
commit d748f8e6fcebdf5b5b00c90b6c3d519560ee2928
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 17 18:29:55 2010 +0100

    uxa: Use accelerated get_image for copying to !offscreen
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 78d9562..acbc69f 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -618,8 +618,45 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
 		goto fallback;
 	}
 
-	if (!uxa_pixmap_is_offscreen(pDstPixmap))
-	    goto fallback;
+	if (!uxa_pixmap_is_offscreen(pDstPixmap)) {
+		int stride, bpp;
+		char *dst;
+
+		if (!uxa_pixmap_is_offscreen(pSrcPixmap))
+			goto fallback;
+
+		if (!uxa_screen->info->get_image)
+			goto fallback;
+
+		/* Don't bother with under 8bpp, XYPixmaps. */
+		bpp = pSrcPixmap->drawable.bitsPerPixel;
+		if (bpp != pDstDrawable->bitsPerPixel || bpp < 8)
+			goto fallback;
+
+		/* Only accelerate copies: no rop or planemask. */
+		if (pGC && (!UXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask) || pGC->alu != GXcopy))
+			goto fallback;
+
+		dst = pDstPixmap->devPrivate.ptr;
+		stride = pDstPixmap->devKind;
+		bpp /= 8;
+		while (nbox--) {
+			if (!uxa_screen->info->get_image(pSrcPixmap,
+							 pbox->x1 + src_off_x,
+							 pbox->y1 + src_off_y,
+							 pbox->x2 - pbox->x1,
+							 pbox->y2 - pbox->y1,
+							 (char *) dst +
+							 (pbox->y1 + dy + dst_off_y) * stride +
+							 (pbox->x1 + dx + dst_off_x) * bpp,
+							 stride))
+				goto fallback;
+
+			pbox++;
+		}
+
+		return;
+	}
 
 	if (uxa_pixmap_is_offscreen(pSrcPixmap)) {
 	    if (!(*uxa_screen->info->prepare_copy) (pSrcPixmap, pDstPixmap,
commit 78ee25f005fac9e9cc85425aa3fca8c396d015ea
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 17 18:37:32 2010 +0100

    uxa: Match depth 30 to format.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index ed643c6..78d9562 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -47,6 +47,7 @@ format_for_depth(int depth)
 	case 16: return PICT_r5g6b5;
 	default:
 	case 24: return PICT_x8r8g8b8;
+	case 30: return PICT_x2r10g10b10;
 	case 32: return PICT_a8r8g8b8;
 	}
 }
commit af5c4fc96db56a14bf6347774d8e8f23b38c5967
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 19 13:36:20 2010 +0100

    uxa: Check for allocation failure.
    
    Check for the NULL Picture prior to passing it to the backends for
    inspection.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 33fe9af..a4cebe3 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -856,6 +856,9 @@ uxa_acquire_picture(ScreenPtr screen,
 		dst = uxa_acquire_drawable(screen, src,
 					   x, y, width, height,
 					   out_x, out_y);
+		if (!dst)
+			return 0;
+
 		if (uxa_screen->info->check_composite_texture &&
 		    !uxa_screen->info->check_composite_texture(screen, dst)) {
 			if (dst != src)


More information about the xorg-commit mailing list