[PATCH] configure: set X render animated cursors optional

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 31 20:50:36 PDT 2009


On Fri, Aug 28, 2009 at 05:22:57PM +0300, Tiago Vignatti wrote:
> Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
> ---

IMO, this is the wrong approach and I was a bit surprised to see this
after our latest IRC discussion.
There are two parts to animated cursors that affect you.
1. The rendering of a cursor takes time and effort.
2. Animated cursors schedule wakeups for the server every so-often.

Even if you disable 1, you still get the wakeups and the many calls to the
block handler. Once you stop those you should be done.
Now, last time you needed to disable the block handler when the cursor is
invisible. we found a way how to do that. has the problem scope changed
since?

> My only doubt is regarding the return type on ProcRenderCreateAnimCursor when
> the server does not support animated cursor. I put as BadImplementation.

Doing so means that the server intentionally has an incomplete/wrong
implementation of render. Not sure if that's a good idea.
This seems to be niche feature and I wonder if it wouldn't be better to
adjust the environment accordingly (i.e. no animated cursor themes).
 
Cheers,
  Peter

>  configure.ac            |    7 +++++++
>  include/dix-config.h.in |    3 +++
>  render/Makefile.am      |    6 +++++-
>  render/animcur.c        |    1 +
>  render/animcur.h        |   10 ++++++++++
>  render/picture.c        |    2 ++
>  render/picturestr.h     |    9 +++------
>  render/render.c         |    4 ++++
>  8 files changed, 35 insertions(+), 7 deletions(-)
>  create mode 100644 render/animcur.h
> 
> diff --git a/configure.ac b/configure.ac
> index c5c069d..6eb447a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -590,6 +590,8 @@ AC_ARG_ENABLE(xaa,               AS_HELP_STRING([--enable-xaa], [Build XAA (defa
>  AC_ARG_ENABLE(vgahw,          AS_HELP_STRING([--enable-vgahw], [Build Xorg with vga access (default: enabled)]), [VGAHW=$enableval], [VGAHW=yes])
>  AC_ARG_ENABLE(vbe,            AS_HELP_STRING([--enable-vbe], [Build Xorg with VBE module (default: enabled)]), [VBE=$enableval], [VBE=yes])
>  AC_ARG_ENABLE(int10-module,     AS_HELP_STRING([--enable-int10-module], [Build Xorg with int10 module (default: enabled)]), [INT10MODULE=$enableval], [INT10MODULE=yes])
> +AC_ARG_ENABLE(animcursor,     AS_HELP_STRING([--enable-animcursor], [Build Xorg with X render animated cursor support (default: enabled)]), [ANIMCURSOR=$enableval], [ANIMCURSOR=yes])
> +
>  
>  dnl DDXes.
>  AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
> @@ -1033,6 +1035,11 @@ AM_CONDITIONAL(XAA, test "x$XAA" = xyes)
>  AM_CONDITIONAL(VGAHW, test "x$VGAHW" = xyes)
>  AM_CONDITIONAL(VBE, test "x$VBE" = xyes)
>  AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
> +AM_CONDITIONAL(ANIMCURSOR, test "x$ANIMCURSOR" = xyes)
> +
> +if test "x$ANIMCURSOR" = xyes; then
> +    AC_DEFINE(ANIMCURSOR_SUPPORT, 1, [X Render animated cursor support available])
> +fi
>  
>  AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
>  
> diff --git a/include/dix-config.h.in b/include/dix-config.h.in
> index fcb582f..7d11021 100644
> --- a/include/dix-config.h.in
> +++ b/include/dix-config.h.in
> @@ -430,4 +430,7 @@
>  
>  #undef HAVE_AVC_NETLINK_ACQUIRE_FD
>  
> +/* X Render animated cursor support */
> +#undef ANIMCURSOR_SUPPORT
> +
>  #endif /* _DIX_CONFIG_H_ */
> diff --git a/render/Makefile.am b/render/Makefile.am
> index 216c613..a967fb7 100644
> --- a/render/Makefile.am
> +++ b/render/Makefile.am
> @@ -2,8 +2,12 @@ noinst_LTLIBRARIES = librender.la
>  
>  AM_CFLAGS = $(DIX_CFLAGS)
>  
> +if ANIMCURSOR
> +ANIMCURSOR_SRC = animcur.c
> +endif
> +
>  librender_la_SOURCES =	\
> -	animcur.c	\
> +	$(ANIMCURSOR_SRC)	\
>  	filter.c	\
>  	glyph.c		\
>  	matrix.c	\
> diff --git a/render/animcur.c b/render/animcur.c
> index 276e5e4..2a5fc55 100644
> --- a/render/animcur.c
> +++ b/render/animcur.c
> @@ -46,6 +46,7 @@
>  #include "picturestr.h"
>  #include "inputstr.h"
>  #include "xace.h"
> +#include "animcur.h"
>  
>  typedef struct _AnimCurElt {
>      CursorPtr	pCursor;    /* cursor to show */
> diff --git a/render/animcur.h b/render/animcur.h
> new file mode 100644
> index 0000000..c0842c1
> --- /dev/null
> +++ b/render/animcur.h
> @@ -0,0 +1,10 @@
> +#include "scrnintstr.h"
> +#include "glyphstr.h"
> +#include "resource.h"
> +#include "privates.h"
> +
> +Bool
> +AnimCurInit (ScreenPtr pScreen);
> +
> +int
> +AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid);
> diff --git a/render/picture.c b/render/picture.c
> index a367077..f071f26 100644
> --- a/render/picture.c
> +++ b/render/picture.c
> @@ -494,7 +494,9 @@ PictureFinishInit (void)
>      {
>  	if (!PictureInitIndexedFormats (screenInfo.screens[s]))
>  	    return FALSE;
> +#ifdef ANIMCURSOR_SUPPORT
>  	(void) AnimCurInit (screenInfo.screens[s]);
> +#endif
>      }
>  
>      return TRUE;
> diff --git a/render/picturestr.h b/render/picturestr.h
> index 6a8d76d..ee4928b 100644
> --- a/render/picturestr.h
> +++ b/render/picturestr.h
> @@ -28,6 +28,9 @@
>  #include "glyphstr.h"
>  #include "resource.h"
>  #include "privates.h"
> +#ifdef ANIMCURSOR_SUPPORT
> +#include "animcur.h"
> +#endif
>  
>  typedef struct _DirectFormat {
>      CARD16	    red, redMask;
> @@ -620,12 +623,6 @@ PictureGradientColor (PictGradientStopPtr stop1,
>  
>  extern _X_EXPORT void RenderExtensionInit (void);
>  
> -Bool
> -AnimCurInit (ScreenPtr pScreen);
> -
> -int
> -AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid);
> -
>  extern _X_EXPORT void
>  AddTraps (PicturePtr	pPicture,
>  	  INT16		xOff,
> diff --git a/render/render.c b/render/render.c
> index 995ebd9..0644fd9 100644
> --- a/render/render.c
> +++ b/render/render.c
> @@ -1869,8 +1869,12 @@ ProcRenderCreateAnimCursor (ClientPtr client)
>  	deltas[i] = elt->delay;
>  	elt++;
>      }
> +#ifdef ANIMCURSOR_SUPPORT
>      ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor, client,
>  			    stuff->cid);
> +#else
> +    ret = BadImplementation;
> +#endif
>      xfree (cursors);
>      if (ret != Success)
>  	return ret;
> -- 
> 1.5.6.3


More information about the xorg-devel mailing list