Re: [PATCH xserver 10/11] glamor: Delay making pixmaps shareable until we need to.

2015-11-09 Thread Michel Dänzer
On 07.11.2015 05:52, Eric Anholt wrote:
> If a pixmap isn't getting exported as a dmabuf, then we don't need to
> go the GBM route for it.  This should reduce normal pixmap allocation
> overhead, and also lets the driver choose non-scanout formats which
> may be much higher performance.
> 
> On Raspberry Pi, where scanout isn't usable as a texture source, this
> improves x11perf -copypixwin100 from about 4300/sec to 5780/sec under
> xcompmgr -a, because we no longer need to upload our x11perf window to
> a tiled temporary in order to render it to the screen.
> 
> Signed-off-by: Eric Anholt 

[...]

> +bo = gbm_bo_create(glamor_egl->gbm, width, height,
> +   GBM_FORMAT_ARGB,
> +#ifdef GLAMOR_HAS_GBM_LINEAR
> +   (pixmap_priv->usage_shared ? GBM_BO_USE_LINEAR : 0) |
> +#endif
> +   GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);

This can check pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED, no need
for adding the pixmap_priv->usage_shared field.

With that fixed, this patch is

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 10/11] glamor: Delay making pixmaps shareable until we need to.

2015-11-06 Thread Eric Anholt
If a pixmap isn't getting exported as a dmabuf, then we don't need to
go the GBM route for it.  This should reduce normal pixmap allocation
overhead, and also lets the driver choose non-scanout formats which
may be much higher performance.

On Raspberry Pi, where scanout isn't usable as a texture source, this
improves x11perf -copypixwin100 from about 4300/sec to 5780/sec under
xcompmgr -a, because we no longer need to upload our x11perf window to
a tiled temporary in order to render it to the screen.

Signed-off-by: Eric Anholt 
---
 glamor/glamor.c   |   2 +
 glamor/glamor.h   |   5 -
 glamor/glamor_egl.c   | 211 ++
 glamor/glamor_egl_stubs.c |   6 --
 glamor/glamor_fbo.c   |  35 +++
 glamor/glamor_priv.h  |   2 +
 hw/xwayland/xwayland-glamor.c |   6 --
 7 files changed, 109 insertions(+), 158 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index ec5f81b..663399c 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -168,6 +168,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int 
depth,
 
 pixmap_priv = glamor_get_pixmap_private(pixmap);
 
+pixmap_priv->usage_shared = (usage == CREATE_PIXMAP_USAGE_SHARED);
+
 format = gl_iformat_for_pixmap(pixmap);
 
 pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
diff --git a/glamor/glamor.h b/glamor/glamor.h
index 12dff8e..a4e0655 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -140,11 +140,6 @@ extern _X_EXPORT void 
glamor_pixmap_exchange_fbos(PixmapPtr front,
 
 /* The DDX is not supposed to call these three functions */
 extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen);
-extern _X_EXPORT unsigned int 
glamor_egl_create_argb_based_texture(ScreenPtr
-   screen,
-   int w,
-   int h,
-   Bool 
linear);
 extern _X_EXPORT int glamor_egl_dri3_fd_name_from_tex(ScreenPtr, PixmapPtr,
   unsigned int, Bool,
   CARD16 *, CARD32 *);
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index e68af18..8638063 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -187,49 +187,6 @@ glamor_egl_get_gbm_device(ScreenPtr screen)
 #endif
 }
 
-unsigned int
-glamor_egl_create_argb_based_texture(ScreenPtr screen, int w, int h, Bool 
linear)
-{
-ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-struct glamor_egl_screen_private *glamor_egl;
-EGLImageKHR image;
-GLuint texture;
-
-#ifdef GLAMOR_HAS_GBM
-struct gbm_bo *bo;
-EGLNativePixmapType native_pixmap;
-
-glamor_egl = glamor_egl_get_screen_private(scrn);
-bo = gbm_bo_create(glamor_egl->gbm, w, h, GBM_FORMAT_ARGB,
-#ifdef GLAMOR_HAS_GBM_LINEAR
-   (linear ? GBM_BO_USE_LINEAR : 0) |
-#endif
-   GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
-if (!bo)
-return 0;
-
-/* If the following assignment raises an error or a warning
- * then that means EGLNativePixmapType is not struct gbm_bo *
- * on your platform: This code won't work and you should not
- * compile with dri3 support enabled */
-native_pixmap = bo;
-
-image = eglCreateImageKHR(glamor_egl->display,
-  EGL_NO_CONTEXT,
-  EGL_NATIVE_PIXMAP_KHR,
-  native_pixmap, NULL);
-gbm_bo_destroy(bo);
-if (image == EGL_NO_IMAGE_KHR)
-return 0;
-glamor_create_texture_from_image(screen, image, );
-eglDestroyImageKHR(glamor_egl->display, image);
-
-return texture;
-#else
-return 0;   /* this path should never happen */
-#endif
-}
-
 Bool
 glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
 {
@@ -334,6 +291,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int 
handle, int stride)
 return ret;
 }
 
+#ifdef GLAMOR_HAS_GBM
 Bool
 glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
   struct gbm_bo *bo)
@@ -342,6 +300,8 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr 
pixmap,
 ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
 struct glamor_screen_private *glamor_priv =
 glamor_get_screen_private(screen);
+struct glamor_pixmap_private *pixmap_priv =
+glamor_get_pixmap_private(pixmap);
 struct glamor_egl_screen_private *glamor_egl;
 EGLImageKHR image;
 GLuint texture;
@@ -362,13 +322,15 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr 
pixmap,
 glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
 glamor_set_pixmap_texture(pixmap, texture);