egl: new eglGetProcAddress() code
The idea is to pass the call down to the device driver where an API-specific query can be made. Untested.
This commit is contained in:
parent
6b9b49127e
commit
e3805cad0d
|
@ -385,12 +385,15 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
|
||||||
return (genericFunc) egl_functions[i].function;
|
return (genericFunc) egl_functions[i].function;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
/* XXX enable this code someday */
|
/* now loop over drivers to query their procs */
|
||||||
return (genericFunc) _glapi_get_proc_address(procname);
|
for (i = 0; i < _eglGlobal.NumDrivers; i++) {
|
||||||
#else
|
_EGLProc p = _eglGlobal.Drivers[i]->API.GetProcAddress(procname);
|
||||||
|
if (p)
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#ifndef EGLAPI_INCLUDED
|
#ifndef EGLAPI_INCLUDED
|
||||||
#define EGLAPI_INCLUDED
|
#define EGLAPI_INCLUDED
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A generic function ptr type
|
||||||
|
*/
|
||||||
|
typedef void (*_EGLProc)();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Typedefs for all EGL API entrypoint functions.
|
* Typedefs for all EGL API entrypoint functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* driver funcs */
|
/* driver funcs */
|
||||||
typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
|
typedef EGLBoolean (*Initialize_t)(_EGLDriver *, EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||||
typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
|
typedef EGLBoolean (*Terminate_t)(_EGLDriver *, EGLDisplay dpy);
|
||||||
|
@ -39,6 +44,9 @@ typedef const char *(*QueryString_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint nam
|
||||||
typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
|
typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
|
||||||
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
||||||
|
|
||||||
|
typedef _EGLProc (*GetProcAddress_t)(const char *procname);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EGL_MESA_screen_surface
|
#ifdef EGL_MESA_screen_surface
|
||||||
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||||
|
@ -95,6 +103,7 @@ struct _egl_api
|
||||||
QueryString_t QueryString;
|
QueryString_t QueryString;
|
||||||
WaitGL_t WaitGL;
|
WaitGL_t WaitGL;
|
||||||
WaitNative_t WaitNative;
|
WaitNative_t WaitNative;
|
||||||
|
GetProcAddress_t GetProcAddress;
|
||||||
|
|
||||||
/* EGL_MESA_screen extension */
|
/* EGL_MESA_screen extension */
|
||||||
ChooseModeMESA_t ChooseModeMESA;
|
ChooseModeMESA_t ChooseModeMESA;
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
const char *DefaultDriverName = ":0";
|
static const char *DefaultDriverName = ":0";
|
||||||
const char *SysFS = "/sys/class";
|
static const char *SysFS = "/sys/class";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +72,9 @@ _eglChooseDRMDriver(int card)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* XXX this function is totally subject change!!!
|
||||||
|
*
|
||||||
|
*
|
||||||
* Determine/return the name of the driver to use for the given _EGLDisplay.
|
* Determine/return the name of the driver to use for the given _EGLDisplay.
|
||||||
*
|
*
|
||||||
* Try to be clever and determine if nativeDisplay is an Xlib Display
|
* Try to be clever and determine if nativeDisplay is an Xlib Display
|
||||||
|
@ -92,6 +95,8 @@ _eglChooseDriver(_EGLDisplay *dpy)
|
||||||
const char *displayString = (const char *) dpy->NativeDisplay;
|
const char *displayString = (const char *) dpy->NativeDisplay;
|
||||||
const char *driverName = NULL;
|
const char *driverName = NULL;
|
||||||
|
|
||||||
|
(void) DefaultDriverName;
|
||||||
|
|
||||||
/* First, if the EGL_DRIVER env var is set, use that */
|
/* First, if the EGL_DRIVER env var is set, use that */
|
||||||
driverName = getenv("EGL_DRIVER");
|
driverName = getenv("EGL_DRIVER");
|
||||||
if (driverName)
|
if (driverName)
|
||||||
|
@ -139,6 +144,8 @@ _eglChooseDriver(_EGLDisplay *dpy)
|
||||||
driverName = _weglChooseDriver(dpy);
|
driverName = _weglChooseDriver(dpy);
|
||||||
#elif defined(_EGL_PLATFORM_WINCE)
|
#elif defined(_EGL_PLATFORM_WINCE)
|
||||||
/* XXX to do */
|
/* XXX to do */
|
||||||
|
#else
|
||||||
|
driverName = DefaultDriverName;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,6 +202,8 @@ _eglOpenDriver(_EGLDisplay *dpy, const char *driverName, const char *args)
|
||||||
/* update the global notion of supported APIs */
|
/* update the global notion of supported APIs */
|
||||||
_eglGlobal.ClientAPIsMask |= drv->ClientAPIsMask;
|
_eglGlobal.ClientAPIsMask |= drv->ClientAPIsMask;
|
||||||
|
|
||||||
|
_eglSaveDriver(drv);
|
||||||
|
|
||||||
return drv;
|
return drv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,6 +226,16 @@ _eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the given driver pointer in the list of all known drivers.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
_eglSaveDriver(_EGLDriver *drv)
|
||||||
|
{
|
||||||
|
_eglGlobal.Drivers[ _eglGlobal.NumDrivers++ ] = drv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a display handle, return the _EGLDriver for that display.
|
* Given a display handle, return the _EGLDriver for that display.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -57,6 +57,10 @@ extern EGLBoolean
|
||||||
_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy);
|
_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy);
|
||||||
|
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_eglSaveDriver(_EGLDriver *drv);
|
||||||
|
|
||||||
|
|
||||||
extern _EGLDriver *
|
extern _EGLDriver *
|
||||||
_eglLookupDriver(EGLDisplay d);
|
_eglLookupDriver(EGLDisplay d);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ struct _egl_global
|
||||||
|
|
||||||
/* XXX temporary - should be thread-specific data (TSD) */
|
/* XXX temporary - should be thread-specific data (TSD) */
|
||||||
_EGLThreadInfo *ThreadInfo;
|
_EGLThreadInfo *ThreadInfo;
|
||||||
|
|
||||||
|
EGLint NumDrivers;
|
||||||
|
_EGLDriver *Drivers[10];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ typedef struct _egl_surface _EGLSurface;
|
||||||
typedef struct _egl_thread_info _EGLThreadInfo;
|
typedef struct _egl_thread_info _EGLThreadInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef void (*_EGLProc)();
|
|
||||||
|
|
||||||
typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy, const char *args);
|
typedef _EGLDriver *(*_EGLMain_t)(_EGLDisplay *dpy, const char *args);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue