Skip to contentSkip to conversation

glamor: Initial commit to introduce glamor acceleration.

PATCH New Zhigang Gong 1 participant 3 messages Nov 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 glamor: Initial commit to introduce glamor acceleration.

Added one configuration option --enable-glamor to control whether use glamor. Added one new file intel_glamor.c to wrap glamor egl API for intel driver's usage.
This commit doesn't really change the driver's control path. It just adds necessary files for glamor and change some configuration.

---
 configure.ac       |   17 +++++++
 src/Makefile.am    |    5 ++
 src/intel_glamor.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/intel_glamor.h |   45 ++++++++++++++++++
 4 files changed, 197 insertions(+), 0 deletions(-)
 create mode 100644 src/intel_glamor.c
 create mode 100644 src/intel_glamor.h
configure.ac +17 -0
index fccab56..dc01c46 100644
@@ -126,6 +126,15 @@ AC_ARG_ENABLE(sna,
 	      [SNA="$enableval"],
 	      [SNA=no])
 AM_CONDITIONAL(SNA, test x$SNA != xno)
+
+AC_ARG_ENABLE(glamor,
+	      AS_HELP_STRING([--enable-glamor],
+			     [Enable glamor, a new GL-based acceleration [default=no]]),
+	      [GLAMOR="$enableval"],
+	      [GLAMOR=no])
+
+AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
+
 AC_MSG_CHECKING([whether to include SNA support])
 
 required_xorg_xserver_version=1.6
@@ -137,6 +146,14 @@ if test "x$SNA" != "xno"; then
 fi
 AC_MSG_RESULT([$SNA])
 
+if test "x$GLAMOR" != "xno"; then
+	PKG_CHECK_MODULES(LIBGLAMOR, [glamor])
+	PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
+	AC_DEFINE(GLAMOR, 1, [Enable glamor acceleration])
+fi
+
+AC_MSG_CHECKING([whether to include GLAMOR support])
+AC_MSG_RESULT([$GLAMOR])
 
 AC_ARG_ENABLE(vmap,
 	      AS_HELP_STRING([--enable-vmap],
src/Makefile.am +5 -0
index cd1bb36..1a29390 100644
@@ -40,6 +40,10 @@ SUBDIRS += sna
 intel_drv_la_LIBADD += sna/libsna.la
 endif
 
+if GLAMOR
+GLAMOR_SOURCE = intel_glamor.c
+endif
+
 NULL:=#
 
 intel_drv_la_SOURCES = \
@@ -70,6 +74,7 @@ intel_drv_la_SOURCES = \
 	 i965_3d.c \
 	 i965_video.c \
 	 i965_render.c \
+	 $(GLAMOR_SOURCE) \
 	 $(NULL)
 
 if DRI
src/intel_glamor.c new file +130 -0

130 lines not on this page · raw message

src/intel_glamor.h new file +45 -0

45 lines not on this page · raw message

Signature · 6 lines
1.7.4.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v2 2/3 glamor: turn on glamor.

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.

---
 src/intel_driver.c |   26 +++++++++++++++++++++++++-
 src/intel_uxa.c    |   25 +++++++++++++++++++++++--
 2 files changed, 48 insertions(+), 3 deletions(-)
src/intel_driver.c +25 -1
index 24696da..63f83e7 100644
@@ -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);
src/intel_uxa.c +23 -2
index 8c6f754..3bbe531 100644
@@ -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;
 }
Signature · 1 line
1.7.4.4
#2 lore raw

PATCH v2 3/3 glamor: Route fillspans and polyfillrects to glamor.

In reply to Zhigang Gong

If GLAMOR is enabled, we route UXA's fillspans and polyfillrects to glamor by default. And if glamor fail to accelerate it, UXA continue to handle it.

---
 uxa/uxa-accel.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
uxa/uxa-accel.c +12 -1
index 516834f..18fa63b 100644
@@ -27,7 +27,6 @@
  *    Michel Dänzer <[email protected]>
  *
  */
-
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
@@ -37,6 +36,10 @@
 #include "uxa.h"
 #include "mipict.h"
 
+#ifdef GLAMOR
+#include "glamor.h"
+#endif
+
 static void
 uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	       DDXPointPtr ppt, int *pwidth, int fSorted)
@@ -49,6 +52,10 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	int nbox;
 	int x1, x2, y;
 	int off_x, off_y;
+#ifdef GLAMOR
+	if (glamor_fill_spans_nf(pDrawable, pGC, n, ppt, pwidth, fSorted))
+		return;
+#endif
 
 	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
 		goto fallback;
@@ -673,6 +680,10 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 	int n;
 	RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
 
+#ifdef GLAMOR
+	if (glamor_poly_fill_rect_nf(pDrawable, pGC, nrect, prect))
+		return;
+#endif
 	/* Compute intersection of rects and clip region */
 	REGION_TRANSLATE(pScreen, pReg, pDrawable->x, pDrawable->y);
 	REGION_INTERSECT(pScreen, pReg, pClip, pReg);
Signature · 6 lines
1.7.4.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx