Skip to contentSkip to conversation

Introduce Glamor to UXA framework.

PATCH In review Zhigang Gong 2 participants 9 messages Nov 16, 2011 – Nov 17, 2011

lore
Share & tools
lore
#0 lore raw

cover Introduce Glamor to UXA framework.

After discussion with Chris yesterday, I reworked the previous glamor branch and concentrate the patchset to two patches. The first patch is the same as the previous. The second patch merges all the others into one, and made some slightly change. One major change is that I decide to extent the finish_access to handle the flushing operations by check the access type. And also add some missed glamor flushing operations.

This patchset initially enable glamor with UXA. And two functions ,fill_spans and poly_fill_rects, go to the glamor path. I tested it with render check, and it works fine.

One of the remaining issues is the vsync'ed copy. I discussed with Chris, and already got a solution. Will do that when I enable the copy_area to glamor path.

#1 lore raw

PATCH 1/2 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 831f6b3..d990702 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
#2 lore raw

PATCH 2/2 glamor: Turn on glamor with a few glamor functions enabled.

In reply to Zhigang Gong

Integrate glamor acceleration into UXA framework. Add necessary flushing at the following points:

1. Flush UXA batch buffer before call into glamor.
2. Flush GL operations after return from a glamor function.
3. The point we need to flush UXA batch buffer, we also need to flush GL operations, for example, in intel_flush_callback and couple of places in intel_display.c.

This commit only enables two glamor functions for fill_spans and poly_fill_rects. Will continue to enable the reset glamor functions soon.

---
 src/Makefile.am     |    6 +--
 src/intel.h         |    1 +
 src/intel_display.c |    5 ++
 src/intel_driver.c  |   17 +++++++-
 src/intel_glamor.c  |  111 ++++++++++++++++++++++++++++++++++++++++++++++-----
 src/intel_glamor.h  |    2 +-
 src/intel_uxa.c     |   22 +++++++++-
 uxa/uxa-accel.c     |   38 +++++++++++++++--
 uxa/uxa-priv.h      |    4 +-
 uxa/uxa-render.c    |   16 ++++----
 uxa/uxa-unaccel.c   |   58 +++++++++++++-------------
 uxa/uxa.c           |   18 ++++----
 uxa/uxa.h           |   13 +++++-
 13 files changed, 236 insertions(+), 75 deletions(-)
src/Makefile.am +1 -5
index 1a29390..12ff6ee 100644
@@ -40,10 +40,6 @@ SUBDIRS += sna
 intel_drv_la_LIBADD += sna/libsna.la
 endif
 
-if GLAMOR
-GLAMOR_SOURCE = intel_glamor.c
-endif
-
 NULL:=#
 
 intel_drv_la_SOURCES = \
@@ -74,7 +70,7 @@ intel_drv_la_SOURCES = \
 	 i965_3d.c \
 	 i965_video.c \
 	 i965_render.c \
-	 $(GLAMOR_SOURCE) \
+	 intel_glamor.c \
 	 $(NULL)
 
 if DRI
src/intel.h +1 -0
index 3b3f87d..b24aa02 100644
@@ -318,6 +318,7 @@ typedef struct intel_screen_private {
 	void (*batch_commit_notify) (struct intel_screen_private *intel);
 
 	uxa_driver_t *uxa_driver;
+	int uxa_flags;
 	Bool need_sync;
 	int accel_pixmap_offset_alignment;
 	int accel_max_x;
src/intel_display.c +5 -0
index 84c7c08..f6ffa30 100644
@@ -43,6 +43,8 @@
 #include "xf86drmMode.h"
 #include "X11/Xatom.h"
 
+#include "intel_glamor.h"
+
 struct intel_mode {
 	int fd;
 	uint32_t fb_id;
@@ -451,6 +453,7 @@ intel_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	crtc->y = y;
 	crtc->rotation = rotation;
 
+	intel_glamor_flush(intel);
 	intel_batch_submit(crtc->scrn);
 
 	mode_to_kmode(crtc->scrn, &intel_crtc->kmode, mode);
@@ -1368,6 +1371,7 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
 
+	intel_glamor_flush(intel);
 	intel_batch_submit(scrn);
 
 	old_width = scrn->virtualX;
@@ -1457,6 +1461,7 @@ intel_do_pageflip(intel_screen_private *intel,
 			 new_front->handle, &mode->fb_id))
 		goto error_out;
 
+	intel_glamor_flush(intel);
 	intel_batch_submit(scrn);
 
 	/*
src/intel_driver.c +16 -1
index 24696da..ddeb40f 100644
@@ -75,6 +75,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "i915_drm.h"
 #include <xf86drmMode.h>
 
+#include "intel_glamor.h"
+
 /* *INDENT-OFF* */
 /*
  * Note: "ColorKey" is provided for compatibility with the i810 driver.
@@ -712,6 +714,13 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 		return FALSE;
 	}
 
+	if (!intel_glamor_pre_init(scrn)) {
+		PreInitCleanup(scrn);
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			"Failed to pre init glamor display.\n");
+		return FALSE;
+	}
+
 	/* Load the dri2 module if requested. */
 	if (intel->directRenderingType != DRI_DISABLED)
 		xf86LoadSubModule(scrn, "dri2");
@@ -813,8 +822,10 @@ intel_flush_callback(CallbackListPtr *list,
 		     pointer user_data, pointer call_data)
 {
 	ScrnInfoPtr scrn = user_data;
-	if (scrn->vtSema)
+	if (scrn->vtSema) {
 		intel_batch_submit(scrn);
+		intel_glamor_flush(intel_get_screen_private(scrn));
+	}
 }
 
 #if HAVE_UDEV
@@ -1110,6 +1121,8 @@ static void I830FreeScreen(int scrnIndex, int flags)
 	ScrnInfoPtr scrn = xf86Screens[scrnIndex];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
+	intel_glamor_free_screen(scrnIndex, flags);
+
 	if (intel) {
 		intel_mode_fini(intel);
 		intel_close_drm_master(intel);
@@ -1189,6 +1202,8 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
 
 	DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
 
+	intel_glamor_close_screen(screen);
+
 	if (intel->uxa_driver) {
 		uxa_driver_fini(screen);
 		free(intel->uxa_driver);
src/intel_glamor.c +100 -11

174 lines not on this page · raw message

src/intel_glamor.h +1 -1
index d7c2c86..3c06be0 100644
@@ -38,7 +38,7 @@ Bool intel_glamor_close_screen(ScreenPtr screen);
 
 void intel_glamor_free_screen(int scrnIndex, int flags);
 
-void intel_glamor_block_handler(intel_screen_private * intel);
+void intel_glamor_flush(intel_screen_private * intel);
 
 Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap);
 
src/intel_uxa.c +20 -2
index 8c6f754..8ec4133 100644
@@ -40,6 +40,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <string.h>
 #include <errno.h>
 
+#include "intel_glamor.h"
+
 static const int I830CopyROP[16] = {
 	ROP_0,			/* GXclear */
 	ROP_DSa,		/* GXand */
@@ -703,9 +705,15 @@ static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
 	int ret;
 
 	if (!list_is_empty(&priv->batch) &&
-	    (access == UXA_ACCESS_RW || priv->batch_write))
+	    ((access == UXA_ACCESS_RW || access == UXA_GLAMOR_ACCESS_RW)
+	     || priv->batch_write))
 		intel_batch_submit(scrn);
 
+	if (access == UXA_GLAMOR_ACCESS_RW || access == UXA_GLAMOR_ACCESS_RO)
+		return TRUE;
+
+	intel_glamor_flush(intel);
+
 	if (priv->tiling || bo->size <= intel->max_gtt_map_size)
 		ret = drm_intel_gem_bo_map_gtt(bo);
 	else
@@ -964,6 +972,7 @@ void intel_uxa_block_handler(intel_screen_private *intel)
 	 * and beyond rendering results may not hit the
 	 * framebuffer until significantly later.
 	 */
+	intel_glamor_flush(intel);
 	intel_flush_rendering(intel);
 }
 
@@ -1095,6 +1104,8 @@ 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);
+
+		intel_glamor_create_textured_pixmap(pixmap);
 	}
 
 	return pixmap;
@@ -1102,8 +1113,10 @@ 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) {
+		intel_glamor_destroy_pixmap(pixmap);
 		intel_set_pixmap_bo(pixmap, NULL);
+	}
 	fbDestroyPixmap(pixmap);
 	return TRUE;
 }
@@ -1134,6 +1147,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 +1312,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;
 }
uxa/uxa-accel.c +33 -5
index 516834f..c56fd81 100644
@@ -27,7 +27,6 @@
  *    Michel Dänzer <[email protected]>
  *
  */
-
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
@@ -37,6 +36,13 @@
 #include "uxa.h"
 #include "mipict.h"
 
+#ifdef GLAMOR
+#include "glamor.h"
+#else
+#define glamor_fill_spans_nf(...)  FALSE
+#define glamor_poly_fill_rect_nf(...) FALSE
+#endif
+
 static void
 uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	       DDXPointPtr ppt, int *pwidth, int fSorted)
@@ -50,6 +56,17 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
 	int x1, x2, y;
 	int off_x, off_y;
 
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		if (glamor_fill_spans_nf(pDrawable,
+					 pGC, n, ppt, pwidth, fSorted)) {
+			uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+			return;
+		}
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RO);
+		goto fallback;
+	}
+
 	if (uxa_screen->swappedOut || uxa_screen->force_fallback)
 		goto fallback;
 
@@ -187,7 +204,7 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
 				  (x1 + dstXoff) * dstBpp, (x2 - x1) * dstBpp,
 				  y2 - y1, GXcopy, FB_ALLONES, dstBpp);
 
-			uxa_finish_access(pDrawable);
+			uxa_finish_access(pDrawable, UXA_ACCESS_RW);
 		}
 	}
 
@@ -481,9 +498,9 @@ fallback:
 				   dx, dy, reverse, upsidedown, bitplane,
 				   closure);
 			if (pSrcDrawable != pDstDrawable)
-				uxa_finish_access(pSrcDrawable);
+				uxa_finish_access(pSrcDrawable, UXA_ACCESS_RO);
 		}
-		uxa_finish_access(pDstDrawable);
+		uxa_finish_access(pDstDrawable, UXA_ACCESS_RW);
 	}
 }
 
@@ -673,6 +690,17 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
 	int n;
 	RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
 
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		if (glamor_poly_fill_rect_nf(pDrawable,
+					     pGC, nrect, prect)) {
+			uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+			return;
+		}
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RO);
+		goto fallback;
+	}
+
 	/* Compute intersection of rects and clip region */
 	REGION_TRANSLATE(pScreen, pReg, pDrawable->x, pDrawable->y);
 	REGION_INTERSECT(pScreen, pReg, pClip, pReg);
@@ -1013,7 +1041,7 @@ fallback:
 
 	if (uxa_prepare_access(pDrawable, UXA_ACCESS_RO)) {
 		fbGetImage(pDrawable, x, y, w, h, format, planeMask, d);
-		uxa_finish_access(pDrawable);
+		uxa_finish_access(pDrawable, UXA_ACCESS_RO);
 	}
 
 	return;
uxa/uxa-priv.h +2 -2
index 6b9a9c1..a455f25 100644
@@ -325,10 +325,10 @@ uxa_check_composite(CARD8 op,
 
 /* uxa.c */
 Bool uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access);
-void uxa_finish_access(DrawablePtr pDrawable);
+void uxa_finish_access(DrawablePtr pDrawable, uxa_access_t access);
 
 Bool uxa_picture_prepare_access(PicturePtr picture, int mode);
