Skip to contentSkip to conversation

uxa/glamor: Route some drawing function to glamor.

PATCH In review [email protected] 2 participants 4 messages Dec 31, 2011 – Jan 4, 2012

lore
Share & tools
lore
#0 lore raw

cover uxa/glamor: Route some drawing function to glamor.

From: Zhigang Gong <[email protected]>

I agree to pending the last patch which is to create glamor pixmap by default. This patch is based on the other 3 patch. After apply this patch, and use the latest glamor. I spent too much time to fix those XTS regressions this week and haven't have a chance to add version information to it. Will do that after the vacation. The good news is that now uxa/glamor has no regression compare to UXA.

-

#1 lore raw

PATCH 1/1 uxa/glamor: Route some missing drawing function to glamor.

From: Zhigang Gong <[email protected]>

We have to route all the drawing function to glamor at first if glamor is enabled. The previous commit missed some function. Now add them in.

---
 uxa/uxa-accel.c  |  142 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 uxa/uxa-glamor.h |    8 +++
 2 files changed, 146 insertions(+), 4 deletions(-)
uxa/uxa-accel.c +138 -4
index 00948b7..d67c1a6 100644
@@ -558,6 +558,18 @@ uxa_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 {
 	int i;
 	xRectangle *prect;
+	uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		ok = glamor_poly_point_nf(pDrawable, pGC, mode, npt, ppt);
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+
+		if (ok)
+			return;
+	}
 
 	/* If we can't reuse the current GC as is, don't bother accelerating the
 	 * points.
@@ -596,6 +608,18 @@ uxa_poly_lines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	xRectangle *prect;
 	int x1, x2, y1, y2;
 	int i;
+	uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		ok = glamor_poly_lines_nf(pDrawable, pGC, mode, npt, ppt);
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+
+		if (ok)
+			return;
+	}
 
 	/* Don't try to do wide lines or non-solid fill style. */
 	if (pGC->lineWidth != 0 || pGC->lineStyle != LineSolid ||
@@ -657,6 +681,18 @@ uxa_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
 {
 	xRectangle *prect;
 	int i;
+	uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		ok = glamor_poly_segment_nf(pDrawable, pGC, nseg, pSeg);
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+
+		if (ok)
+			return;
+	}
 
 	/* Don't try to do wide lines or non-solid fill style. */
 	if (pGC->lineWidth != 0 || pGC->lineStyle != LineSolid ||
@@ -889,12 +925,110 @@ fallback:
 	uxa_check_set_spans(pDrawable, gc, src, points, widths, n, sorted);
 }
 
+static RegionPtr
+uxa_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+	       int srcx, int srcy, int w, int h, int dstx, int dsty,
+	       unsigned long bitPlane)
+{
+	ScreenPtr screen = pDst->pScreen;
+	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+		RegionPtr region;
+
+		uxa_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
+		uxa_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+		ok = glamor_copy_plane_nf(pSrc, pDst, pGC, srcx, srcy, w, h,
+					   dstx, dsty, bitPlane, &region);
+		uxa_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+		uxa_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
+		if (!ok)
+			goto fallback;
+		return region;
+	}
+
+fallback:
+	return uxa_check_copy_plane(pSrc, pDst, pGC, srcx, srcy, w, h,
+				    dstx, dsty, bitPlane);
+}
+
+static void
+uxa_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
+		    int x, int y, unsigned int nglyph,
+		    CharInfoPtr * ppci, pointer pglyphBase)
+{
+	ScreenPtr screen = pDrawable->pScreen;
+	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		ok = glamor_image_glyph_blt_nf(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		if (!ok)
+			goto fallback;
+		return;
+	}
+
+fallback:
+	uxa_check_image_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
+
+static void
+uxa_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
+		   int x, int y, unsigned int nglyph,
+		   CharInfoPtr * ppci, pointer pglyphBase)
+{
+	ScreenPtr screen = pDrawable->pScreen;
+	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		ok = glamor_poly_glyph_blt_nf(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+		uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		if (!ok)
+			goto fallback;
+		return;
+	}
+
+fallback:
+	uxa_check_poly_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+}
+
+static void
+uxa_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
+		DrawablePtr pDrawable, int w, int h, int x, int y)
+{
+	ScreenPtr screen = pDrawable->pScreen;
+	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+	if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+		int ok;
+
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		uxa_prepare_access(&pBitmap->drawable, UXA_GLAMOR_ACCESS_RO);
+		ok = glamor_push_pixels_nf(pGC, pBitmap, pDrawable, w, h, x, y);
+		uxa_finish_access(&pBitmap->drawable, UXA_GLAMOR_ACCESS_RO);
+		uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+		if (!ok)
+			goto fallback;
+		return;
+	}
+
+fallback:
+	uxa_check_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y);
+}
+
 const GCOps uxa_ops = {
 	uxa_fill_spans,
 	uxa_set_spans,
 	uxa_put_image,
 	uxa_copy_area,
-	uxa_check_copy_plane,
+	uxa_copy_plane,
 	uxa_poly_point,
 	uxa_poly_lines,
 	uxa_poly_segment,
@@ -907,9 +1041,9 @@ const GCOps uxa_ops = {
 	miPolyText16,
 	miImageText8,
 	miImageText16,
-	uxa_check_image_glyph_blt,
-	uxa_check_poly_glyph_blt,
-	uxa_check_push_pixels,
+	uxa_image_glyph_blt,
+	uxa_poly_glyph_blt,
+	uxa_push_pixels,
 };
 
 void uxa_copy_window(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
uxa/uxa-glamor.h +8 -0
index 2b4b452..8f90d9a 100644
@@ -52,6 +52,14 @@
 #define glamor_triangles_nf(...)	FALSE
 #define glamor_add_traps_nf(...)	FALSE
 #define glamor_create_gc(...)		FALSE
+#define glamor_poly_point_nf(...)	FALSE
+#define glamor_poly_segment_nf(...)	FALSE
+#define glamor_poly_lines_nf(...)	FALSE
+#define glamor_push_pixels_nf(...)	FALSE
+#define glamor_copy_plane_nf(...)	FALSE
+#define glamor_image_glyph_blt_nf(...)	FALSE
+#define glamor_poly_glyph_blt_nf(...)	FALSE
+#define glamor_validate_gc(...)		;
 #endif
 
 #endif /* UXA_GLAMOR_H */
Signature · 1 line
1.7.4.4
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Sat, 31 Dec 2011 21:18:14 +0800, [email protected] wrote:

From: Zhigang Gong <[email protected]>

I agree to pending the last patch which is to create glamor pixmap by default. This patch is based on the other 3 patch. After apply this patch, and use the latest glamor.

I've pushed those 4 patches (all bar to use intel_glamor_create_textured_pixmap by default). I've a new segfault for you in glamor_core.c::glamor_validate_gc(), line 425 as pixmap_priv is NULL, which I only hit just as I thought I had completed testing the code.

Afaics, the remaining big topics for the ddx are how to enable glx and integration between glamor/uxa render paths, right?
-Chris

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

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Wednesday, January 04, 2012 5:47 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 0/1] uxa/glamor: Route some drawing function to glamor.

Quoted 3 lines · On Sat, 31 Dec 2011 21:18:14 +0800, [email protected] wrote:

From: Zhigang Gong <[email protected]>

I agree to pending the last patch which is to create glamor pixmap by

default.

Quoted 2 lines

This patch is based on the other 3 patch. After apply this patch, and use the latest glamor.

Quoted 7 lines

I've pushed those 4 patches (all bar to use intel_glamor_create_textured_pixmap by default). I've a new segfault for you in glamor_core.c::glamor_validate_gc(), line 425 as pixmap_priv is NULL, which I only hit just as I thought I had completed testing the code.

Afaics, the remaining big topics for the ddx are how to enable glx and integration between glamor/uxa render paths, right?

Exactly.
That's the hardest part now. There are two DRI loaders, one is AIGLX and the other is EGL. Both loader have their own glapi.c. Currently, the AIGLX always
get loaded before the DDX driver, and thus the glapi in glx will be used.

One possible solution is as below, please help to review and comment:

let the glamor egl module get loaded prior to the AIGLX And load the proper libGL.so
thus the egl will create a complete and correct context. And then latter, we can call
_glapi_create_table_from_handle to initialize the glx's dispatch structure. We can treat the context created by egl for glamor is the context dedicated for server
client, and each time when call into glamor's rendering path, force current to glamor's
context and restore to previous context at returning.

Copy to KRH, I know you are the master of DRI2/AIGLX. Any suggestion here? Thanks.

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre