xserver-multidpi/hw/xwin/glx/winpriv.c

129 lines
3.2 KiB
C
Raw Normal View History

2004-06-21 15:19:32 +02:00
/*
* Export window information for the Windows-OpenGL GLX implementation.
*
* Authors: Alexander Gottwald
*/
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
2004-06-21 15:19:32 +02:00
#include "win.h"
#include "winpriv.h"
#include "winwindow.h"
void
winCreateWindowsWindow(WindowPtr pWin);
2004-06-21 15:19:32 +02:00
/**
* Return size and handles of a window.
* If pWin is NULL, then the information for the root window is requested.
*/
HWND
winGetWindowInfo(WindowPtr pWin)
2004-06-21 15:19:32 +02:00
{
winTrace("%s: pWin %p XID 0x%x\n", __FUNCTION__, pWin, (unsigned int)pWin->drawable.id);
2004-06-21 15:19:32 +02:00
/* a real window was requested */
if (pWin != NULL) {
2004-06-21 15:19:32 +02:00
/* Get the window and screen privates */
ScreenPtr pScreen = pWin->drawable.pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = NULL;
HWND hwnd = NULL;
2004-06-21 15:19:32 +02:00
if (pWinScreen == NULL) {
2004-06-21 15:19:32 +02:00
ErrorF("winGetWindowInfo: screen has no privates\n");
return NULL;
2004-06-21 15:19:32 +02:00
}
hwnd = pWinScreen->hwndScreen;
2004-06-21 15:19:32 +02:00
pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
/* check for multiwindow mode */
if (pScreenInfo->fMultiWindow) {
2004-06-21 15:19:32 +02:00
winWindowPriv(pWin);
if (pWinPriv == NULL) {
2004-06-21 15:19:32 +02:00
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
2004-06-21 15:19:32 +02:00
}
if (pWinPriv->hWnd == NULL) {
winCreateWindowsWindow(pWin);
winDebug("winGetWindowInfo: forcing window to exist\n");
2004-06-21 15:19:32 +02:00
}
if (pWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pWinPriv->hWnd;
/* mark GLX active on that hwnd */
pWinPriv->fWglUsed = TRUE;
}
return hwnd;
2004-06-21 15:19:32 +02:00
}
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/* check for multiwindow external wm mode */
if (pScreenInfo->fMWExtWM) {
2004-06-21 15:19:32 +02:00
win32RootlessWindowPtr pRLWinPriv
= (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
2004-06-21 15:19:32 +02:00
if (pRLWinPriv == NULL) {
ErrorF("winGetWindowInfo: window has no privates\n");
return hwnd;
2004-06-21 15:19:32 +02:00
}
if (pRLWinPriv->hWnd != NULL) {
/* copy window handle */
hwnd = pRLWinPriv->hWnd;
2004-06-21 15:19:32 +02:00
}
return hwnd;
2004-06-21 15:19:32 +02:00
}
#endif
}
else {
2004-06-21 15:19:32 +02:00
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
if (pWinScreen == NULL) {
2004-06-21 15:19:32 +02:00
ErrorF("winGetWindowInfo: screen has no privates\n");
return NULL;
2004-06-21 15:19:32 +02:00
}
ErrorF("winGetWindowInfo: returning root window\n");
return pWinScreen->hwndScreen;
2004-06-21 15:19:32 +02:00
}
return NULL;
}
Bool
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
{
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
#ifdef XWIN_MULTIWINDOW
if (pScreenInfo->fMultiWindow)
return TRUE;
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
if (pScreenInfo->fMWExtWM)
return TRUE;
#endif
return FALSE;
2004-06-21 15:19:32 +02:00
}
Add Windows-DRI extension If windowsdriproto headers are available, build a Windows-DRI extension, which supports requests to enable local clients to directly render GL to a Windows drawable: - a query to check if WGL is being used on a screen - a query to map a fbconfigID to a native pixelformatindex - a query to map a drawable to a native handle Windows-DRI can only be useful if we are using WGL, so make an note if WGL is active on a screen. Make validGlxDrawable() public Adjust glxWinSetPixelFormat() so it doesn't require a context, just a screen and config. That enables factoring out the deferred drawable creation code as glxWinDeferredCreateDrawable() Enhance glxWinDeferredCreateDrawable(), so that pixmaps are placed into a file mapping, so they exist in memory which can be shared with the direct rendering process. Currently, this file mapping is accessed by a name generated from the XID. This will not be unique across multiple server instances. It would perhaps be better, although more complicated, to use an anonymous file mapping, and then duplicate the handle for the direct rendering process. Use glxWinDeferredCreateDrawable() to ensure the native handle exists for the Windows-DRI query to map a drawable to native handle. v2: Various printf format warning fixes v3: Fix format warnings on x86 Move some uninteresting windows-dri output to debug log level v4: check for windowsdriproto when --enable-windowsdri use windowsdriproto_CFLAGS Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2014-07-24 13:29:41 +02:00
void
winSetScreenAiglxIsActive(ScreenPtr pScreen)
{
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
pWinScreen->fNativeGlActive = TRUE;
}