Modified configure.in to allow building with Xrender. Fixed all problems that prevented compilation.
authorSunny Sachanandani <sunnysachanandani@gmail.com>
Mon, 31 May 2010 13:27:27 +0530
changeset 457787a2d87786d4
parent 4576 2b98162b536a
child 4578 cb338fa6535c
Modified configure.in to allow building with Xrender. Fixed all problems that prevented compilation.
Builds fine now :)
configure.in
include/SDL_config.h.in
src/video/x11/SDL_x11render.c
     1.1 --- a/configure.in	Sun May 30 20:06:30 2010 +0530
     1.2 +++ b/configure.in	Mon May 31 13:27:27 2010 +0530
     1.3 @@ -1128,16 +1128,13 @@
     1.4                                  ])
     1.5                  if test x$have_xrandr_h_hdr = xyes; then
     1.6                      if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
     1.7 -                        echo "-- dynamic libXrender -> $xrender_lib"
     1.8                          echo "-- dynamic libXrandr -> $xrandr_lib"
     1.9 -                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
    1.10                          AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
    1.11                          definitely_enable_video_x11_xrandr=yes
    1.12                      else
    1.13 -                        AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
    1.14                          AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
    1.15 -                        if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
    1.16 -                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
    1.17 +                        if test x$have_xrandr_lib = xyes ; then
    1.18 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
    1.19                              definitely_enable_video_x11_xrandr=yes
    1.20                          fi
    1.21                      fi
    1.22 @@ -1199,6 +1196,32 @@
    1.23              if test x$definitely_enable_video_x11_scrnsaver = xyes; then
    1.24                  AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
    1.25              fi
    1.26 +            AC_ARG_ENABLE(video-x11-xrender,
    1.27 +AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
    1.28 +                            , enable_video_x11_xrender=yes)
    1.29 +            if test x$enable_video_x11_xrender = xyes; then
    1.30 +                AC_CHECK_HEADER(X11/extensions/Xrender.h,
    1.31 +                                have_xrender_h_hdr=yes,
    1.32 +                                have_xrender_h_hdr=no,
    1.33 +                                [#include <X11/Xlib.h>
    1.34 +                                ])
    1.35 +                if test x$have_xrender_h_hdr = xyes; then
    1.36 +                    if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
    1.37 +                        echo "-- dynamic libXrender -> $xrender_lib"
    1.38 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
    1.39 +                        definitely_enable_video_x11_xrender=yes
    1.40 +                    else
    1.41 +                        AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
    1.42 +                        if test x$have_xrender_lib = xyes ; then
    1.43 +                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
    1.44 +                            definitely_enable_video_x11_xrender=yes
    1.45 +                        fi
    1.46 +                    fi
    1.47 +                fi
    1.48 +            fi
    1.49 +            if test x$definitely_enable_video_x11_xrender = xyes; then
    1.50 +                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
    1.51 +            fi
    1.52  
    1.53              AC_ARG_ENABLE(render-x11,
    1.54  AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
     2.1 --- a/include/SDL_config.h.in	Sun May 30 20:06:30 2010 +0530
     2.2 +++ b/include/SDL_config.h.in	Mon May 31 13:27:27 2010 +0530
     2.3 @@ -280,6 +280,8 @@
     2.4  #undef SDL_VIDEO_DRIVER_X11_XV
     2.5  #undef SDL_VIDEO_DRIVER_X11_XRENDER
     2.6  
     2.7 +#undef SDL_VIDEO_RENDER_X11
     2.8 +
     2.9  #undef SDL_VIDEO_RENDER_D3D
    2.10  #undef SDL_VIDEO_RENDER_GDI
    2.11  #undef SDL_VIDEO_RENDER_OGL
     3.1 --- a/src/video/x11/SDL_x11render.c	Sun May 30 20:06:30 2010 +0530
     3.2 +++ b/src/video/x11/SDL_x11render.c	Mon May 31 13:27:27 2010 +0530
     3.3 @@ -219,7 +219,7 @@
     3.4      if(XRenderQueryExtension(data->display, &event_basep, &error_basep) == True) {
     3.5          data->xrender_available = SDL_TRUE;
     3.6          data->xwindow_pict_fmt = XRenderFindVisualFormat(data->display, data->visual);
     3.7 -        if(!xwindow_pict_fmt) {
     3.8 +        if(!data->xwindow_pict_fmt) {
     3.9              data->xrender_available = SDL_FALSE;
    3.10          }
    3.11          data->xwindow_pict_attr.graphics_exposures = False;
    3.12 @@ -285,8 +285,8 @@
    3.13  #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
    3.14          if(data->xrender_available == SDL_TRUE) {
    3.15              data->pixmap_picts[i] = 
    3.16 -                XCreatePicture(data->display, data->pixmap[i], data->xwindow_pict_fmt,
    3.17 -                               data->xwindow_pict_attr_valuemask, &xwindow_pict_attr);
    3.18 +                XRenderCreatePicture(data->display, data->pixmaps[i], data->xwindow_pict_fmt,
    3.19 +                               data->xwindow_pict_attr_valuemask, &data->xwindow_pict_attr);
    3.20              if(!data->pixmap_picts[i]) {
    3.21                  data->xrender_available = SDL_FALSE;
    3.22              }
    3.23 @@ -354,7 +354,7 @@
    3.24              XFreePixmap(data->display, data->pixmaps[i]);
    3.25              data->pixmaps[i] = None;
    3.26  #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
    3.27 -            data->pictures[i] = None;
    3.28 +            data->pixmap_picts[i] = None;
    3.29  #endif
    3.30          }
    3.31      }
    3.32 @@ -368,10 +368,10 @@
    3.33          }
    3.34  #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
    3.35          if(data->xrender_available == SDL_TRUE) {
    3.36 -            data->pictures[i] = 
    3.37 -                XCreatePicture(data->display, data->pixmap[i], data->xwindow_pict_fmt,
    3.38 +            data->pixmap_picts[i] = 
    3.39 +                XRenderCreatePicture(data->display, data->pixmaps[i], data->xwindow_pict_fmt,
    3.40                                 data->xwindow_pict_attr_valuemask, &data->xwindow_pict_attr);
    3.41 -            if(!data->pictures[i]) {
    3.42 +            if(!data->pixmap_picts[i]) {
    3.43                  data->xrender_available = SDL_FALSE;
    3.44              }
    3.45          }
    3.46 @@ -380,7 +380,7 @@
    3.47      if (n > 0) {
    3.48          data->drawable = data->pixmaps[0];
    3.49  #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
    3.50 -        data->drawable_pict = data->pictures[0];
    3.51 +        data->drawable_pict = data->pixmap_picts[0];
    3.52  #endif
    3.53      }
    3.54      data->current_pixmap = 0;
    3.55 @@ -419,7 +419,7 @@
    3.56  #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
    3.57          // Assume the texture is supported by Xrender
    3.58          data->xrender_available = SDL_TRUE;
    3.59 -        if(renderdata->xrender_available == SDL_False) {
    3.60 +        if(renderdata->xrender_available == SDL_FALSE) {
    3.61              if (texture->format != display->current_mode.format) {
    3.62                  SDL_SetError("Texture format doesn't match window format");
    3.63                  return -1;
    3.64 @@ -523,21 +523,24 @@
    3.65              x11_fmt_mask =
    3.66                  (PictFormatDepth | PictFormatRedMask | PictFormatGreenMask
    3.67                  | PictFormatBlueMask);
    3.68 -            x11_templ_fmt.depth = (data->format).BitsPerPixel;
    3.69 -            x11_temp_fmt.direct.redMask = (data->format).Rmask;
    3.70 -            x11_temp_fmt.direct.greenMask = (data->format).Gmask;
    3.71 -            x11_temp_fmt.direct.blueMask = (data->format).Bmask;
    3.72 -            x11_temp_fmt.direct.alphaMask = (data->format).Amask;
    3.73 +            Uint32 Rmask, Gmask, Bmask, Amask;
    3.74 +            int bpp;
    3.75 +            SDL_PixelFormatEnumToMasks(data->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask);
    3.76 +            x11_templ_fmt.depth = bpp;
    3.77 +            x11_templ_fmt.direct.redMask = Rmask;
    3.78 +            x11_templ_fmt.direct.greenMask = Gmask;
    3.79 +            x11_templ_fmt.direct.blueMask = Bmask;
    3.80 +            x11_templ_fmt.direct.alphaMask = Amask;
    3.81              /* Return one matching XRenderPictFormat */
    3.82 -            data->pict_fmt =
    3.83 +            data->picture_fmt =
    3.84                  XRenderFindFormat(renderdata->display, x11_fmt_mask, &x11_templ_fmt, 1);
    3.85 -            if(!data->pict_fmt) {
    3.86 +            if(!data->picture_fmt) {
    3.87                  data->xrender_available = SDL_FALSE;
    3.88              }
    3.89              data->picture_attr_valuemask = CPGraphicsExposure;
    3.90              (data->picture_attr).graphics_exposures = False;
    3.91              data->picture =
    3.92 -                XCreatePicture(renderdata->display, data->pixmap, data->picture_fmt,
    3.93 +                XRenderCreatePicture(renderdata->display, data->pixmap, data->picture_fmt,
    3.94                                 data->picture_attr_valuemask, &(data->picture_attr));
    3.95              if(!data->picture) {
    3.96                  data->xrender_available = SDL_FALSE;
    3.97 @@ -997,8 +1000,13 @@
    3.98  #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
    3.99          if(data->xrender_available == SDL_TRUE)
   3.100          {
   3.101 +            XRenderColor xrender_foreground_color;
   3.102 +            xrender_foreground_color.red = renderer->r;
   3.103 +            xrender_foreground_color.green = renderer->g;
   3.104 +            xrender_foreground_color.blue = renderer->b;
   3.105 +            xrender_foreground_color.alpha = renderer->a;
   3.106              XRenderFillRectangles(data->display, PictOpSrc, data->drawable_pict,
   3.107 -                                  (XRenderColor)foreground, xrects, xcount);
   3.108 +                                  &xrender_foreground_color, xrects, xcount);
   3.109          }
   3.110          else
   3.111  #endif