[Intel-gfx] [PATCH] uxa/glamor: Prefer to create a pure glamor pixmap.

zhigang.gong at linux.intel.com zhigang.gong at linux.intel.com
Fri Dec 23 12:59:22 CET 2011


From: Zhigang Gong <zhigang.gong at linux.intel.com>

Prefer to create a pure glamor pixmap rather than a BO and then
create a texture from that BO in glamor. As this will avoid some
glFlush requirements, it can get about 20-30% performance gain.

When glamor is enabled, route the uxa_create_gc to glamor_create_gc.

This commit also removed the glFlush at the intel_glamor_finish_access.
When glamor is enabled, a pixmap will not be accessed by the UXA's
accelerated function. Only un-accelerated funtion may access those
pixmap, and before each un-accelerated rendering, it calls
uxa_prepare_access which will do glFlush there.

Removed deprecated function: intel_glamor_create_screen_image

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/intel_glamor.c |   14 --------------
 src/intel_glamor.h |    2 --
 src/intel_uxa.c    |    6 ++++++
 uxa/uxa-glamor.h   |    1 +
 uxa/uxa.c          |    6 ++++++
 5 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/intel_glamor.c b/src/intel_glamor.c
index 8daa4b1..669b1b8 100644
--- a/src/intel_glamor.c
+++ b/src/intel_glamor.c
@@ -135,7 +135,6 @@ intel_glamor_finish_access(PixmapPtr pixmap, uxa_access_t access)
 		break;
 	case UXA_GLAMOR_ACCESS_RW:
 		intel_glamor_need_flush(&pixmap->drawable);
-		glamor_block_handler(pixmap->drawable.pScreen);
 		break;
 	default:
 		ErrorF("Invalid access mode %d\n", access);
@@ -192,19 +191,6 @@ intel_glamor_flush(intel_screen_private * intel)
 }
 
 Bool
-intel_glamor_create_screen_image(ScreenPtr screen, int handle, int stride)
-{
-	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
-	intel_screen_private *intel;
-
-	intel = intel_get_screen_private(scrn);
-	if ((intel->uxa_flags & UXA_USE_GLAMOR) == 0)
-		return TRUE;
-
-	return glamor_egl_create_textured_screen(screen, handle, stride);
-}
-
-Bool
 intel_glamor_close_screen(ScreenPtr screen)
 {
 	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
diff --git a/src/intel_glamor.h b/src/intel_glamor.h
index 1374588..3065132 100644
--- a/src/intel_glamor.h
+++ b/src/intel_glamor.h
@@ -35,7 +35,6 @@
 Bool intel_glamor_pre_init(ScrnInfoPtr scrn);
 Bool intel_glamor_init(ScreenPtr screen);
 Bool intel_glamor_create_screen_resources(ScreenPtr screen);
-Bool intel_glamor_create_screen_image(ScreenPtr screen, int handle, int stride);
 Bool intel_glamor_close_screen(ScreenPtr screen);
 void intel_glamor_free_screen(int scrnIndex, int flags);
 
@@ -51,7 +50,6 @@ PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
 static inline Bool intel_glamor_pre_init(ScrnInfoPtr scrn) { return TRUE; }
 static inline Bool intel_glamor_init(ScreenPtr screen) { return TRUE; }
 static inline Bool intel_glamor_create_screen_resources(ScreenPtr screen) { return TRUE; }
-static inline Bool intel_glamor_create_screen_image(ScreenPtr screen, int handle, int stride) { return TRUE; }
 static inline Bool intel_glamor_close_screen(ScreenPtr screen) { return TRUE; }
 static inline void intel_glamor_free_screen(int scrnIndex, int flags) { }
 
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 9d74554..f04a2ef 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -1026,6 +1026,12 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 	struct intel_pixmap *priv;
 	PixmapPtr pixmap, new_pixmap = NULL;
 
+	if (!(usage & INTEL_CREATE_PIXMAP_DRI2)) {
+		pixmap = intel_glamor_create_pixmap(screen, w, h, depth, usage);
+		if (pixmap)
+			return pixmap;
+	}
+
 	if (w > 32767 || h > 32767)
 		return NullPixmap;
 
diff --git a/uxa/uxa-glamor.h b/uxa/uxa-glamor.h
index 71a9c29..2b4b452 100644
--- a/uxa/uxa-glamor.h
+++ b/uxa/uxa-glamor.h
@@ -51,6 +51,7 @@
 #define glamor_trapezoids_nf(...)	FALSE
 #define glamor_triangles_nf(...)	FALSE
 #define glamor_add_traps_nf(...)	FALSE
+#define glamor_create_gc(...)		FALSE
 #endif
 
 #endif /* UXA_GLAMOR_H */
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 5b3d709..72d5ffd 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -38,6 +38,7 @@
 #include <X11/fonts/fontstruct.h>
 #include "dixfontstr.h"
 #include "uxa.h"
+#include "uxa-glamor.h"
 
 #if HAS_DEVPRIVATEKEYREC
 DevPrivateKeyRec uxa_screen_index;
@@ -275,6 +276,11 @@ static GCFuncs uxaGCFuncs = {
  */
 static int uxa_create_gc(GCPtr pGC)
 {
+	uxa_screen_t *uxa_screen = uxa_get_screen(pGC->pScreen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR)
+		return glamor_create_gc(pGC);
+
 	if (!fbCreateGC(pGC))
 		return FALSE;
 
-- 
1.7.4.4




More information about the Intel-gfx mailing list