-void uxa_picture_finish_access(PicturePtr picture);
+void uxa_picture_finish_access(PicturePtr picture, int mode);
 
 void
 uxa_get_drawable_deltas(DrawablePtr pDrawable, PixmapPtr pPixmap,
uxa/uxa-render.c +8 -8
index 34257c6..51c12f1 100644
@@ -571,7 +571,7 @@ uxa_picture_from_pixman_image(ScreenPtr screen,
 		if (uxa_picture_prepare_access(picture, UXA_ACCESS_RW)) {
 			fbComposite(PictOpSrc, src, NULL, picture,
 				    0, 0, 0, 0, 0, 0, width, height);
-			uxa_picture_finish_access(picture);
+			uxa_picture_finish_access(picture, UXA_ACCESS_RW);
 		}
 
 		FreePicture(src, 0);
@@ -599,7 +599,7 @@ uxa_create_solid(ScreenPtr screen, uint32_t color)
 		return 0;
 	}
 	*((uint32_t *)pixmap->devPrivate.ptr) = color;
-	uxa_finish_access((DrawablePtr)pixmap);
+	uxa_finish_access((DrawablePtr)pixmap, UXA_ACCESS_RW);
 
 	picture = CreatePicture(0, &pixmap->drawable,
 				PictureMatchFormat(screen, 32, PICT_a8r8g8b8),
@@ -702,7 +702,7 @@ uxa_acquire_pattern(ScreenPtr pScreen,
 	if (uxa_picture_prepare_access(pDst, UXA_ACCESS_RW)) {
 		fbComposite(PictOpSrc, pSrc, NULL, pDst,
 			    x, y, 0, 0, 0, 0, width, height);
-		uxa_picture_finish_access(pDst);
+		uxa_picture_finish_access(pDst, UXA_ACCESS_RW);
 		return pDst;
 	} else {
 		FreePicture(pDst, 0);
@@ -761,9 +761,9 @@ uxa_render_picture(ScreenPtr screen,
 			ret = 1;
 			fbComposite(PictOpSrc, src, NULL, picture,
 				    x, y, 0, 0, 0, 0, width, height);
-			uxa_picture_finish_access(src);
+			uxa_picture_finish_access(src, UXA_ACCESS_RO);
 		}
-		uxa_picture_finish_access(picture);
+		uxa_picture_finish_access(picture, UXA_ACCESS_RW);
 	}
 
 	if (!ret) {
@@ -1902,7 +1902,7 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
 
 			for (; ntrap; ntrap--, traps++)
 				(*ps->RasterizeTrapezoid) (dst, traps, 0, 0);
-			uxa_finish_access(pDraw);
+			uxa_finish_access(pDraw, UXA_ACCESS_RW);
 		}
 	} else if (maskFormat) {
 		PixmapPtr scratch = NULL;
@@ -2013,7 +2013,7 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 		DrawablePtr pDraw = pDst->pDrawable;
 		if (uxa_prepare_access(pDraw, UXA_ACCESS_RW)) {
 			(*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
-			uxa_finish_access(pDraw);
+			uxa_finish_access(pDraw, UXA_ACCESS_RW);
 		}
 	} else if (maskFormat) {
 		PicturePtr pPicture;
@@ -2049,7 +2049,7 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 		if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) {
 			(*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1,
 					     ntri, tris);
-			uxa_finish_access(pPicture->pDrawable);
+			uxa_finish_access(pPicture->pDrawable, UXA_ACCESS_RW);
 		}
 
 		xRel = bounds.x1 + xSrc - xDst;
uxa/uxa-unaccel.c +29 -29

195 lines not on this page · raw message

uxa/uxa.c +9 -9
index 856a0ce..5a3c0be 100644
@@ -160,7 +160,7 @@ Bool uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access)
  *
  * It deals with calling the driver's finish_access() only if necessary.
  */
-void uxa_finish_access(DrawablePtr pDrawable)
+void uxa_finish_access(DrawablePtr pDrawable, uxa_access_t access)
 {
 	ScreenPtr pScreen = pDrawable->pScreen;
 	uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
@@ -173,7 +173,7 @@ void uxa_finish_access(DrawablePtr pDrawable)
 	if (!uxa_pixmap_is_offscreen(pPixmap))
 		return;
 
-	(*uxa_screen->info->finish_access) (pPixmap);
+	(*uxa_screen->info->finish_access) (pPixmap, access);
 }
 
 /**
@@ -217,7 +217,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 					    fb24_32ReformatTile(pOldTile,
 								pDrawable->
 								bitsPerPixel);
-					uxa_finish_access(&pOldTile->drawable);
+					uxa_finish_access(&pOldTile->drawable, UXA_ACCESS_RO);
 				}
 			}
 			if (pNewTile) {
@@ -235,7 +235,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 			if (uxa_prepare_access
 			    (&pGC->tile.pixmap->drawable, UXA_ACCESS_RW)) {
 				fbPadPixmap(pGC->tile.pixmap);
-				uxa_finish_access(&pGC->tile.pixmap->drawable);
+				uxa_finish_access(&pGC->tile.pixmap->drawable, UXA_ACCESS_RW);
 			}
 		}
 		/* Mask out the GCTile change notification, now that we've
@@ -250,7 +250,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 		 */
 		if (uxa_prepare_access(&pGC->stipple->drawable, UXA_ACCESS_RW)) {
 			fbValidateGC(pGC, changes, pDrawable);
-			uxa_finish_access(&pGC->stipple->drawable);
+			uxa_finish_access(&pGC->stipple->drawable, UXA_ACCESS_RW);
 		}
 	} else {
 		fbValidateGC(pGC, changes, pDrawable);
@@ -296,7 +296,7 @@ Bool uxa_prepare_access_window(WindowPtr pWin)
 		    (&pWin->border.pixmap->drawable, UXA_ACCESS_RO)) {
 			if (pWin->backgroundState == BackgroundPixmap)
 				uxa_finish_access(&pWin->background.pixmap->
-						  drawable);
+						  drawable, UXA_ACCESS_RO);
 			return FALSE;
 		}
 	}
