dri: unify __DriverAPIRec

I dropped the comments because they don't add much.
This commit is contained in:
George Sapountzis 2011-11-03 12:46:08 +02:00
parent fc9e80fab9
commit 7192c37294
8 changed files with 29 additions and 49 deletions

View File

@ -701,7 +701,7 @@ dri2_create_buffer(__DRIscreen * sPriv,
* DRI versions differ in their implementation of init_screen and swap_buffers. * DRI versions differ in their implementation of init_screen and swap_buffers.
*/ */
const struct __DriverAPIRec driDriverAPI = { const struct __DriverAPIRec driDriverAPI = {
.InitScreen2 = dri2_init_screen, .InitScreen = dri2_init_screen,
.DestroyScreen = dri_destroy_screen, .DestroyScreen = dri_destroy_screen,
.CreateContext = dri_create_context, .CreateContext = dri_create_context,
.DestroyContext = dri_destroy_context, .DestroyContext = dri_destroy_context,

View File

@ -356,10 +356,9 @@ const struct __DriverAPIRec driDriverAPI = {
.DestroyContext = dri_destroy_context, .DestroyContext = dri_destroy_context,
.CreateBuffer = drisw_create_buffer, .CreateBuffer = drisw_create_buffer,
.DestroyBuffer = dri_destroy_buffer, .DestroyBuffer = dri_destroy_buffer,
.SwapBuffers = drisw_swap_buffers,
.MakeCurrent = dri_make_current, .MakeCurrent = dri_make_current,
.UnbindContext = dri_unbind_context, .UnbindContext = dri_unbind_context,
.SwapBuffers = drisw_swap_buffers,
}; };
/* This is the table of extensions that the loader will dlsym() for. */ /* This is the table of extensions that the loader will dlsym() for. */

View File

@ -21,6 +21,8 @@
#include "main/imports.h" #include "main/imports.h"
#include <drm.h>
#include <xf86drm.h>
#include "dri_util.h" #include "dri_util.h"
#include "utils.h" #include "utils.h"
#include "xmlpool.h" #include "xmlpool.h"
@ -410,9 +412,6 @@ dri2CreateNewScreen(int scrn, int fd,
__DRIscreen *psp; __DRIscreen *psp;
drmVersionPtr version; drmVersionPtr version;
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
psp = calloc(1, sizeof(*psp)); psp = calloc(1, sizeof(*psp));
if (!psp) if (!psp)
return NULL; return NULL;
@ -433,7 +432,7 @@ dri2CreateNewScreen(int scrn, int fd,
psp->DriverAPI = driDriverAPI; psp->DriverAPI = driDriverAPI;
psp->api_mask = (1 << __DRI_API_OPENGL); psp->api_mask = (1 << __DRI_API_OPENGL);
*driver_configs = driDriverAPI.InitScreen2(psp); *driver_configs = driDriverAPI.InitScreen(psp);
if (*driver_configs == NULL) { if (*driver_configs == NULL) {
free(psp); free(psp);
return NULL; return NULL;

View File

@ -48,15 +48,10 @@
#define _DRI_UTIL_H_ #define _DRI_UTIL_H_
#include <GL/gl.h> #include <GL/gl.h>
#include <drm.h> #include <GL/internal/dri_interface.h>
#include <drm_sarea.h>
#include <xf86drm.h>
#include "xmlconfig.h"
#include "main/glheader.h"
#include "main/mtypes.h" #include "main/mtypes.h"
#include "GL/internal/dri_interface.h" #include "xmlconfig.h"
#define GLX_BAD_CONTEXT 5
/** /**
* Extensions. * Extensions.
@ -76,56 +71,37 @@ extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
* this structure. * this structure.
*/ */
struct __DriverAPIRec { struct __DriverAPIRec {
/** const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
* Screen destruction callback
*/
void (*DestroyScreen)(__DRIscreen *driScrnPriv); void (*DestroyScreen)(__DRIscreen *driScrnPriv);
/**
* Context creation callback
*/
GLboolean (*CreateContext)(gl_api api, GLboolean (*CreateContext)(gl_api api,
const struct gl_config *glVis, const struct gl_config *glVis,
__DRIcontext *driContextPriv, __DRIcontext *driContextPriv,
void *sharedContextPrivate); void *sharedContextPrivate);
/**
* Context destruction callback
*/
void (*DestroyContext)(__DRIcontext *driContextPriv); void (*DestroyContext)(__DRIcontext *driContextPriv);
/**
* Buffer (drawable) creation callback
*/
GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv, __DRIdrawable *driDrawPriv,
const struct gl_config *glVis, const struct gl_config *glVis,
GLboolean pixmapBuffer); GLboolean pixmapBuffer);
/**
* Buffer (drawable) destruction callback
*/
void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); void (*DestroyBuffer)(__DRIdrawable *driDrawPriv);
/** void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
* Context activation callback
*/
GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv,
__DRIdrawable *driDrawPriv, __DRIdrawable *driDrawPriv,
__DRIdrawable *driReadPriv); __DRIdrawable *driReadPriv);
/**
* Context unbinding callback
*/
GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
/* DRI2 Entry point */
const __DRIconfig **(*InitScreen2) (__DRIscreen * priv);
__DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
unsigned int attachment, unsigned int attachment,
unsigned int format, unsigned int format,
int width, int height); int width, int height);
void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer); void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
}; };

