[PATCH] xwayland: Use drm buffers for cursors if available

Emil Velikov emil.l.velikov at gmail.com
Thu Feb 4 18:18:18 UTC 2016


On 4 February 2016 at 17:10, Rui Matos <tiagomatos at gmail.com> wrote:
> This should be both more efficient and avoid the file descriptor
> exhaustion issue that can happen with shm buffers if we're asked to
> realize more cursors than the file descriptor limit.
>
> Signed-off-by: Rui Matos <tiagomatos at gmail.com>
> ---
>
> On Sat, Dec 5, 2015 at 1:30 AM, Kristian Høgsberg <krh at bitplanet.net> wrote:
>> Nice work. I think it would be about the same amount of work to do
>> this for shm pixmaps instead of cursors. That way, an application that
>> creates a lot of small pixmaps on shm-Xwayland (non-glamor) will also
>> not crash the server either.
>
> I looked into doing this for a bit but it seemed very wasteful in
> terms of memory usage with this simple allocation algorithm. I fear
> the fragmentation after a little while would be pretty bad. At least
> with cursors only we know that they're sized all in the same order of
> magnitude but for pixmaps in general I think we'd need a smarter
> algorithm and a good handful of heuristics.
>
> So, I decided to instead work on adding support for wl_drm cursor
> buffers which nicely sidesteps all those issues. Unfortunately, with
> this patch and on intel hardware where the hw cursor size isn't 64x64,
> compositors have to fallback to "software" cursors, importing the
> buffer as an EGLImage since mesa has this size hardcoded in
>
> http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/i965/intel_screen.c#n621
>
> which prevents compositors from importing the gbm bo.
>
> Rui
>
>  hw/xwayland/xwayland-cursor.c | 156 ++++++++++++++++++++++++++++++++++++------
>  hw/xwayland/xwayland.c        |   6 +-
>  2 files changed, 138 insertions(+), 24 deletions(-)
>
> diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
> index 76729db..7f2aa9a 100644
> --- a/hw/xwayland/xwayland-cursor.c
> +++ b/hw/xwayland/xwayland-cursor.c
> @@ -28,7 +28,27 @@
>
>  #include <mipointer.h>
>
> +#ifdef GLAMOR_HAS_GBM
> +#define MESA_EGL_NO_X11_HEADERS
> +#include <drm/drm.h>
Please don't include the kernel UAPI header - it is not guaranteed to
be present. I.e. drop the drm/ prefix and, if needed, bump the libdrm
requirement in configure.ac and/or define any symbols.

Thanks
Emil


More information about the xorg-devel mailing list