Commit 533b3530 authored by Jon Turney's avatar Jon Turney

direct-to-native-GL for GLX clients on Cygwin ("Windows-DRI")

Structurally, this is very similar to the existing Apple-DRI code, except I
have chosen to implement this using the __GLXDRIdisplay, etc. vtables (as
suggested originally in [1]), rather than a maze of ifdefs.  This also means
that LIBGL_ALWAYS_SOFTWARE and LIBGL_ALWAYS_INDIRECT work as expected.

[1] https://lists.freedesktop.org/archives/mesa-dev/2010-May/000756.html

This adds:

* the Windows-DRI extension protocol headers and the windowsdriproto.pc
file, for use in building the Windows-DRI extension for the X server

* a Windows-DRI extension helper client library

* a Windows-specific DRI implementation for GLX clients

The server is queried for Windows-DRI extension support on the screen before
using it (to detect the case where WGL is disabled or can't be activated).

The server is queried for fbconfigID to pixelformatindex mapping, which is
used to augment glx_config.

The server is queried for a native handle for the drawable (which is of a
different type for windows, pixmaps and pbuffers), which is used to augment
__GLXDRIdrawable.

Various GLX extensions are enabled depending on if the equivalent WGL
extension is available.
parent 2ac09ac5
......@@ -1106,7 +1106,9 @@ fi
case "$host_os" in
darwin*)
dri_platform='apple' ;;
gnu*|cygwin*)
cygwin*)
dri_platform='windows' ;;
gnu*)
dri_platform='none' ;;
*)
dri_platform='drm' ;;
......@@ -1122,6 +1124,7 @@ AM_CONDITIONAL(HAVE_DRISW_KMS, test "x$have_drisw_kms" = xyes )
AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xapple )
AM_CONDITIONAL(HAVE_WINDOWSDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xwindows )
AC_ARG_ENABLE([shared-glapi],
[AS_HELP_STRING([--enable-shared-glapi],
......@@ -1386,6 +1389,9 @@ xdri)
if test x"$dri_platform" = xapple ; then
DEFINES="$DEFINES -DGLX_USE_APPLEGL"
fi
if test x"$dri_platform" = xwindows ; then
DEFINES="$DEFINES -DGLX_USE_WINDOWSGL"
fi
fi
# add xf86vidmode if available
......@@ -2745,6 +2751,8 @@ AC_CONFIG_FILES([Makefile
src/glx/Makefile
src/glx/apple/Makefile
src/glx/tests/Makefile
src/glx/windows/Makefile
src/glx/windows/windowsdriproto.pc
src/gtest/Makefile
src/intel/Makefile
src/intel/tools/Makefile
......
......@@ -145,6 +145,16 @@ SUBDIRS += apple
libglx_la_LIBADD += $(builddir)/apple/libappleglx.la
endif
if HAVE_WINDOWSDRI
libglx_la_SOURCES += \
driwindows_glx.c
SUBDIRS += windows
libglx_la_LIBADD += \
$(builddir)/windows/libwindowsdri.la \
$(builddir)/windows/libwindowsglx.la
endif
if USE_LIBGLVND_GLX
AM_CFLAGS += \
-DGL_LIB_NAME=\"lib@GL_LIB@.so.0\" \
......@@ -181,6 +191,10 @@ lib@GL_LIB@_la_SOURCES =
lib@GL_LIB@_la_LIBADD = $(GL_LIBS)
lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS)
if HAVE_WINDOWSDRI
lib@GL_LIB@_la_LDFLAGS += -lgdi32 -lopengl32 -Wl,--disable-stdcall-fixup
endif
SUBDIRS += . tests
include $(top_srcdir)/install-lib-links.mk
This diff is collapsed.
......@@ -154,11 +154,15 @@ struct __GLXDRIdrawableRec
extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
extern __GLXDRIdisplay *dri3_create_display(Display * dpy);
extern __GLXDRIdisplay *driwindowsCreateDisplay(Display * dpy);
/*
**
*/
extern void dri2InvalidateBuffers(Display *dpy, XID drawable);
extern unsigned dri2GetSwapEventType(Display *dpy, XID drawable);
extern __GLXDRIdisplay *dri3_create_display(Display * dpy);
/*
** Functions to obtain driver configuration information from a direct
** rendering client application
......@@ -606,6 +610,9 @@ struct glx_display
__GLXDRIdisplay *dri2Display;
__GLXDRIdisplay *dri3Display;
#endif
#ifdef GLX_USE_WINDOWSGL
__GLXDRIdisplay *windowsdriDisplay;
#endif
};
struct glx_drawable {
......
......@@ -264,6 +264,13 @@ glx_display_free(struct glx_display *priv)
(*priv->dri3Display->destroyDisplay) (priv->dri3Display);
priv->dri3Display = NULL;
#endif /* GLX_USE_DRM */
#if defined(GLX_USE_WINDOWSGL)
if (priv->windowsdriDisplay)
(*priv->windowsdriDisplay->destroyDisplay) (priv->windowsdriDisplay);
priv->windowsdriDisplay = NULL;
#endif /* GLX_USE_WINDOWSGL */
#endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
free((char *) priv);
......@@ -800,6 +807,12 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
if (psc == NULL && priv->driDisplay)
psc = (*priv->driDisplay->createScreen) (i, priv);
#endif /* GLX_USE_DRM */
#ifdef GLX_USE_WINDOWSGL
if (psc == NULL && priv->windowsdriDisplay)
psc = (*priv->windowsdriDisplay->createScreen) (i, priv);
#endif
if (psc == NULL && priv->driswDisplay)
psc = (*priv->driswDisplay->createScreen) (i, priv);
#endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
......@@ -907,6 +920,12 @@ __glXInitialize(Display * dpy)
return NULL;
}
#endif
#ifdef GLX_USE_WINDOWSGL
if (glx_direct && glx_accel)
dpyPriv->windowsdriDisplay = driwindowsCreateDisplay(dpy);
#endif
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
free(dpyPriv);
return NULL;
......
noinst_LTLIBRARIES = libwindowsdri.la libwindowsglx.la
# protocol defines for the Windows-DRI server extension
windowsdriincludedir = $(includedir)/X11/extensions
windowsdriinclude_HEADERS = windowsdriconst.h windowsdristr.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = windowsdriproto.pc
# library for using the Windows-DRI server extension
libwindowsdri_la_SOURCES = xwindowsdri.c xwindowsdri.h
# native rendering GL for windows
libwindowsglx_la_SOURCES = \
windowsgl.c \
windowsgl.h \
windowsgl_internal.h \
windows_drawable.c \
wgl.c
libwindowsglx_la_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/glx \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mapi/glapi \
-I$(top_builddir)/src/mapi/glapi \
$(VISIBILITY_CFLAGS) \
$(SHARED_GLAPI_CFLAGS) \
$(DEFINES) \
$(X11_INCLUDES)
/*
* Copyright © 2014 Jon Turney
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/*
Wrapper functions for calling WGL extension functions
*/
#include "wgl.h"
#include <stdio.h>
#define RESOLVE_DECL(type) \
static type type##proc = NULL;
#define PRERESOLVE(type, symbol) \
type##proc = (type)wglGetProcAddress(symbol); \
if (type##proc == NULL) \
printf("Can't resolve \"%s\"\n", symbol);
#define CHECK_RESOLVED(type, retval) \
if (type##proc == NULL) { \
return retval; \
}
#define RESOLVED_PROC(type) type##proc
RESOLVE_DECL(PFNWGLGETEXTENSIONSSTRINGARBPROC);
RESOLVE_DECL(PFNWGLCREATECONTEXTATTRIBSARBPROC);
RESOLVE_DECL(PFNWGLMAKECONTEXTCURRENTARBPROC);
RESOLVE_DECL(PFNWGLCREATEPBUFFERARBPROC);
RESOLVE_DECL(PFNWGLGETPBUFFERDCARBPROC);
RESOLVE_DECL(PFNWGLRELEASEPBUFFERDCARBPROC);
RESOLVE_DECL(PFNWGLDESTROYPBUFFERARBPROC);
void wglResolveExtensionProcs(void)
{
PRERESOLVE(PFNWGLGETEXTENSIONSSTRINGARBPROC, "wglGetExtensionsStringARB");
PRERESOLVE(PFNWGLCREATECONTEXTATTRIBSARBPROC, "wglCreateContextAttribsARB");
PRERESOLVE(PFNWGLMAKECONTEXTCURRENTARBPROC, "wglMakeContextCurrentARB");
PRERESOLVE(PFNWGLCREATEPBUFFERARBPROC, "wglCreatePbufferARB");
PRERESOLVE(PFNWGLGETPBUFFERDCARBPROC, "wglGetPbufferDCARB");
PRERESOLVE(PFNWGLRELEASEPBUFFERDCARBPROC, "wglReleasePbufferDCARB");
PRERESOLVE(PFNWGLDESTROYPBUFFERARBPROC, "wglDestroyPbufferARB");
}
const char *wglGetExtensionsStringARB(HDC hdc_)
{
CHECK_RESOLVED(PFNWGLGETEXTENSIONSSTRINGARBPROC, "");
return RESOLVED_PROC(PFNWGLGETEXTENSIONSSTRINGARBPROC)(hdc_);
}
HGLRC wglCreateContextAttribsARB(HDC hdc_, HGLRC hShareContext_,
const int *attribList_)
{
CHECK_RESOLVED(PFNWGLCREATECONTEXTATTRIBSARBPROC, NULL);
return RESOLVED_PROC(PFNWGLCREATECONTEXTATTRIBSARBPROC)(hdc_, hShareContext_, attribList_);
}
BOOL wglMakeContextCurrentARB(HDC hDrawDC_, HDC hReadDC_, HGLRC hglrc_)
{
CHECK_RESOLVED(PFNWGLMAKECONTEXTCURRENTARBPROC, FALSE);
return RESOLVED_PROC(PFNWGLMAKECONTEXTCURRENTARBPROC)(hDrawDC_, hReadDC_, hglrc_);
}
HPBUFFERARB wglCreatePbufferARB(HDC hDC_, int iPixelFormat_, int iWidth_,
int iHeight_, const int *piAttribList_)
{
CHECK_RESOLVED(PFNWGLCREATEPBUFFERARBPROC, NULL);
return RESOLVED_PROC(PFNWGLCREATEPBUFFERARBPROC)(hDC_, iPixelFormat_, iWidth_, iHeight_, piAttribList_);
}
HDC wglGetPbufferDCARB(HPBUFFERARB hPbuffer_)
{
CHECK_RESOLVED(PFNWGLGETPBUFFERDCARBPROC, NULL);
return RESOLVED_PROC(PFNWGLGETPBUFFERDCARBPROC)(hPbuffer_);
}
int wglReleasePbufferDCARB(HPBUFFERARB hPbuffer_, HDC hDC_)
{
CHECK_RESOLVED(PFNWGLRELEASEPBUFFERDCARBPROC, 0)
return RESOLVED_PROC(PFNWGLRELEASEPBUFFERDCARBPROC)(hPbuffer_, hDC_);
}
BOOL wglDestroyPbufferARB(HPBUFFERARB hPbuffer_)
{
CHECK_RESOLVED(PFNWGLDESTROYPBUFFERARBPROC, FALSE);
return RESOLVED_PROC(PFNWGLDESTROYPBUFFERARBPROC)(hPbuffer_);
}
/*
* Copyright © 2014 Jon Turney
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef wgl_h
#define wgl_h
#include <X11/Xmd.h> // for BOOL
#include <X11/Xwindows.h> // as this doesn't provide one
#include <GL/gl.h>
#include <GL/wglext.h>
void wglResolveExtensionProcs(void);
const char *wglGetExtensionsStringARB(HDC hdc_);
HGLRC wglCreateContextAttribsARB(HDC hdc_, HGLRC hShareContext_,
const int *attribList_);
BOOL wglMakeContextCurrentARB(HDC hDrawDC_, HDC hReadDC_, HGLRC hglrc_);
HPBUFFERARB wglCreatePbufferARB(HDC hDC_, int iPixelFormat_, int iWidth_,
int iHeight_, const int *piAttribList_);
HDC wglGetPbufferDCARB(HPBUFFERARB hPbuffer_);
int wglReleasePbufferDCARB(HPBUFFERARB hPbuffer_, HDC hDC_);
BOOL wglDestroyPbufferARB(HPBUFFERARB hPbuffer_);
#endif /* wgl_h */
/*
* Copyright © 2014 Jon Turney
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "windowsgl.h"
#include "windowsgl_internal.h"
#include "windowsdriconst.h"
#include "wgl.h"
#include <stdio.h>
/*
* Window drawable
*/
static
HDC window_getdc(windowsDrawable *d)
{
return GetDC(d->hWnd);
}
static
void window_releasedc(windowsDrawable *d, HDC dc)
{
ReleaseDC(d->hWnd, dc);
}
static struct windowsdrawable_callbacks window_callbacks = {
.type = WindowsDRIDrawableWindow,
.getdc = window_getdc,
.releasedc = window_releasedc
};
/*
* Pixmap drawable
*/
static
HDC pixmap_getdc(windowsDrawable *d)
{
return d->dibDC;
}
static
void pixmap_releasedc(windowsDrawable *d, HDC dc)
{
GdiFlush();
}
static struct windowsdrawable_callbacks pixmap_callbacks = {
.type = WindowsDRIDrawablePixmap,
.getdc = pixmap_getdc,
.releasedc = pixmap_releasedc
};
/*
* Pbuffer drawable
*/
static
HDC pbuffer_getdc(windowsDrawable *d)
{
return wglGetPbufferDCARB(d->hPbuffer);
}
static
void pbuffer_releasedc(windowsDrawable *d, HDC dc)
{
wglReleasePbufferDCARB(d->hPbuffer, dc);
}
static struct windowsdrawable_callbacks pbuffer_callbacks = {
.type = WindowsDRIDrawablePbuffer,
.getdc = pbuffer_getdc,
.releasedc = pbuffer_releasedc
};
/*
*
*/
windowsDrawable *
windows_create_drawable(int type, void *handle)
{
windowsDrawable *d;
d = calloc(1, sizeof *d);
if (d == NULL)
return NULL;
switch (type)
{
case WindowsDRIDrawableWindow:
d->hWnd = handle;
d->callbacks = &window_callbacks;
break;
case WindowsDRIDrawablePixmap:
{
BITMAPINFOHEADER *pBmpHeader;
void *pBits;
char name[MAX_PATH];
d->callbacks = &pixmap_callbacks;
// Access file mapping object by a name
snprintf(name, sizeof(name), "Local\\CYGWINX_WINDOWSDRI_%08lx", (uintptr_t)handle);
d->hSection = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, name);
if (!d->hSection)
printf("OpenFileMapping failed %x\n", GetLastError());
// Create a screen-compatible DC
d->dibDC = CreateCompatibleDC(NULL);
// Map the shared memory section to access the BITMAPINFOHEADER
pBmpHeader = (BITMAPINFOHEADER *)MapViewOfFile(d->hSection, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(BITMAPINFOHEADER));
if (!pBmpHeader)
printf("MapViewOfFile failed %x\n", GetLastError());
// Create a DIB using the file mapping
d->hDIB = CreateDIBSection(d->dibDC, (BITMAPINFO *) pBmpHeader,
DIB_RGB_COLORS, &pBits, d->hSection,
sizeof(BITMAPINFOHEADER));
// Done with the BITMAPINFOHEADER
UnmapViewOfFile(pBmpHeader);
// Select the DIB into the DC
d->hOldDIB = SelectObject(d->dibDC, d->hDIB);
}
break;
case WindowsDRIDrawablePbuffer:
d->hPbuffer = handle;
d->callbacks = &pbuffer_callbacks;
break;
}
return d;
}
void
windows_destroy_drawable(windowsDrawable *drawable)
{
switch (drawable->callbacks->type)
{
case WindowsDRIDrawableWindow:
break;
case WindowsDRIDrawablePixmap:
{
// Select the default DIB into the DC
SelectObject(drawable->dibDC, drawable->hOldDIB);
// delete the screen-compatible DC
DeleteDC(drawable->dibDC);
// Delete the DIB
DeleteObject(drawable->hDIB);
// Close the file mapping object
CloseHandle(drawable->hSection);
}
break;
case WindowsDRIDrawablePbuffer:
break;
}
free(drawable);
}
/*
* Copyright © 2014 Jon Turney
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef WINDOWSDRICONST_H
#define WINDOWSDRICONST_H
/* Requests */
#define X_WindowsDRIQueryVersion 0
#define X_WindowsDRIQueryDirectRenderingCapable 1
#define X_WindowsDRIQueryDrawable 9
#define X_WindowsDRIFBConfigToPixelFormat 10
/* Events */
#define WindowsDRINumberEvents 0
/* Errors */
#define WindowsDRIClientNotLocal 0
#define WindowsDRINumberErrors (WindowsDRIClientNotLocal + 1)
/* Kinds of Drawables */
#define WindowsDRIDrawableWindow 0
#define WindowsDRIDrawablePixmap 1
#define WindowsDRIDrawablePbuffer 2
#endif /* WINDOWSDRICONST_H */
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: windowsdriproto
Description: Windows-DRI extension headers
Version: 1.0.0
Cflags: -I${includedir}
/*
* Copyright © 2014 Jon Turney
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef WINDOWSDRISTR_H
#define WINDOWSDRISTR_H
#include "windowsdriconst.h"
#define WINDOWSDRINAME "Windows-DRI"
#define WINDOWS_DRI_MAJOR_VERSION 1 /* current version numbers */
#define WINDOWS_DRI_MINOR_VERSION 0
#define WINDOWS_DRI_PATCH_VERSION 0
typedef struct _WindowsDRIQueryVersion
{
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIQueryVersion */
CARD16 length B16;
} xWindowsDRIQueryVersionReq;
#define sz_xWindowsDRIQueryVersionReq 4
typedef struct
{
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of DRI protocol */
CARD16 minorVersion B16; /* minor version of DRI protocol */
CARD32 patchVersion B32; /* patch version of DRI protocol */
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xWindowsDRIQueryVersionReply;
#define sz_xWindowsDRIQueryVersionReply 32
typedef struct _WindowsDRIQueryDirectRenderingCapable
{
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
CARD16 length B16;
CARD32 screen B32;
} xWindowsDRIQueryDirectRenderingCapableReq;
#define sz_xWindowsDRIQueryDirectRenderingCapableReq 8
typedef struct
{
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
BOOL isCapable;
BOOL pad2;
BOOL pad3;
BOOL pad4;
CARD32 pad5 B32;
CARD32 pad6 B32;
CARD32 pad7 B32;
CARD32 pad8 B32;
CARD32 pad9 B32;
} xWindowsDRIQueryDirectRenderingCapableReply;
#define sz_xWindowsDRIQueryDirectRenderingCapableReply 32
typedef struct _WindowsDRINotify
{
BYTE type; /* always eventBase + event type */
BYTE kind;
CARD16 sequenceNumber B16;
CARD32 time B32; /* time of change */
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xWindowsDRINotifyEvent;
#define sz_xWindowsDRINotifyEvent 32
typedef struct _WindowsDRIQueryDrawable
{
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIQueryDrawable */
CARD16 length B16;
CARD32 screen B32;
CARD32 drawable B32;
} xWindowsDRIQueryDrawableReq;
#define sz_xWindowsDRIQueryDrawableReq 12
typedef struct
{
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 drawable_type B32;
CARD32 handle B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xWindowsDRIQueryDrawableReply;
#define sz_xWindowsDRIQueryDrawableReply 32
typedef struct _WindowsDRIFBConfigToPixelFormat
{
CARD8 reqType; /* always DRIReqCode */
CARD8 driReqType; /* always X_DRIFBConfigToPixelFormat */
CARD16 length B16;
CARD32 screen B32;
CARD32 fbConfigID B32;
} xWindowsDRIFBConfigToPixelFormatReq;
#define sz_xWindowsDRIFBConfigToPixelFormatReq 12
typedef struct
{
BYTE type; /* X_Reply */
BOOL pad1;
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 pixelFormatIndex B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
CARD32 pad6 B32;
} xWindowsDRIFBConfigToPixelFormatReply;
#define sz_xWindowsDRIFBConfigToPixelFormatReply 32
#endif /* WINDOWSDRISTR_H */
This diff is collapsed.
/*
* Copyright © 2014 Jon Turney
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/