[Intel-gfx] [PATCH 2/3] glamor: turn on glamor.

Zhigang Gong zhigang.gong at linux.intel.com
Fri Nov 11 09:31:20 CET 2011


Add glamor's initialization to the uxa's control path.
At preInit stage, it creates and initialize EGL display
context for glamor. At the screenInit stage, it initialize
glamor's internal data structures and shaders.

And this commit enables textured pixmap also. Each pixmap
which has a valid BO can get a cooresponding texture.

After this commit. It's ready to do rendering through
glamor's rendering functions.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/intel_driver.c |   25 ++++++++++++++++++++++++-
 src/intel_uxa.c    |   22 +++++++++++++++++++++-
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/src/intel_driver.c b/src/intel_driver.c
index 24696da..cf50d67 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -75,6 +75,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i915_drm.h"
 #include <xf86drmMode.h>
 
+#ifdef GLAMOR
+#include "intel_glamor.h"
+#endif
+
 /* *INDENT-OFF* */
 /*
  * Note: "ColorKey" is provided for compatibility with the i810 driver.
@@ -712,6 +716,20 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 		return FALSE;
 	}
 
+#ifdef GLAMOR
+        /* Load glamor module */
+        if (!xf86LoadSubModule(scrn, "glamor_egl")) {
+                PreInitCleanup(scrn);
+                return FALSE;
+        }
+
+        if (!intel_glamor_pre_init(scrn)) {
+               xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+                          "Failed to pre init glamor display.\n");
+               return FALSE;
+        }
+#endif
+
 	/* Load the dri2 module if requested. */
 	if (intel->directRenderingType != DRI_DISABLED)
 		xf86LoadSubModule(scrn, "dri2");
@@ -1109,7 +1127,8 @@ static void I830FreeScreen(int scrnIndex, int flags)
 {
 	ScrnInfoPtr scrn = xf86Screens[scrnIndex];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-
+#ifdef GLAMOR
+#endif
 	if (intel) {
 		intel_mode_fini(intel);
 		intel_close_drm_master(intel);
@@ -1189,6 +1208,10 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 
 	DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
 
+#ifdef GLAMOR
+	intel_glamor_close_screen(screen);
+#endif
+
 	if (intel->uxa_driver) {
 		uxa_driver_fini(screen);
 		free(intel->uxa_driver);
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 8c6f754..f0e5803 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -40,6 +40,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <string.h>
 #include <errno.h>
 
+#ifdef GLAMOR
+#include "intel_glamor.h"
+#endif
+
 static const int I830CopyROP[16] = {
 	ROP_0,			/* GXclear */
 	ROP_DSa,		/* GXand */
@@ -965,6 +969,9 @@ void intel_uxa_block_handler(intel_screen_private *intel)
 	 * framebuffer until significantly later.
 	 */
 	intel_flush_rendering(intel);
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 }
 
 static PixmapPtr
@@ -1095,6 +1102,10 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		list_init(&priv->batch);
 		list_init(&priv->flush);
 		intel_set_pixmap_private(pixmap, priv);
+#ifdef GLAMOR
+		priv->pinned = 1;
+                intel_glamor_create_textured_pixmap(pixmap);
+#endif
 	}
 
 	return pixmap;
@@ -1102,8 +1113,12 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 
 static Bool intel_uxa_destroy_pixmap(PixmapPtr pixmap)
 {
-	if (pixmap->refcnt == 1)
+	if (pixmap->refcnt == 1) {
+#ifdef GLAMOR
+		intel_glamor_destroy_pixmap(pixmap);
+#endif
 		intel_set_pixmap_bo(pixmap, NULL);
+	}
 	fbDestroyPixmap(pixmap);
 	return TRUE;
 }
@@ -1134,6 +1149,9 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 		scrn->displayWidth = intel->front_pitch / intel->cpp;
 	}
 
+	if (!intel_glamor_create_screen_resources(screen))
+		return FALSE;
+
 	return TRUE;
 }
 
@@ -1296,5 +1314,7 @@ Bool intel_uxa_init(ScreenPtr screen)
 	uxa_set_fallback_debug(screen, intel->fallback_debug);
 	uxa_set_force_fallback(screen, intel->force_fallback);
 
+	intel_glamor_init(screen);
+
 	return TRUE;
 }
-- 
1.7.4.4




More information about the Intel-gfx mailing list