[PATCH v2 2/3] glamor: turn on glamor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Reviewed-by: Eugeni Dodonov <eugeni.dodonov at intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/intel_driver.c |   26 +++++++++++++++++++++++++-
 src/intel_uxa.c    |   25 +++++++++++++++++++++++--
 2 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/src/intel_driver.c b/src/intel_driver.c
index 24696da..63f83e7 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,9 @@ static void I830FreeScreen(int scrnIndex, int flags)
 {
 	ScrnInfoPtr scrn = xf86Screens[scrnIndex];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
-
+#ifdef GLAMOR
+	intel_glamor_free_screen(scrnIndex, flags);
+#endif
 	if (intel) {
 		intel_mode_fini(intel);
 		intel_close_drm_master(intel);
@@ -1189,6 +1209,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..3bbe531 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 */
@@ -964,6 +968,9 @@ void intel_uxa_block_handler(intel_screen_private *intel)
 	 * and beyond rendering results may not hit the
 	 * framebuffer until significantly later.
 	 */
+#ifdef GLAMOR
+	intel_glamor_block_handler(intel);
+#endif
 	intel_flush_rendering(intel);
 }
 
@@ -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,10 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
 		scrn->displayWidth = intel->front_pitch / intel->cpp;
 	}
 
+#ifdef GLAMOR
+	if (!intel_glamor_create_screen_resources(screen))
+		return FALSE;
+#endif
 	return TRUE;
 }
 
@@ -1295,6 +1314,8 @@ Bool intel_uxa_init(ScreenPtr screen)
 
 	uxa_set_fallback_debug(screen, intel->fallback_debug);
 	uxa_set_force_fallback(screen, intel->force_fallback);
-
+#ifdef GLAMOR
+	intel_glamor_init(screen);
+#endif
 	return TRUE;
 }
-- 
1.7.4.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux