2004-06-21 15:19:32 +02:00
|
|
|
/*
|
|
|
|
* Export window information for the Windows-OpenGL GLX implementation.
|
|
|
|
*
|
|
|
|
* Authors: Alexander Gottwald
|
|
|
|
*/
|
|
|
|
|
2005-07-05 00:10:43 +02:00
|
|
|
#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
|
2012-03-21 20:55:09 +01:00
|
|
|
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.
|
2009-11-07 20:28:18 +01:00
|
|
|
*/
|
2012-03-21 20:55:09 +01:00
|
|
|
HWND
|
|
|
|
winGetWindowInfo(WindowPtr pWin)
|
2004-06-21 15:19:32 +02:00
|
|
|
{
|
2015-06-29 15:25:49 +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 */
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
2009-11-07 20:28:18 +01:00
|
|
|
HWND hwnd = NULL;
|
2004-06-21 15:19:32 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pWinScreen == NULL) {
|
2004-06-21 15:19:32 +02:00
|
|
|
ErrorF("winGetWindowInfo: screen has no privates\n");
|
2009-11-07 20:28:18 +01:00
|
|
|
return NULL;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
2009-11-07 20:28:18 +01:00
|
|
|
|
|
|
|
hwnd = pWinScreen->hwndScreen;
|
2004-06-21 15:19:32 +02:00
|
|
|
|
|
|
|
pScreenInfo = pWinScreen->pScreenInfo;
|
|
|
|
#ifdef XWIN_MULTIWINDOW
|
|
|
|
/* check for multiwindow mode */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreenInfo->fMultiWindow) {
|
2004-06-21 15:19:32 +02:00
|
|
|
winWindowPriv(pWin);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pWinPriv == NULL) {
|
2004-06-21 15:19:32 +02:00
|
|
|
ErrorF("winGetWindowInfo: window has no privates\n");
|
2009-11-07 20:28:18 +01:00
|
|
|
return hwnd;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pWinPriv->hWnd == NULL) {
|
|
|
|
winCreateWindowsWindow(pWin);
|
2014-07-14 20:41:25 +02:00
|
|
|
winDebug("winGetWindowInfo: forcing window to exist\n");
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
2009-11-07 20:28:18 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pWinPriv->hWnd != NULL) {
|
2009-11-07 20:28:18 +01:00
|
|
|
/* copy window handle */
|
|
|
|
hwnd = pWinPriv->hWnd;
|
2010-10-11 17:25:03 +02:00
|
|
|
|
|
|
|
/* mark GLX active on that hwnd */
|
|
|
|
pWinPriv->fWglUsed = TRUE;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2009-11-07 20:28:18 +01:00
|
|
|
|
|
|
|
return hwnd;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
|
|
|
/* check for multiwindow external wm mode */
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreenInfo->fMWExtWM) {
|
2004-06-21 15:19:32 +02:00
|
|
|
win32RootlessWindowPtr pRLWinPriv
|
2012-03-21 20:55:09 +01:00
|
|
|
= (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
|
2004-06-21 15:19:32 +02:00
|
|
|
|
|
|
|
if (pRLWinPriv == NULL) {
|
|
|
|
ErrorF("winGetWindowInfo: window has no privates\n");
|
2009-11-07 20:28:18 +01:00
|
|
|
return hwnd;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
2009-11-07 20:28:18 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pRLWinPriv->hWnd != NULL) {
|
2009-11-07 20:28:18 +01:00
|
|
|
/* copy window handle */
|
|
|
|
hwnd = pRLWinPriv->hWnd;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
2009-11-07 20:28:18 +01:00
|
|
|
return hwnd;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
|
|
|
#endif
|
2009-11-07 20:28:18 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
2004-06-21 15:19:32 +02:00
|
|
|
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
|
|
|
|
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pWinScreen == NULL) {
|
2004-06-21 15:19:32 +02:00
|
|
|
ErrorF("winGetWindowInfo: screen has no privates\n");
|
2009-11-07 20:28:18 +01:00
|
|
|
return NULL;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrorF("winGetWindowInfo: returning root window\n");
|
|
|
|
|
2009-11-07 20:28:18 +01:00
|
|
|
return pWinScreen->hwndScreen;
|
2004-06-21 15:19:32 +02:00
|
|
|
}
|
2009-11-07 20:28:18 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bool
|
|
|
|
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
|
|
|
winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
|
2009-11-07 20:28:18 +01:00
|
|
|
|
|
|
|
#ifdef XWIN_MULTIWINDOW
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreenInfo->fMultiWindow)
|
|
|
|
return TRUE;
|
2009-11-07 20:28:18 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pScreenInfo->fMWExtWM)
|
|
|
|
return TRUE;
|
2009-11-07 20:28:18 +01:00
|
|
|
#endif
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
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;
|
|
|
|
}
|