DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
/*
|
|
|
|
* Copyright © 2008 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Soft-
|
|
|
|
* ware"), to deal in the Software without restriction, including without
|
|
|
|
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, provided that the above copyright
|
|
|
|
* notice(s) and this permission notice appear in all copies of the Soft-
|
|
|
|
* ware and that both the above copyright notice(s) and this permission
|
|
|
|
* notice appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
|
|
|
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
|
|
|
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
|
|
|
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
|
|
|
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
|
|
|
* MANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of a copyright holder shall
|
|
|
|
* not be used in advertising or otherwise to promote the sale, use or
|
|
|
|
* other dealings in this Software without prior written authorization of
|
|
|
|
* the copyright holder.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Kristian Høgsberg (krh@redhat.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef GLX_DIRECT_RENDERING
|
|
|
|
|
2008-04-23 15:59:23 +01:00
|
|
|
#include <X11/Xlib.h>
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
#include <X11/extensions/Xdamage.h>
|
2009-07-17 08:30:29 +01:00
|
|
|
#include "glapi.h"
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
#include "glxclient.h"
|
2008-04-18 15:28:34 +01:00
|
|
|
#include "glcontextmodes.h"
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
#include "xf86dri.h"
|
|
|
|
#include <dlfcn.h>
|
2008-10-12 01:41:14 +01:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include "xf86drm.h"
|
|
|
|
#include "dri2.h"
|
2008-06-09 15:47:09 +01:00
|
|
|
#include "dri_common.h"
|
2009-11-10 21:28:01 +00:00
|
|
|
#include "../../mesa/drivers/dri/common/dri_util.h"
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-04-21 04:55:56 +01:00
|
|
|
#undef DRI2_MINOR
|
|
|
|
#define DRI2_MINOR 1
|
|
|
|
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
|
|
|
|
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
|
2008-08-13 16:46:25 +01:00
|
|
|
typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
struct __GLXDRIdisplayPrivateRec
|
|
|
|
{
|
|
|
|
__GLXDRIdisplay base;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
/*
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
** XFree86-DRI version information
|
|
|
|
*/
|
2009-08-12 11:41:22 +01:00
|
|
|
int driMajor;
|
|
|
|
int driMinor;
|
|
|
|
int driPatch;
|
2009-07-17 08:30:29 +01:00
|
|
|
int swapAvailable;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
};
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
struct __GLXDRIcontextPrivateRec
|
|
|
|
{
|
|
|
|
__GLXDRIcontext base;
|
|
|
|
__DRIcontext *driContext;
|
|
|
|
__GLXscreenConfigs *psc;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
};
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
struct __GLXDRIdrawablePrivateRec
|
|
|
|
{
|
|
|
|
__GLXDRIdrawable base;
|
|
|
|
__DRIbuffer buffers[5];
|
|
|
|
int bufferCount;
|
|
|
|
int width, height;
|
|
|
|
int have_back;
|
|
|
|
int have_fake_front;
|
2009-11-10 21:28:01 +00:00
|
|
|
int swap_interval;
|
2008-08-13 16:46:25 +01:00
|
|
|
};
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void dri2WaitX(__GLXDRIdrawable * pdraw);
|
2009-06-23 00:33:29 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2DestroyContext(__GLXDRIcontext * context,
|
|
|
|
__GLXscreenConfigs * psc, Display * dpy)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
|
|
|
const __DRIcoreExtension *core = pcp->psc->core;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
(*core->destroyContext) (pcp->driContext);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(pcp);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static Bool
|
|
|
|
dri2BindContext(__GLXDRIcontext * context,
|
|
|
|
__GLXDRIdrawable * draw, __GLXDRIdrawable * read)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
|
|
|
const __DRIcoreExtension *core = pcp->psc->core;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
return (*core->bindContext) (pcp->driContext,
|
|
|
|
draw->driDrawable, read->driDrawable);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2UnbindContext(__GLXDRIcontext * context)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
|
|
|
const __DRIcoreExtension *core = pcp->psc->core;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
(*core->unbindContext) (pcp->driContext);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static __GLXDRIcontext *
|
|
|
|
dri2CreateContext(__GLXscreenConfigs * psc,
|
|
|
|
const __GLcontextModes * mode,
|
|
|
|
GLXContext gc, GLXContext shareList, int renderType)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIcontextPrivate *pcp, *pcp_shared;
|
|
|
|
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
|
|
|
|
__DRIcontext *shared = NULL;
|
|
|
|
|
|
|
|
if (shareList) {
|
|
|
|
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
|
|
|
|
shared = pcp_shared->driContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
pcp = Xmalloc(sizeof *pcp);
|
|
|
|
if (pcp == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pcp->psc = psc;
|
|
|
|
pcp->driContext =
|
|
|
|
(*psc->dri2->createNewContext) (psc->__driScreen,
|
|
|
|
config->driConfig, shared, pcp);
|
|
|
|
gc->__driContext = pcp->driContext;
|
|
|
|
|
|
|
|
if (pcp->driContext == NULL) {
|
|
|
|
Xfree(pcp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pcp->base.destroyContext = dri2DestroyContext;
|
|
|
|
pcp->base.bindContext = dri2BindContext;
|
|
|
|
pcp->base.unbindContext = dri2UnbindContext;
|
|
|
|
|
|
|
|
return &pcp->base;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2DestroyDrawable(__GLXDRIdrawable * pdraw)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
const __DRIcoreExtension *core = pdraw->psc->core;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
(*core->destroyDrawable) (pdraw->driDrawable);
|
2009-08-22 00:33:37 +01:00
|
|
|
DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->xDrawable);
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(pdraw);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static __GLXDRIdrawable *
|
|
|
|
dri2CreateDrawable(__GLXscreenConfigs * psc,
|
|
|
|
XID xDrawable,
|
|
|
|
GLXDrawable drawable, const __GLcontextModes * modes)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdrawablePrivate *pdraw;
|
|
|
|
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdraw = Xmalloc(sizeof(*pdraw));
|
|
|
|
if (!pdraw)
|
|
|
|
return NULL;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdraw->base.destroyDrawable = dri2DestroyDrawable;
|
|
|
|
pdraw->base.xDrawable = xDrawable;
|
|
|
|
pdraw->base.drawable = drawable;
|
|
|
|
pdraw->base.psc = psc;
|
|
|
|
pdraw->bufferCount = 0;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
DRI2CreateDrawable(psc->dpy, xDrawable);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
/* Create a new drawable */
|
|
|
|
pdraw->base.driDrawable =
|
|
|
|
(*psc->dri2->createNewDrawable) (psc->__driScreen,
|
|
|
|
config->driConfig, pdraw);
|
2008-08-13 16:46:25 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
if (!pdraw->base.driDrawable) {
|
2009-08-22 00:33:37 +01:00
|
|
|
DRI2DestroyDrawable(psc->dpy, xDrawable);
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(pdraw);
|
|
|
|
return NULL;
|
|
|
|
}
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
return &pdraw->base;
|
2008-08-13 16:46:25 +01:00
|
|
|
}
|
|
|
|
|
2009-09-16 07:23:09 +01:00
|
|
|
static int
|
|
|
|
dri2DrawableGetMSC(__GLXscreenConfigs *psc, __GLXDRIdrawable *pdraw,
|
|
|
|
int64_t *ust, int64_t *msc, int64_t *sbc)
|
|
|
|
{
|
|
|
|
return DRI2GetMSC(psc->dpy, pdraw->drawable, ust, msc, sbc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
dri2WaitForMSC(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
|
|
|
int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc)
|
|
|
|
{
|
|
|
|
return DRI2WaitMSC(pdraw->psc->dpy, pdraw->drawable, target_msc, divisor,
|
|
|
|
remainder, ust, msc, sbc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
dri2WaitForSBC(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
|
|
|
|
int64_t *msc, int64_t *sbc)
|
|
|
|
{
|
|
|
|
return DRI2WaitSBC(pdraw->psc->dpy, pdraw->drawable, target_sbc, ust, msc,
|
|
|
|
sbc);
|
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
2009-09-16 07:23:09 +01:00
|
|
|
dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
|
2008-10-12 01:41:14 +01:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
|
|
|
XRectangle xrect;
|
|
|
|
XserverRegion region;
|
2008-10-12 01:41:14 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
/* Check we have the right attachments */
|
|
|
|
if (!priv->have_back)
|
|
|
|
return;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
xrect.x = x;
|
|
|
|
xrect.y = priv->height - y - height;
|
|
|
|
xrect.width = width;
|
|
|
|
xrect.height = height;
|
2008-10-12 01:41:14 +01:00
|
|
|
|
2009-02-19 18:39:08 +00:00
|
|
|
#ifdef __DRI2_FLUSH
|
2009-08-12 11:41:22 +01:00
|
|
|
if (pdraw->psc->f)
|
|
|
|
(*pdraw->psc->f->flush) (pdraw->driDrawable);
|
2009-02-19 18:39:08 +00:00
|
|
|
#endif
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
|
|
|
/* should get a fence ID back from here at some point */
|
2009-08-22 00:33:37 +01:00
|
|
|
DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
|
2009-08-12 11:41:22 +01:00
|
|
|
DRI2BufferFrontLeft, DRI2BufferBackLeft);
|
|
|
|
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
2009-06-23 00:33:29 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
/* Refresh the fake front (if present) after we just damaged the real
|
|
|
|
* front.
|
|
|
|
*/
|
|
|
|
dri2WaitX(pdraw);
|
2008-10-12 01:41:14 +01:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
2009-07-17 08:30:29 +01:00
|
|
|
dri2WaitX(__GLXDRIdrawable *pdraw)
|
2009-02-16 11:44:40 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
|
|
|
XRectangle xrect;
|
|
|
|
XserverRegion region;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
/* Check we have the right attachments */
|
|
|
|
if (!priv->have_fake_front)
|
|
|
|
return;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
xrect.x = 0;
|
|
|
|
xrect.y = 0;
|
|
|
|
xrect.width = priv->width;
|
|
|
|
xrect.height = priv->height;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-02-19 18:39:08 +00:00
|
|
|
#ifdef __DRI2_FLUSH
|
2009-08-12 11:41:22 +01:00
|
|
|
if (pdraw->psc->f)
|
|
|
|
(*pdraw->psc->f->flush) (pdraw->driDrawable);
|
2009-02-19 18:39:08 +00:00
|
|
|
#endif
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
2009-08-22 00:33:37 +01:00
|
|
|
DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
|
2009-08-12 11:41:22 +01:00
|
|
|
DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
|
|
|
|
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
2009-02-16 11:44:40 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2WaitGL(__GLXDRIdrawable * pdraw)
|
2009-02-16 11:44:40 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
|
|
|
XRectangle xrect;
|
|
|
|
XserverRegion region;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
if (!priv->have_fake_front)
|
|
|
|
return;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
xrect.x = 0;
|
|
|
|
xrect.y = 0;
|
|
|
|
xrect.width = priv->width;
|
|
|
|
xrect.height = priv->height;
|
2009-02-16 11:44:40 +00:00
|
|
|
|
2009-02-19 18:39:08 +00:00
|
|
|
#ifdef __DRI2_FLUSH
|
2009-08-12 11:41:22 +01:00
|
|
|
if (pdraw->psc->f)
|
|
|
|
(*pdraw->psc->f->flush) (pdraw->driDrawable);
|
2009-02-19 18:39:08 +00:00
|
|
|
#endif
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
2009-08-22 00:33:37 +01:00
|
|
|
DRI2CopyRegion(pdraw->psc->dpy, pdraw->xDrawable, region,
|
2009-08-12 11:41:22 +01:00
|
|
|
DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
|
|
|
|
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
2009-02-16 11:44:40 +00:00
|
|
|
}
|
|
|
|
|
2009-04-06 20:44:18 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
|
2009-04-06 20:44:18 +01:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
(void) driDrawable;
|
|
|
|
dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
|
2009-04-06 20:44:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2DestroyScreen(__GLXscreenConfigs * psc)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
/* Free the direct rendering per screen data */
|
|
|
|
(*psc->core->destroyScreen) (psc->__driScreen);
|
|
|
|
close(psc->fd);
|
|
|
|
psc->__driScreen = NULL;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-04-21 04:55:56 +01:00
|
|
|
/**
|
|
|
|
* Process list of buffer received from the server
|
|
|
|
*
|
|
|
|
* Processes the list of buffers received in a reply from the server to either
|
|
|
|
* \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat.
|
|
|
|
*/
|
|
|
|
static void
|
2009-08-12 11:41:22 +01:00
|
|
|
process_buffers(__GLXDRIdrawablePrivate * pdraw, DRI2Buffer * buffers,
|
|
|
|
unsigned count)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
pdraw->bufferCount = count;
|
|
|
|
pdraw->have_fake_front = 0;
|
|
|
|
pdraw->have_back = 0;
|
|
|
|
|
|
|
|
/* This assumes the DRI2 buffer attachment tokens matches the
|
|
|
|
* __DRIbuffer tokens. */
|
|
|
|
for (i = 0; i < count; i++) {
|
|
|
|
pdraw->buffers[i].attachment = buffers[i].attachment;
|
|
|
|
pdraw->buffers[i].name = buffers[i].name;
|
|
|
|
pdraw->buffers[i].pitch = buffers[i].pitch;
|
|
|
|
pdraw->buffers[i].cpp = buffers[i].cpp;
|
|
|
|
pdraw->buffers[i].flags = buffers[i].flags;
|
|
|
|
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
|
|
|
|
pdraw->have_fake_front = 1;
|
|
|
|
if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
|
|
|
|
pdraw->have_back = 1;
|
|
|
|
}
|
2008-10-15 04:07:42 +01:00
|
|
|
|
2009-04-21 04:55:56 +01:00
|
|
|
}
|
|
|
|
|
2009-09-16 07:23:09 +01:00
|
|
|
static int64_t
|
|
|
|
dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
|
|
|
|
int64_t remainder)
|
2009-07-17 08:30:29 +01:00
|
|
|
{
|
|
|
|
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
|
|
|
__GLXdisplayPrivate *dpyPriv = __glXInitialize(priv->base.psc->dpy);
|
|
|
|
__GLXDRIdisplayPrivate *pdp =
|
|
|
|
(__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
|
2009-09-16 07:23:09 +01:00
|
|
|
int64_t ret;
|
2009-07-17 08:30:29 +01:00
|
|
|
|
|
|
|
#ifdef __DRI2_FLUSH
|
|
|
|
if (pdraw->psc->f)
|
|
|
|
(*pdraw->psc->f->flush)(pdraw->driDrawable);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Old servers can't handle swapbuffers */
|
2009-09-16 07:23:09 +01:00
|
|
|
if (!pdp->swapAvailable) {
|
|
|
|
dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
|
|
|
|
return 0;
|
|
|
|
}
|
2009-07-17 08:30:29 +01:00
|
|
|
|
2009-09-16 07:23:09 +01:00
|
|
|
DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable, target_msc, divisor,
|
|
|
|
remainder, &ret);
|
2009-07-17 08:30:29 +01:00
|
|
|
|
|
|
|
#if __DRI2_FLUSH_VERSION >= 2
|
|
|
|
if (pdraw->psc->f)
|
|
|
|
(*pdraw->psc->f->flushInvalidate)(pdraw->driDrawable);
|
|
|
|
#endif
|
2009-09-16 07:23:09 +01:00
|
|
|
|
|
|
|
return ret;
|
2009-07-17 08:30:29 +01:00
|
|
|
}
|
|
|
|
|
2009-04-21 04:55:56 +01:00
|
|
|
static __DRIbuffer *
|
2009-08-12 11:41:22 +01:00
|
|
|
dri2GetBuffers(__DRIdrawable * driDrawable,
|
|
|
|
int *width, int *height,
|
|
|
|
unsigned int *attachments, int count,
|
|
|
|
int *out_count, void *loaderPrivate)
|
2009-04-21 04:55:56 +01:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
|
|
|
DRI2Buffer *buffers;
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
|
|
|
|
width, height, attachments, count, out_count);
|
|
|
|
if (buffers == NULL)
|
|
|
|
return NULL;
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdraw->width = *width;
|
|
|
|
pdraw->height = *height;
|
|
|
|
process_buffers(pdraw, buffers, *out_count);
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(buffers);
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
return pdraw->buffers;
|
2009-04-21 04:55:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static __DRIbuffer *
|
2009-08-12 11:41:22 +01:00
|
|
|
dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
|
|
|
|
int *width, int *height,
|
|
|
|
unsigned int *attachments, int count,
|
|
|
|
int *out_count, void *loaderPrivate)
|
2009-04-21 04:55:56 +01:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
|
|
|
DRI2Buffer *buffers;
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy,
|
|
|
|
pdraw->base.xDrawable,
|
|
|
|
width, height, attachments,
|
|
|
|
count, out_count);
|
|
|
|
if (buffers == NULL)
|
|
|
|
return NULL;
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdraw->width = *width;
|
|
|
|
pdraw->height = *height;
|
|
|
|
process_buffers(pdraw, buffers, *out_count);
|
2009-04-21 04:55:56 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(buffers);
|
2008-10-15 04:07:42 +01:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
return pdraw->buffers;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-11-10 21:28:01 +00:00
|
|
|
static void
|
|
|
|
dri2SetSwapInterval(__GLXDRIdrawable *pdraw, int interval)
|
|
|
|
{
|
|
|
|
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
|
|
|
|
|
|
|
DRI2SwapInterval(priv->base.psc->dpy, pdraw->xDrawable, interval);
|
|
|
|
priv->swap_interval = interval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned int
|
|
|
|
dri2GetSwapInterval(__GLXDRIdrawable *pdraw)
|
|
|
|
{
|
|
|
|
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
|
|
|
|
|
|
|
return priv->swap_interval;
|
|
|
|
}
|
|
|
|
|
2008-08-13 16:46:25 +01:00
|
|
|
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
|
2009-08-12 11:41:22 +01:00
|
|
|
{__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
|
|
|
|
dri2GetBuffers,
|
|
|
|
dri2FlushFrontBuffer,
|
|
|
|
dri2GetBuffersWithFormat,
|
2009-04-21 04:55:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
|
2009-08-12 11:41:22 +01:00
|
|
|
{__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
|
|
|
|
dri2GetBuffers,
|
|
|
|
dri2FlushFrontBuffer,
|
|
|
|
NULL,
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const __DRIextension *loader_extensions[] = {
|
2009-08-12 11:41:22 +01:00
|
|
|
&dri2LoaderExtension.base,
|
|
|
|
&systemTimeExtension.base,
|
|
|
|
NULL
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
};
|
|
|
|
|
2009-04-21 04:55:56 +01:00
|
|
|
static const __DRIextension *loader_extensions_old[] = {
|
2009-08-12 11:41:22 +01:00
|
|
|
&dri2LoaderExtension_old.base,
|
|
|
|
&systemTimeExtension.base,
|
|
|
|
NULL
|
2009-04-21 04:55:56 +01:00
|
|
|
};
|
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
static __GLXDRIscreen *
|
|
|
|
dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
|
|
|
__GLXdisplayPrivate * priv)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
const __DRIconfig **driver_configs;
|
|
|
|
const __DRIextension **extensions;
|
|
|
|
const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *)
|
2009-04-21 04:55:56 +01:00
|
|
|
priv->dri2Display;
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIscreen *psp;
|
|
|
|
char *driverName, *deviceName;
|
|
|
|
drm_magic_t magic;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
psp = Xmalloc(sizeof *psp);
|
|
|
|
if (psp == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* Initialize per screen dynamic client GLX extensions */
|
|
|
|
psc->ext_list_first_time = GL_TRUE;
|
|
|
|
|
|
|
|
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
|
2009-09-16 07:23:09 +01:00
|
|
|
&driverName, &deviceName))
|
2009-08-12 11:41:22 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
psc->driver = driOpenDriver(driverName);
|
|
|
|
if (psc->driver == NULL) {
|
|
|
|
ErrorMessageF("driver pointer missing\n");
|
|
|
|
goto handle_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
|
|
|
|
if (extensions == NULL) {
|
|
|
|
ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
|
|
|
|
goto handle_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; extensions[i]; i++) {
|
|
|
|
if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
|
2009-09-16 07:23:09 +01:00
|
|
|
psc->core = (__DRIcoreExtension *) extensions[i];
|
2009-08-12 11:41:22 +01:00
|
|
|
if (strcmp(extensions[i]->name, __DRI_DRI2) == 0)
|
2009-09-16 07:23:09 +01:00
|
|
|
psc->dri2 = (__DRIdri2Extension *) extensions[i];
|
2009-08-12 11:41:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (psc->core == NULL || psc->dri2 == NULL) {
|
|
|
|
ErrorMessageF("core dri or dri2 extension not found\n");
|
|
|
|
goto handle_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
psc->fd = open(deviceName, O_RDWR);
|
|
|
|
if (psc->fd < 0) {
|
|
|
|
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drmGetMagic(psc->fd, &magic)) {
|
|
|
|
ErrorMessageF("failed to get magic\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
|
|
|
|
ErrorMessageF("failed to authenticate magic %d\n", magic);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the server does not support the protocol for
|
|
|
|
* DRI2GetBuffersWithFormat, don't supply that interface to the driver.
|
|
|
|
*/
|
|
|
|
psc->__driScreen =
|
|
|
|
psc->dri2->createNewScreen(screen, psc->fd, ((pdp->driMinor < 1)
|
2009-09-16 07:23:09 +01:00
|
|
|
? loader_extensions_old
|
|
|
|
: loader_extensions),
|
|
|
|
&driver_configs, psc);
|
2009-08-12 11:41:22 +01:00
|
|
|
|
|
|
|
if (psc->__driScreen == NULL) {
|
|
|
|
ErrorMessageF("failed to create dri screen\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-09-16 07:23:09 +01:00
|
|
|
driBindCommonExtensions(psc);
|
|
|
|
dri2BindExtensions(psc);
|
2009-08-12 11:41:22 +01:00
|
|
|
|
|
|
|
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
|
|
|
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
|
|
|
|
|
|
|
psc->driver_configs = driver_configs;
|
|
|
|
|
|
|
|
psp->destroyScreen = dri2DestroyScreen;
|
|
|
|
psp->createContext = dri2CreateContext;
|
|
|
|
psp->createDrawable = dri2CreateDrawable;
|
|
|
|
psp->swapBuffers = dri2SwapBuffers;
|
|
|
|
psp->waitGL = dri2WaitGL;
|
|
|
|
psp->waitX = dri2WaitX;
|
2009-09-16 07:23:09 +01:00
|
|
|
psp->getDrawableMSC = dri2DrawableGetMSC;
|
|
|
|
psp->waitForMSC = dri2WaitForMSC;
|
|
|
|
psp->waitForSBC = dri2WaitForSBC;
|
2009-11-10 21:28:01 +00:00
|
|
|
psp->setSwapInterval = dri2SetSwapInterval;
|
|
|
|
psp->getSwapInterval = dri2GetSwapInterval;
|
2009-08-12 11:41:22 +01:00
|
|
|
|
|
|
|
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
|
|
|
|
* available.*/
|
|
|
|
psp->copySubBuffer = dri2CopySubBuffer;
|
|
|
|
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
|
|
|
|
|
|
|
|
Xfree(driverName);
|
|
|
|
Xfree(deviceName);
|
|
|
|
|
|
|
|
return psp;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-09-16 07:23:09 +01:00
|
|
|
handle_error:
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(driverName);
|
|
|
|
Xfree(deviceName);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
/* FIXME: clean up here */
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
return NULL;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Called from __glXFreeDisplayPrivate.
|
|
|
|
*/
|
2009-08-12 11:41:22 +01:00
|
|
|
static void
|
|
|
|
dri2DestroyDisplay(__GLXDRIdisplay * dpy)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
Xfree(dpy);
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate, initialize and return a __DRIdisplayPrivate object.
|
|
|
|
* This is called from __glXInitialize() when we are given a new
|
|
|
|
* display pointer.
|
|
|
|
*/
|
2009-08-12 11:41:22 +01:00
|
|
|
_X_HIDDEN __GLXDRIdisplay *
|
|
|
|
dri2CreateDisplay(Display * dpy)
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
{
|
2009-08-12 11:41:22 +01:00
|
|
|
__GLXDRIdisplayPrivate *pdp;
|
|
|
|
int eventBase, errorBase;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
|
|
|
|
return NULL;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdp = Xmalloc(sizeof *pdp);
|
|
|
|
if (pdp == NULL)
|
|
|
|
return NULL;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) {
|
|
|
|
Xfree(pdp);
|
|
|
|
return NULL;
|
|
|
|
}
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdp->driPatch = 0;
|
2009-07-17 08:30:29 +01:00
|
|
|
pdp->swapAvailable = 0;
|
|
|
|
if (pdp->driMinor >= 2)
|
|
|
|
pdp->swapAvailable = 1;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
pdp->base.destroyDisplay = dri2DestroyDisplay;
|
|
|
|
pdp->base.createScreen = dri2CreateScreen;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
|
2009-08-12 11:41:22 +01:00
|
|
|
return &pdp->base;
|
DRI interface changes and DRI2 direct rendering support.
Add DRI2 direct rendering support to libGL and add DRI2 client side
protocol code. Extend the GLX 1.3 create drawable functions in
glx_pbuffer.c to call into the DRI driver when possible.
Introduce __DRIconfig, opaque struct that represents a DRI driver
configuration. Get's rid of the open coded __GLcontextModes in the
DRI driver interface and the context modes create and destroy
functions that the loader was requires to provide. glcore.h is no
longer part of the DRI driver interface. The DRI config is GL binding
agnostic, that is, not specific to GLX, EGL or other bindings.
The core API is now also an extension, and the driver exports a list
of extensions as the symbol __driDriverExtensions, which the loader
must dlsym() for. The list of extension will always include the DRI
core extension, which allows creating and manipulating DRI screens,
drawables and contexts. The DRI legacy extension, when available,
provides alternative entry points for creating the DRI objects that
work with the XF86DRI infrastructure.
Change DRI2 client code to not use drm drawables or contexts. We
never used drm_drawable_t's and the only use for drm_context_t was as
a unique identifier when taking the lock. We now just allocate a
unique lock ID out of the DRILock sarea block. Once we get rid of the
lock entirely, we can drop this hack.
Change the interface between dri_util.c and the drivers, so that the
drivers now export the DriverAPI struct as driDriverAPI instead of the
InitScreen entry point. This lets us avoid dlsym()'ing for the DRI2
init screen function to see if DRI2 is supported by the driver.
2008-03-26 23:26:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GLX_DIRECT_RENDERING */
|