View File

@ -56,7 +56,7 @@ struct __DriverAPIRec {
void (*DestroyScreen)(__DRIscreen *driScrnPriv); void (*DestroyScreen)(__DRIscreen *driScrnPriv);
GLboolean (*CreateContext)(gl_api glapi, GLboolean (*CreateContext)(gl_api api,
const struct gl_config *glVis, const struct gl_config *glVis,
__DRIcontext *driContextPriv, __DRIcontext *driContextPriv,
void *sharedContextPrivate); void *sharedContextPrivate);
@ -77,6 +77,13 @@ struct __DriverAPIRec {
__DRIdrawable *driReadPriv); __DRIdrawable *driReadPriv);
GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
__DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
unsigned int attachment,
unsigned int format,
int width, int height);
void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
}; };
extern const struct __DriverAPIRec driDriverAPI; extern const struct __DriverAPIRec driDriverAPI;

View File

@ -846,6 +846,7 @@ intelReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
const struct __DriverAPIRec driDriverAPI = { const struct __DriverAPIRec driDriverAPI = {
.InitScreen = intelInitScreen2,
.DestroyScreen = intelDestroyScreen, .DestroyScreen = intelDestroyScreen,
.CreateContext = intelCreateContext, .CreateContext = intelCreateContext,
.DestroyContext = intelDestroyContext, .DestroyContext = intelDestroyContext,
@ -853,7 +854,6 @@ const struct __DriverAPIRec driDriverAPI = {
.DestroyBuffer = intelDestroyBuffer, .DestroyBuffer = intelDestroyBuffer,
.MakeCurrent = intelMakeCurrent, .MakeCurrent = intelMakeCurrent,
.UnbindContext = intelUnbindContext, .UnbindContext = intelUnbindContext,
.InitScreen2 = intelInitScreen2,
.AllocateBuffer = intelAllocateBuffer, .AllocateBuffer = intelAllocateBuffer,
.ReleaseBuffer = intelReleaseBuffer .ReleaseBuffer = intelReleaseBuffer
}; };

View File

@ -241,7 +241,7 @@ static const __DRIextension *nouveau_screen_extensions[] = {
}; };
const struct __DriverAPIRec driDriverAPI = { const struct __DriverAPIRec driDriverAPI = {
.InitScreen2 = nouveau_init_screen2, .InitScreen = nouveau_init_screen2,
.DestroyScreen = nouveau_destroy_screen, .DestroyScreen = nouveau_destroy_screen,
.CreateBuffer = nouveau_create_buffer, .CreateBuffer = nouveau_create_buffer,
.DestroyBuffer = nouveau_destroy_buffer, .DestroyBuffer = nouveau_destroy_buffer,

View File

@ -1354,6 +1354,7 @@ __DRIconfig **radeonInitScreen2(__DRIscreen *psp)
} }
const struct __DriverAPIRec driDriverAPI = { const struct __DriverAPIRec driDriverAPI = {
.InitScreen = radeonInitScreen2,
.DestroyScreen = radeonDestroyScreen, .DestroyScreen = radeonDestroyScreen,
#if defined(RADEON_R200) #if defined(RADEON_R200)
.CreateContext = r200CreateContext, .CreateContext = r200CreateContext,
@ -1366,8 +1367,6 @@ const struct __DriverAPIRec driDriverAPI = {
.DestroyBuffer = radeonDestroyBuffer, .DestroyBuffer = radeonDestroyBuffer,
.MakeCurrent = radeonMakeCurrent, .MakeCurrent = radeonMakeCurrent,
.UnbindContext = radeonUnbindContext, .UnbindContext = radeonUnbindContext,
/* DRI2 */
.InitScreen2 = radeonInitScreen2,
}; };
/* This is the table of extensions that the loader will dlsym() for. */ /* This is the table of extensions that the loader will dlsym() for. */