Changed: #1034 Use XRender check from FindX11.cmake

This commit is contained in:
kervala 2010-11-02 10:02:30 +01:00
parent c51881803f
commit 28321f4c66
4 changed files with 56 additions and 35 deletions

View file

@ -27,7 +27,6 @@ IF(WITH_3D)
ELSE(APPLE) ELSE(APPLE)
FIND_PACKAGE(X11) FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode) FIND_PACKAGE(XF86VidMode)
FIND_PACKAGE(XRandR)
ENDIF(APPLE) ENDIF(APPLE)
ENDIF(NOT WIN32) ENDIF(NOT WIN32)
ENDIF(WITH_DRIVER_OPENGL) ENDIF(WITH_DRIVER_OPENGL)

View file

@ -29,24 +29,31 @@ IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS) ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS)
ELSE(WIN32) ENDIF(WIN32)
IF(APPLE)
IF(APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
ELSE(APPLE) ENDIF(APPLE)
IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_X11_LIB}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_X11_LIB})
IF(XF86VidMode_FOUND) IF(XF86VidMode_FOUND)
INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR})
ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS}) ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS})
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XF86VidMode_LIBRARY}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XF86VidMode_LIBRARY})
ENDIF(XF86VidMode_FOUND) ENDIF(XF86VidMode_FOUND)
IF(XRandR_FOUND) IF(X11_Xrandr_FOUND)
INCLUDE_DIRECTORIES(${XRandR_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH})
ADD_DEFINITIONS(${XRandR_DEFINITIONS}) ADD_DEFINITIONS(-DHAVE_XRANDR)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XRandR_LIBRARY}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrandr_LIB})
ENDIF(XRandR_FOUND) ENDIF(X11_Xrandr_FOUND)
ENDIF(APPLE) IF(X11_Xrender_FOUND)
ENDIF(WIN32) INCLUDE_DIRECTORIES(${X11_Xrender_INCLUDE_PATH})
ADD_DEFINITIONS(-DHAVE_XRENDER)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xrender_LIB})
ENDIF(X11_Xrender_FOUND)
ENDIF(UNIX AND NOT APPLE)
IF(NOT APPLE AND WITH_PCH) IF(NOT APPLE AND WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)

View file

@ -730,10 +730,11 @@ private:
XVisualInfo* _visual_info; XVisualInfo* _visual_info;
uint32 _xrandr_version; uint32 _xrandr_version;
uint32 _xvidmode_version; uint32 _xvidmode_version;
uint32 _xrender_version;
#ifdef XRANDR #ifdef HAVE_XRANDR
sint _OldSizeID; sint _OldSizeID;
#endif // XRANDR #endif // HAVE_XRANDR
#ifdef XF86VIDMODE #ifdef XF86VIDMODE
sint _OldDotClock; // old dotclock sint _OldDotClock; // old dotclock

View file

@ -29,9 +29,12 @@
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
# include <GL/gl.h> # include <GL/gl.h>
# include <GL/glx.h> # include <GL/glx.h>
# ifdef XRANDR # ifdef HAVE_XRANDR
# include <X11/extensions/Xrandr.h> # include <X11/extensions/Xrandr.h>
# endif # endif // HAVE_XRANDR
# ifdef HAVE_XRENDER
# include <X11/extensions/Xrender.h>
# endif // HAVE_XRENDER
# include <X11/Xatom.h> # include <X11/Xatom.h>
# define _NET_WM_STATE_REMOVE 0 # define _NET_WM_STATE_REMOVE 0
# define _NET_WM_STATE_ADD 1 # define _NET_WM_STATE_ADD 1
@ -327,7 +330,7 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
_xrandr_version = 0; _xrandr_version = 0;
#ifdef XRANDR #ifdef HAVE_XRANDR
_OldSizeID = 0; _OldSizeID = 0;
sint xrandr_major, xrandr_minor; sint xrandr_major, xrandr_minor;
if (XRRQueryVersion(_dpy, &xrandr_major, &xrandr_minor)) if (XRRQueryVersion(_dpy, &xrandr_major, &xrandr_minor))
@ -335,8 +338,7 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
_xrandr_version = xrandr_major * 100 + xrandr_minor; _xrandr_version = xrandr_major * 100 + xrandr_minor;
nlinfo("3D: XRandR %d.%d found", xrandr_major, xrandr_minor); nlinfo("3D: XRandR %d.%d found", xrandr_major, xrandr_minor);
} }
#endif // HAVE_XRANDR
#endif
_xvidmode_version = 0; _xvidmode_version = 0;
@ -349,7 +351,19 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
} }
#endif #endif
_xrender_version = 0;
#ifdef HAVE_XRENDER
sint render_major, render_event, render_error;
if (XQueryExtension(_dpy, "RENDER", &render_major, &render_event, &render_error))
{
_xrender_version = render_major * 100;
nlinfo("3D: XRender %d.%d found", render_major, 0);
}
#endif // HAVE_XRENDER
#endif #endif
return true; return true;
} }
@ -1103,7 +1117,7 @@ bool CDriverGL::saveScreenMode()
int screen = DefaultScreen(_dpy); int screen = DefaultScreen(_dpy);
res = false; res = false;
#ifdef XRANDR #ifdef HAVE_XRANDR
if (!res && _xrandr_version > 0) if (!res && _xrandr_version > 0)
{ {
@ -1124,7 +1138,7 @@ bool CDriverGL::saveScreenMode()
} }
} }
#endif // XRANDR #endif // HAVE_XRANDR
#if defined(XF86VIDMODE) #if defined(XF86VIDMODE)
@ -1167,7 +1181,7 @@ bool CDriverGL::restoreScreenMode()
int screen = DefaultScreen(_dpy); int screen = DefaultScreen(_dpy);
#ifdef XRANDR #ifdef HAVE_XRANDR
if (!res && _xrandr_version > 0) if (!res && _xrandr_version > 0)
{ {
@ -1193,7 +1207,7 @@ bool CDriverGL::restoreScreenMode()
} }
} }
#endif // XRANDR #endif // HAVE_XRANDR
#if defined(XF86VIDMODE) #if defined(XF86VIDMODE)
@ -1302,7 +1316,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode)
bool found = false; bool found = false;
#ifdef XRANDR #ifdef HAVE_XRANDR
if (!found && _xrandr_version > 0) if (!found && _xrandr_version > 0)
{ {
@ -1347,7 +1361,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode)
} }
} }
#endif #endif // HAVE_XRANDR
#if defined(XF86VIDMODE) #if defined(XF86VIDMODE)
@ -1895,7 +1909,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
bool found = false; bool found = false;
int screen = DefaultScreen(_dpy); int screen = DefaultScreen(_dpy);
#if defined(XRANDR) #if defined(HAVE_XRANDR)
if (!found && _xrandr_version >= 100) if (!found && _xrandr_version >= 100)
{ {
XRRScreenConfiguration *screen_config = XRRGetScreenInfo(_dpy, RootWindow(_dpy, screen)); XRRScreenConfiguration *screen_config = XRRGetScreenInfo(_dpy, RootWindow(_dpy, screen));
@ -2029,7 +2043,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
bool found = false; bool found = false;
int screen = DefaultScreen(_dpy); int screen = DefaultScreen(_dpy);
#ifdef XRANDR #ifdef HAVE_XRANDR
if (!found && _xrandr_version > 0) if (!found && _xrandr_version > 0)
{ {
@ -2068,7 +2082,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
} }
} }
#endif // XRANDR #endif // HAVE_XRANDR
#ifdef XF86VIDMODE #ifdef XF86VIDMODE