fi
fi
+dnl Check for XRandR
+HAVE_XRANDR=0
+if test $USE_X11 -eq 1; then
+ HAVE_XRANDR=1
+ PKG_CHECK_MODULES([XRANDR], [xrandr], [:], [HAVE_XRANDR=0])
+ if test $HAVE_XRANDR -eq 1; then
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $XRANDR_CFLAGS"
+ AC_CHECK_HEADERS([X11/extensions/Xrandr.h], [:], [HAVE_XRANDR=0])
+ CPPFLAGS="$saved_CPPFLAGS"
+ fi
+fi
+if test $HAVE_XRANDR -eq 1; then
+ AC_DEFINE_UNQUOTED(HAVE_XRANDR, 1,
+ [Defined to 1 if the XRandR extension exists.])
+fi
+
dnl OpenGL
enable_opengl="no"
if test "$enable_glx" = "yes"; then
#include "gstvaapidisplay_x11.h"
#include "gstvaapidisplay_x11_priv.h"
+#ifdef HAVE_XRANDR
+# include <X11/extensions/Xrandr.h>
+#endif
+
#define DEBUG 1
#include "gstvaapidebug.h"
if (priv->synchronous)
XSynchronize(priv->x11_display, True);
+
+#ifdef HAVE_XRANDR
+ {
+ int evt_base, err_base;
+ priv->use_xrandr = XRRQueryExtension(
+ priv->x11_display, &evt_base, &err_base);
+ }
+#endif
return TRUE;
}
{
GstVaapiDisplayX11Private * const priv =
GST_VAAPI_DISPLAY_X11(display)->priv;
+ guint width_mm, height_mm;
if (!priv->x11_display)
return;
+ width_mm = DisplayWidthMM(priv->x11_display, priv->x11_screen);
+ height_mm = DisplayHeightMM(priv->x11_display, priv->x11_screen);
+
+#ifdef HAVE_XRANDR
+ /* XXX: fix up physical size if the display is rotated */
+ if (priv->use_xrandr) {
+ XRRScreenConfiguration *xrr_config = NULL;
+ XRRScreenSize *xrr_sizes;
+ Window win;
+ int num_xrr_sizes, size_id, screen;
+ Rotation rotation;
+
+ do {
+ win = DefaultRootWindow(priv->x11_display);
+ screen = XRRRootToScreen(priv->x11_display, win);
+
+ xrr_config = XRRGetScreenInfo(priv->x11_display, win);
+ if (!xrr_config)
+ break;
+
+ size_id = XRRConfigCurrentConfiguration(xrr_config, &rotation);
+ if (rotation == RR_Rotate_0 || rotation == RR_Rotate_180)
+ break;
+
+ xrr_sizes = XRRSizes(priv->x11_display, screen, &num_xrr_sizes);
+ if (!xrr_sizes || size_id >= num_xrr_sizes)
+ break;
+
+ width_mm = xrr_sizes[size_id].mheight;
+ height_mm = xrr_sizes[size_id].mwidth;
+ } while (0);
+ if (xrr_config)
+ XRRFreeScreenConfigInfo(xrr_config);
+ }
+#endif
+
if (pwidth)
- *pwidth = DisplayWidthMM(priv->x11_display, priv->x11_screen);
+ *pwidth = width_mm;
if (pheight)
- *pheight = DisplayHeightMM(priv->x11_display, priv->x11_screen);
+ *pheight = height_mm;
}
static void
priv->x11_display = NULL;
priv->x11_screen = 0;
priv->display_name = NULL;
+ priv->use_xrandr = FALSE;
}
/**