@@ -306,10 +306,10 @@ Bool uxa_prepare_access_window(WindowPtr pWin)
 void uxa_finish_access_window(WindowPtr pWin)
 {
 	if (pWin->backgroundState == BackgroundPixmap)
-		uxa_finish_access(&pWin->background.pixmap->drawable);
+		uxa_finish_access(&pWin->background.pixmap->drawable, UXA_ACCESS_RO);
 
 	if (pWin->borderIsPixel == FALSE)
-		uxa_finish_access(&pWin->border.pixmap->drawable);
+		uxa_finish_access(&pWin->border.pixmap->drawable, UXA_ACCESS_RO);
 }
 
 static Bool uxa_change_window_attributes(WindowPtr pWin, unsigned long mask)
@@ -329,7 +329,7 @@ static RegionPtr uxa_bitmap_to_region(PixmapPtr pPix)
 	if (!uxa_prepare_access(&pPix->drawable, UXA_ACCESS_RO))
 		return NULL;
 	ret = fbPixmapToRegion(pPix);
-	uxa_finish_access(&pPix->drawable);
+	uxa_finish_access(&pPix->drawable, UXA_ACCESS_RO);
 	return ret;
 }
 
uxa/uxa.h +11 -2
index e001c53..66b5f1e 100644
@@ -45,7 +45,9 @@
 
 typedef enum {
 	UXA_ACCESS_RO,
-	UXA_ACCESS_RW
+	UXA_ACCESS_RW,
+	UXA_GLAMOR_ACCESS_RO,
+	UXA_GLAMOR_ACCESS_RW
 } uxa_access_t;
 
 /**
@@ -513,7 +515,7 @@ typedef struct _UxaDriver {
 	 * offscreen pixmap set up by prepare_access().  Note that the
 	 * finish_access() will not be called if prepare_access() failed.
 	 */
-	void (*finish_access) (PixmapPtr pPix);
+	void (*finish_access) (PixmapPtr pPix, uxa_access_t access);
 
 	/**
 	 * PixmapIsOffscreen() is an optional driver replacement to
@@ -543,6 +545,13 @@ typedef struct _UxaDriver {
  */
 #define UXA_TWO_BITBLT_DIRECTIONS	(1 << 2)
 
+/**
+ * UXA_USE_GLAMOR indicates to use glamor acceleration to perform rendering.
+ * And if glamor fail to accelerate the rendering, then goto fallback to
+ * use CPU to do the rendering.
+ */
+#define UXA_USE_GLAMOR			(1 << 3)
+
 /** @} */
 
 /** @name UXA CreatePixmap hint flags
Signature · 6 lines
1.7.4.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Zhigang Gong
Quoted 3 lines · Zhigang Gong

This patchset initially enable glamor with UXA. And two functions ,fill_spans and poly_fill_rects, go to the glamor path. I tested it with render check, and it works fine.

I split your patches slightly differently and pushed them. I could only verify that it didn't impact UXA without the glamor_egl module available. Do you have a patch for testing?
-Chrid

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw
Quoted 7 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, November 17, 2011 9:14 AM
To: Zhigang Gong; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 0/2] Introduce Glamor to UXA framework.

Quoted 7 lines
Quoted 3 lines · Zhigang Gong

This patchset initially enable glamor with UXA. And two functions ,fill_spans and poly_fill_rects, go to the glamor path. I tested it with render check, and it works fine.

I split your patches slightly differently and pushed them.

I just checked out the master branch, and have a simple test, everything seems
ok. Thanks.

Quoted 3 lines

I could only verify
that it didn't impact UXA without the glamor_egl module available. Do you have a patch for testing?

Now glamor was extracted from the xorg and be a separate library. Please checkout glamor at : git://people.freedesktop.org/~gongzg/glamor.
This library implements two modules glamor and glamor_egl which are required for intel video driver to enable glamor.

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#5 lore raw
Quoted 4 lines · Zhigang Gong

Now glamor was extracted from the xorg and be a separate library. Please checkout glamor at : git://people.freedesktop.org/~gongzg/glamor.
This library implements two modules glamor and glamor_egl which are required for intel video driver to enable glamor.

Hmm, I did install the glamor library. A /usr/lib/xorg/modules/libglamor.so is installed but the ddx is looking for a "glamor_egl" module.

Ah, looks to be due to the
checking for EGL... no
checking for EGL... yes
in glamor. How very confusing. ;-)
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#6 lore raw
Quoted 8 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, November 17, 2011 5:20 PM
To: Zhigang Gong; [email protected]
Subject: RE: [PATCH 0/2] Introduce Glamor to UXA framework.

On Thu, 17 Nov 2011 10:55:39 +0800, "Zhigang Gong" <[email protected]> wrote:

Quoted 7 lines
Quoted 2 lines

Now glamor was extracted from the xorg and be a separate library. Please checkout glamor at :

git://people.freedesktop.org/~gongzg/glamor.

Quoted 2 lines

This library implements two modules glamor and glamor_egl which are required for intel video driver to enable glamor.

Hmm, I did install the glamor library. A

/usr/lib/xorg/modules/libglamor.so

Quoted 6 lines

is installed but the ddx is looking for a "glamor_egl" module.

Ah, looks to be due to the
checking for EGL... no
checking for EGL... yes
in glamor. How very confusing. ;-)

I think I know the reason, there is a typo error in glamor's configure.ac which doesn't
Check the required packages correctly. Please pull the latest glamor master. One of the
two above checks should be checking for GBM. I guess your mesa hasn't been built with
gbm enabled. Then glamor will not build glamor_egl which depends on that.

Another thing need to pay attention is that when you build xserver, you need to disable
glx.

Sorry for the confusing.

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#7 lore raw
Quoted 22 lines · Zhigang Gong
Quoted 8 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, November 17, 2011 5:20 PM
To: Zhigang Gong; [email protected]
Subject: RE: [PATCH 0/2] Introduce Glamor to UXA framework.

On Thu, 17 Nov 2011 10:55:39 +0800, "Zhigang Gong" <[email protected]> wrote:

Quoted 7 lines
Quoted 2 lines

Now glamor was extracted from the xorg and be a separate library. Please checkout glamor at :

git://people.freedesktop.org/~gongzg/glamor.

Quoted 2 lines

This library implements two modules glamor and glamor_egl which are required for intel video driver to enable glamor.

Hmm, I did install the glamor library. A

/usr/lib/xorg/modules/libglamor.so

Quoted 6 lines

is installed but the ddx is looking for a "glamor_egl" module.

Ah, looks to be due to the
checking for EGL... no
checking for EGL... yes
in glamor. How very confusing. ;-)

Quoted 7 lines

I think I know the reason, there is a typo error in glamor's configure.ac which doesn't
Check the required packages correctly. Please pull the latest glamor master. One of the
two above checks should be checking for GBM. I guess your mesa hasn't been built with
gbm enabled. Then glamor will not build glamor_egl which depends on that.

It was actually mesa insisting on only building egl_platform=drm and the pre-requisite egl_dri2 if and only if libxcb-dri2 was installed. Seems a bit strange for something that is supposed to be used on an X-less system.

Quoted 3 lines

Another thing need to pay attention is that when you build xserver, you need to disable
glx.

Rebuild the xserver... Oh well, that rules out testing by simply replacing distro drivers. I'm having a lot of fun with building glamor as it is missing or including headers in the wrong order and deciding that XID is 8 bytes when the server was compiled with a 4 byte XID. Fun. And the usual problems with incomplete framebuffers, but hopefully that is just the glx confusion.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#8 lore raw
Quoted 40 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, November 17, 2011 6:57 PM
To: Zhigang Gong; [email protected]
Subject: RE: [PATCH 0/2] Introduce Glamor to UXA framework.

Quoted 22 lines · Zhigang Gong
Quoted 8 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, November 17, 2011 5:20 PM
To: Zhigang Gong; [email protected]
Subject: RE: [PATCH 0/2] Introduce Glamor to UXA framework.

On Thu, 17 Nov 2011 10:55:39 +0800, "Zhigang Gong" <[email protected]> wrote:

Quoted 7 lines
Quoted 2 lines

Now glamor was extracted from the xorg and be a separate library. Please checkout glamor at :

git://people.freedesktop.org/~gongzg/glamor.

Quoted 2 lines

This library implements two modules glamor and glamor_egl which are required for intel video driver to enable glamor.

Hmm, I did install the glamor library. A

/usr/lib/xorg/modules/libglamor.so

Quoted 6 lines

is installed but the ddx is looking for a "glamor_egl" module.

Ah, looks to be due to the
checking for EGL... no
checking for EGL... yes
in glamor. How very confusing. ;-)

Quoted 7 lines

I think I know the reason, there is a typo error in glamor's configure.ac which doesn't Check the required packages correctly. Please pull the latest glamor master.
One of the
two above checks should be checking for GBM. I guess your mesa hasn't been built with gbm enabled. Then glamor will not build glamor_egl which depends on that.

Quoted 2 lines

It was actually mesa insisting on only building egl_platform=drm and the pre-requisite egl_dri2 if and only if libxcb-dri2 was installed. Seems a

bit

Quoted 7 lines

strange for something that is supposed to be used on an X-less system.

Quoted 2 lines

Another thing need to pay attention is that when you build xserver, you need to disable glx.

Rebuild the xserver... Oh well, that rules out testing by simply replacing distro drivers.

One of the todo items is to fully support glx including direct and indirect .
The major problem is that Xserver's glx code has the same glapi symbols which conflicts with standard mesa's glapi's implementations. It's easy to rename the xserver side glapi's symbol to other names to avoid this conflicts,
but that will break indirect GLX in xserver side. I still don't have a perfect
solution to solve this problem. Do you or anyone in this list have any suggestion
to solve this confliction?

Quoted 3 lines

I'm having a lot of fun with building glamor as it is missing or including headers in the wrong order and deciding that XID is 8 bytes when the server was compiled with a 4 byte XID. Fun.

Will discuss these problem with you through IRC.

Quoted 2 lines

And the
usual problems with incomplete framebuffers, but hopefully that is just

the

Quoted 1 line

glx confusion.

That must be caused by glapi symbol confliction.

Thanks.

- Zhigang

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre