egldriver.c revision 6052af172f0241e6678cd16efac0a0f14f40146c
16052af172f0241e6678cd16efac0a0f14f40146cBrian Paul/**
26052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * Functions for choosing and opening/loading device drivers.
36052af172f0241e6678cd16efac0a0f14f40146cBrian Paul */
46052af172f0241e6678cd16efac0a0f14f40146cBrian Paul
56052af172f0241e6678cd16efac0a0f14f40146cBrian Paul
6adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include <assert.h>
7adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include <dlfcn.h>
8adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include <stdio.h>
9adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include <string.h>
10adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "eglconfig.h"
11adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "eglcontext.h"
12adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "egldisplay.h"
13adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "egldriver.h"
14adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "eglglobals.h"
15b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul#include "egllog.h"
16adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "eglmode.h"
17c22990c29a5cdff89e6e3914aa565acc88a6a407Brian Paul#include "eglscreen.h"
18adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul#include "eglsurface.h"
196052af172f0241e6678cd16efac0a0f14f40146cBrian Paul#include "eglx.h"
20adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
21adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
227012d01d888d482f2c6ad1180231a482026d213aJon Smirlconst char *DefaultDriverName = "demodriver";
23adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
24adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
25adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul/**
266052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * Determine/return the name of the driver to use for the given _EGLDisplay.
27adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul *
286052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * Try to be clever and determine if nativeDisplay is an Xlib Display
296052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * ptr or a string (naming a driver or screen number, etc).
30adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul *
31adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * If the first character is ':' we interpret it as a screen or card index
32adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * number (i.e. ":0" or ":1", etc)
33adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * Else if the first character is '!' we interpret it as specific driver name
34adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * (i.e. "!r200" or "!i830".
356052af172f0241e6678cd16efac0a0f14f40146cBrian Paul *
366052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * The caller should make a copy of the returned string.
37adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul */
386052af172f0241e6678cd16efac0a0f14f40146cBrian Paulconst char *
396052af172f0241e6678cd16efac0a0f14f40146cBrian Paul_eglChooseDriver(_EGLDisplay *dpy)
40adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
416052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   const char *name = (const char *) dpy->NativeDisplay;
426052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   const char *driverName = NULL;
43adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
446052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   if (!dpy->NativeDisplay) {
456052af172f0241e6678cd16efac0a0f14f40146cBrian Paul      /* choose a default */
466052af172f0241e6678cd16efac0a0f14f40146cBrian Paul      driverName = DefaultDriverName;
47adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
486052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   else if (name && name[0] == ':' &&
496052af172f0241e6678cd16efac0a0f14f40146cBrian Paul            (name[1] >= '0' && name[1] <= '9') && !name[2]) {
50adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      /* XXX probe hardware here to determine which driver to open */
51485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      driverName = "libEGLdri";
52adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
536052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   else if (name && name[0] == '!') {
54adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      /* use specified driver name */
55adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      driverName = name + 1;
56adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
57adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   else {
586052af172f0241e6678cd16efac0a0f14f40146cBrian Paul#if defined(_EGL_PLATFORM_X)
596052af172f0241e6678cd16efac0a0f14f40146cBrian Paul      driverName = _xeglChooseDriver(dpy);
606052af172f0241e6678cd16efac0a0f14f40146cBrian Paul#elif defined(_EGL_PLATFORM_WINDOWS)
616052af172f0241e6678cd16efac0a0f14f40146cBrian Paul      /* XXX to do */
626052af172f0241e6678cd16efac0a0f14f40146cBrian Paul      driverName = _weglChooseDriver(dpy);
636052af172f0241e6678cd16efac0a0f14f40146cBrian Paul#elif defined(_EGL_PLATFORM_WINCE)
646052af172f0241e6678cd16efac0a0f14f40146cBrian Paul      /* XXX to do */
656052af172f0241e6678cd16efac0a0f14f40146cBrian Paul#endif
66adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
67adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
686052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   return driverName;
69adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
70adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
71adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
72adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul/**
73adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * Open/load the named driver and call its bootstrap function: _eglMain().
746052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * By the time this function is called, the dpy->DriverName should have
756052af172f0241e6678cd16efac0a0f14f40146cBrian Paul * been determined.
766052af172f0241e6678cd16efac0a0f14f40146cBrian Paul *
77adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * \return  new _EGLDriver object.
78adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul */
79adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_EGLDriver *
80adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglOpenDriver(_EGLDisplay *dpy, const char *driverName)
81adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
82485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   _EGLDriver *drv;
83485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   _EGLMain_t mainFunc;
84adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   void *lib;
85adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   char driverFilename[1000];
86adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
876052af172f0241e6678cd16efac0a0f14f40146cBrian Paul   assert(driverName);
886052af172f0241e6678cd16efac0a0f14f40146cBrian Paul
89adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   /* XXX also prepend a directory path??? */
907012d01d888d482f2c6ad1180231a482026d213aJon Smirl   sprintf(driverFilename, "%s.so", driverName);
91adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
92b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul   _eglLog(_EGL_DEBUG, "dlopen(%s)", driverFilename);
93adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   lib = dlopen(driverFilename, RTLD_NOW);
94485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   if (!lib) {
95b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul      _eglLog(_EGL_WARNING, "Could not open %s (%s)",
96b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul              driverFilename, dlerror());
97485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      return NULL;
98485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   }
99adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
100485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
101485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   if (!mainFunc) {
102b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul      _eglLog(_EGL_WARNING, "_eglMain not found in %s", driverFilename);
103485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      dlclose(lib);
104485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      return NULL;
105adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
106485528f2acb69940a7c757638127f716c0cb2654Jon Smirl
107485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   drv = mainFunc(dpy);
108485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   if (!drv) {
109485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      dlclose(lib);
110adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      return NULL;
111adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
112485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   /* with a recurvise open you want the inner most handle */
113485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   if (!drv->LibHandle)
114485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      drv->LibHandle = lib;
115485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   else
116485528f2acb69940a7c757638127f716c0cb2654Jon Smirl      dlclose(lib);
117485528f2acb69940a7c757638127f716c0cb2654Jon Smirl
118485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   drv->Display = dpy;
119485528f2acb69940a7c757638127f716c0cb2654Jon Smirl   return drv;
120adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
121adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
122adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
123adbff7e977c7c768e752a24fb643d68bdf961bfeBrian PaulEGLBoolean
124adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglCloseDriver(_EGLDriver *drv, EGLDisplay dpy)
125adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
126adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   void *handle = drv->LibHandle;
127adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   EGLBoolean b;
128b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul
129b711eb793b68bb0c4561e5e345b76453dfac286bBrian Paul   _eglLog(_EGL_INFO, "Closing driver");
130adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
131adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   /*
132adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul    * XXX check for currently bound context/surfaces and delete them?
133adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul    */
134adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
135daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   b = drv->API.Terminate(drv, dpy);
136adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   dlclose(handle);
137adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   return b;
138adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
139adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
140adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
141adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul/**
142adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * Given a display handle, return the _EGLDriver for that display.
143adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul */
144adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_EGLDriver *
145adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglLookupDriver(EGLDisplay dpy)
146adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
147adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   _EGLDisplay *d = _eglLookupDisplay(dpy);
148adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   if (d)
149adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      return d->Driver;
150adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   else
151adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      return NULL;
152adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
153adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
154adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
155adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul/**
156adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * Plug all the available fallback routines into the given driver's
157adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul * dispatch table.
158adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul */
159adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paulvoid
160adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglInitDriverFallbacks(_EGLDriver *drv)
161adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
162adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   /* If a pointer is set to NULL, then the device driver _really_ has
163adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul    * to implement it.
164adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul    */
165daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.Initialize = NULL;
166daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.Terminate = NULL;
167daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul
168daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.GetConfigs = _eglGetConfigs;
169daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.ChooseConfig = _eglChooseConfig;
170daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.GetConfigAttrib = _eglGetConfigAttrib;
171daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul
172daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.CreateContext = _eglCreateContext;
173daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.DestroyContext = _eglDestroyContext;
174daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.MakeCurrent = _eglMakeCurrent;
175daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QueryContext = _eglQueryContext;
176daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul
177daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.CreateWindowSurface = _eglCreateWindowSurface;
178daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.CreatePixmapSurface = _eglCreatePixmapSurface;
179daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.CreatePbufferSurface = _eglCreatePbufferSurface;
180daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.DestroySurface = _eglDestroySurface;
181daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QuerySurface = _eglQuerySurface;
182daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.SurfaceAttrib = _eglSurfaceAttrib;
183daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.BindTexImage = _eglBindTexImage;
184daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.ReleaseTexImage = _eglReleaseTexImage;
185daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.SwapInterval = _eglSwapInterval;
186daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.SwapBuffers = _eglSwapBuffers;
187daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.CopyBuffers = _eglCopyBuffers;
188daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul
189daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QueryString = _eglQueryString;
190daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.WaitGL = _eglWaitGL;
191daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.WaitNative = _eglWaitNative;
192adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
193b2006a40eb22899d38cd31691640555228e36975Brian Paul#ifdef EGL_MESA_screen_surface
194daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.ChooseModeMESA = _eglChooseModeMESA;
195daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.GetModesMESA = _eglGetModesMESA;
196daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
197daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.GetScreensMESA = _eglGetScreensMESA;
198daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.CreateScreenSurfaceMESA = _eglCreateScreenSurfaceMESA;
19948822796339cb4a55714dc3f1abbe379562ec538Brian Paul   drv->API.ShowScreenSurfaceMESA = _eglShowScreenSurfaceMESA;
200daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
201daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QueryScreenMESA = _eglQueryScreenMESA;
202daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
203daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
204daf585d0f00df1d4d2e8dc5b465dad60a4bf0122Brian Paul   drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
205b2006a40eb22899d38cd31691640555228e36975Brian Paul#endif /* EGL_MESA_screen_surface */
206b2006a40eb22899d38cd31691640555228e36975Brian Paul
207b2006a40eb22899d38cd31691640555228e36975Brian Paul#ifdef EGL_VERSION_1_2
208b2006a40eb22899d38cd31691640555228e36975Brian Paul   drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
209b2006a40eb22899d38cd31691640555228e36975Brian Paul#endif /* EGL_VERSION_1_2 */
210adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
211adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
212adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
21351ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul/**
21451ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul * Examine the individual extension enable/disable flags and recompute
21551ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul * the driver's Extensions string.
21651ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul */
21751ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paulstatic void
2185285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul_eglUpdateExtensionsString(_EGLDriver *drv)
21951ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul{
2205285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul   drv->Extensions.String[0] = 0;
22151ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul
2225285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul   if (drv->Extensions.MESA_screen_surface)
2235285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul      strcat(drv->Extensions.String, "EGL_MESA_screen_surface ");
2245285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul   if (drv->Extensions.MESA_copy_context)
2255285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul      strcat(drv->Extensions.String, "EGL_MESA_copy_context ");
2265285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul   assert(strlen(drv->Extensions.String) < MAX_EXTENSIONS_LEN);
22751ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul}
22851ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul
22951ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul
23051ac95ba8945711cf65e94a2deba6c896dea5f0eBrian Paul
231adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paulconst char *
232adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
233adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
234adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   (void) drv;
235adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   (void) dpy;
236adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   switch (name) {
237adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   case EGL_VENDOR:
238adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      return "Mesa Project";
239adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   case EGL_VERSION:
240adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      return "1.0";
241adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   case EGL_EXTENSIONS:
2425285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul      _eglUpdateExtensionsString(drv);
2435285c32a17a8ec260dcb5d412d862e50bced0ce9Brian Paul      return drv->Extensions.String;
244b2006a40eb22899d38cd31691640555228e36975Brian Paul#ifdef EGL_VERSION_1_2
245b2006a40eb22899d38cd31691640555228e36975Brian Paul   case EGL_CLIENT_APIS:
246b2006a40eb22899d38cd31691640555228e36975Brian Paul      /* XXX need to initialize somewhere */
247b2006a40eb22899d38cd31691640555228e36975Brian Paul      return drv->ClientAPIs;
248b2006a40eb22899d38cd31691640555228e36975Brian Paul#endif
249adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   default:
250adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      _eglError(EGL_BAD_PARAMETER, "eglQueryString");
251adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul      return NULL;
252adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   }
253adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
254adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
255adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
256adbff7e977c7c768e752a24fb643d68bdf961bfeBrian PaulEGLBoolean
257adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglWaitGL(_EGLDriver *drv, EGLDisplay dpy)
258adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
259adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   /* just a placeholder */
260adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   (void) drv;
261adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   (void) dpy;
262adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   return EGL_TRUE;
263adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
264adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
265adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul
266adbff7e977c7c768e752a24fb643d68bdf961bfeBrian PaulEGLBoolean
267adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul_eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
268adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul{
269adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   /* just a placeholder */
270adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   (void) drv;
271adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   (void) dpy;
272b2006a40eb22899d38cd31691640555228e36975Brian Paul   switch (engine) {
273b2006a40eb22899d38cd31691640555228e36975Brian Paul   case EGL_CORE_NATIVE_ENGINE:
274b2006a40eb22899d38cd31691640555228e36975Brian Paul      break;
275b2006a40eb22899d38cd31691640555228e36975Brian Paul   default:
276b2006a40eb22899d38cd31691640555228e36975Brian Paul      _eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
277b2006a40eb22899d38cd31691640555228e36975Brian Paul      return EGL_FALSE;
278b2006a40eb22899d38cd31691640555228e36975Brian Paul   }
279b2006a40eb22899d38cd31691640555228e36975Brian Paul
280adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul   return EGL_TRUE;
281adbff7e977c7c768e752a24fb643d68bdf961bfeBrian Paul}
282