uxa/glamor: Prefer to create a pure glamor pixmap.
PATCH 1/1 uxa/glamor: Prefer to create a pure glamor pixmap.
From: Zhigang Gong <[email protected]>
Prefer to create a pure glamor pixmap rather than a BO and then create a texture from that BO in glamor. As this will avoid some glFlush requirements, it can get about 20-30% performance gain.
When glamor is enabled, route the uxa_create_gc to glamor_create_gc.
This commit also removed the glFlush at the intel_glamor_finish_access. When glamor is enabled, a pixmap will not be accessed by the UXA's accelerated function. Only un-accelerated funtion may access those pixmap, and before each un-accelerated rendering, it calls uxa_prepare_access which will do glFlush there.
Removed deprecated function: intel_glamor_create_screen_image
--- src/intel_glamor.c | 14 -------------- src/intel_glamor.h | 2 -- src/intel_uxa.c | 6 ++++++ uxa/uxa-glamor.h | 1 + uxa/uxa.c | 6 ++++++ 5 files changed, 13 insertions(+), 16 deletions(-)
src/intel_glamor.c +0 -14
@@ -135,7 +135,6 @@ intel_glamor_finish_access(PixmapPtr pixmap, uxa_access_t access)break ;case UXA_GLAMOR_ACCESS_RW :intel_glamor_need_flush (&pixmap->drawable); -glamor_block_handler (pixmap->drawable.pScreen);break ;default :ErrorF ("Invalid access mode %d\n" , access);
@@ -192,19 +191,6 @@ intel_glamor_flush(intel_screen_private * intel) }Bool -intel_glamor_create_screen_image (ScreenPtr screen,int handle,int stride) -{ -ScrnInfoPtr scrn = xf86Screens[screen->myNum]; -intel_screen_private *intel; - - intel =intel_get_screen_private (scrn); -if ((intel->uxa_flags &UXA_USE_GLAMOR ) ==0 ) -return TRUE; - -return glamor_egl_create_textured_screen (screen, handle, stride); -} - -Bool intel_glamor_close_screen (ScreenPtr screen) {ScrnInfoPtr scrn = xf86Screens[screen->myNum];
src/intel_glamor.h +0 -2
@@ -35,7 +35,6 @@Bool intel_glamor_pre_init (ScrnInfoPtr scrn);Bool intel_glamor_init (ScreenPtr screen);Bool intel_glamor_create_screen_resources (ScreenPtr screen); -Bool intel_glamor_create_screen_image (ScreenPtr screen,int handle,int stride);Bool intel_glamor_close_screen (ScreenPtr screen);void intel_glamor_free_screen (int scrnIndex,int flags);
@@ -51,7 +50,6 @@ PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,static inline Bool intel_glamor_pre_init (ScrnInfoPtr scrn) {return TRUE; }static inline Bool intel_glamor_init (ScreenPtr screen) {return TRUE; }static inline Bool intel_glamor_create_screen_resources (ScreenPtr screen) {return TRUE; } -static inline Bool intel_glamor_create_screen_image (ScreenPtr screen,int handle,int stride) {return TRUE; }static inline Bool intel_glamor_close_screen (ScreenPtr screen) {return TRUE; }static inline void intel_glamor_free_screen (int scrnIndex,int flags) { }
src/intel_uxa.c +6 -0
@@ -1026,6 +1026,12 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,struct intel_pixmap *priv;PixmapPtr pixmap, new_pixmap =NULL ; +if (!(usage &INTEL_CREATE_PIXMAP_DRI2 )) { + pixmap =intel_glamor_create_pixmap (screen, w, h, depth, usage); +if (pixmap) +return pixmap; + } +if (w >32767 || h >32767 )return NullPixmap;
uxa/uxa-glamor.h +1 -0
@@ -51,6 +51,7 @@#define glamor_trapezoids_nf (...) FALSE#define glamor_triangles_nf (...) FALSE#define glamor_add_traps_nf (...) FALSE +#define glamor_create_gc (...) FALSE#endif #endif /* UXA_GLAMOR_H */
uxa/uxa.c +6 -0
@@ -38,6 +38,7 @@#include <X11/fonts/fontstruct.h> #include "dixfontstr.h" #include "uxa.h" +#include "uxa-glamor.h" #if HAS_DEVPRIVATEKEYREC DevPrivateKeyRec uxa_screen_index;
@@ -275,6 +276,11 @@ static GCFuncs uxaGCFuncs = {*/ static int uxa_create_gc (GCPtr pGC) { +uxa_screen_t *uxa_screen =uxa_get_screen (pGC->pScreen); + +if (uxa_screen->info->flags &UXA_USE_GLAMOR ) +return glamor_create_gc (pGC); +if (!fbCreateGC (pGC))return FALSE;
Signature · 1 line
1.7.4.4
Quoted 8 lines · On Fri, 23 Dec 2011 19:59:22 +0800, [email protected] wrote:
From: Zhigang Gong <[email protected]>
Prefer to create a pure glamor pixmap rather than a BO and then create a texture from that BO in glamor. As this will avoid some glFlush requirements, it can get about 20-30% performance gain.
When glamor is enabled, route the
uxa_create_gctoglamor_create_gc.
Quoted 7 lines
This commit also removed the glFlush at the
intel_glamor_finish_access. When glamor is enabled, a pixmap will not be accessed by the UXA's accelerated function. Only un-accelerated funtion may access those pixmap, and before each un-accelerated rendering, it callsuxa_prepare_accesswhich will do glFlush there.Removed deprecated function:
intel_glamor_create_screen_image
There are at least four functional changes here, each of which look like they could have unexpected side-effects. Can you break this patch down into create using glamor by default; create glamor gc; remove extraneous flush; remove dead code.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre