public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Zhigang Gong <zhigang.gong@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/3] glamor: turn on glamor.
Date: Fri, 11 Nov 2011 16:31:20 +0800	[thread overview]
Message-ID: <1321000281-5097-2-git-send-email-zhigang.gong@linux.intel.com> (raw)
In-Reply-To: <1321000281-5097-1-git-send-email-zhigang.gong@linux.intel.com>

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@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

  reply	other threads:[~2011-11-11  8:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11  8:31 [PATCH 1/3] glamor: Initial commit to introduce glamor acceleration Zhigang Gong
2011-11-11  8:31 ` Zhigang Gong [this message]
2011-11-11  9:11   ` [PATCH 2/3] glamor: turn on glamor Chris Wilson
2011-11-11 10:52     ` Zhigang Gong
2011-11-11 13:12       ` Chris Wilson
2011-11-14  5:01         ` Zhigang Gong
2011-11-14  9:07           ` Chris Wilson
2011-11-14 12:02             ` Zhigang Gong
2011-11-11 12:58   ` Eugeni Dodonov
2011-11-14  5:05     ` Zhigang Gong
2011-11-11  8:31 ` [PATCH 3/3] glamor: Route fillspans and polyfillrects to glamor Zhigang Gong
2011-11-11  9:07   ` Chris Wilson
2011-11-11 10:48     ` Zhigang Gong
2011-11-11 13:54       ` Chris Wilson
2011-11-14  3:32         ` Zhigang Gong
2011-11-11 12:56 ` [PATCH 1/3] glamor: Initial commit to introduce glamor acceleration Eugeni Dodonov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321000281-5097-2-git-send-email-zhigang.gong@linux.intel.com \
    --to=zhigang.gong@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox