st/egl: Hookup gbm for drm backend
[mesa.git] / src / gallium / state_trackers / egl / common / egl_g3d.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.8
4 *
5 * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
24 */
25
26 #include "egldriver.h"
27 #include "eglcurrent.h"
28 #include "egllog.h"
29
30 #include "pipe/p_screen.h"
31 #include "util/u_memory.h"
32 #include "util/u_format.h"
33 #include "util/u_string.h"
34
35 #include "egl_g3d.h"
36 #include "egl_g3d_api.h"
37 #include "egl_g3d_st.h"
38 #include "egl_g3d_loader.h"
39 #include "native.h"
40
41 static void
42 egl_g3d_invalid_surface(struct native_display *ndpy,
43 struct native_surface *nsurf,
44 unsigned int seq_num)
45 {
46 /* XXX not thread safe? */
47 struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf->user_data);
48 struct egl_g3d_context *gctx;
49
50 /*
51 * Some functions such as egl_g3d_copy_buffers create a temporary native
52 * surface. There is no gsurf associated with it.
53 */
54 gctx = (gsurf) ? egl_g3d_context(gsurf->base.CurrentContext) : NULL;
55 if (gctx)
56 gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gsurf->stfbi);
57 }
58
59 static struct pipe_screen *
60 egl_g3d_new_drm_screen(struct native_display *ndpy, const char *name, int fd)
61 {
62 _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
63 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
64 return gdpy->loader->create_drm_screen(name, fd);
65 }
66
67 static struct pipe_screen *
68 egl_g3d_new_sw_screen(struct native_display *ndpy, struct sw_winsys *ws)
69 {
70 _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
71 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
72 return gdpy->loader->create_sw_screen(ws);
73 }
74
75 static struct pipe_resource *
76 egl_g3d_lookup_egl_image(struct native_display *ndpy, void *egl_image)
77 {
78 _EGLDisplay *dpy = (_EGLDisplay *) ndpy->user_data;
79 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
80 struct st_egl_image img;
81 struct pipe_resource *resource = NULL;
82
83 memset(&img, 0, sizeof(img));
84 if (gdpy->smapi->get_egl_image(gdpy->smapi, egl_image, &img))
85 resource = img.texture;
86
87 return resource;
88 }
89
90 static struct native_event_handler egl_g3d_native_event_handler = {
91 egl_g3d_invalid_surface,
92 egl_g3d_new_drm_screen,
93 egl_g3d_new_sw_screen,
94 egl_g3d_lookup_egl_image
95 };
96
97 /**
98 * Get the native platform.
99 */
100 static const struct native_platform *
101 egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
102 {
103 struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
104
105 if (!gdrv->platforms[plat]) {
106 const char *plat_name = NULL;
107 const struct native_platform *nplat = NULL;
108
109 switch (plat) {
110 case _EGL_PLATFORM_WINDOWS:
111 plat_name = "Windows";
112 #ifdef HAVE_GDI_BACKEND
113 nplat = native_get_gdi_platform();
114 #endif
115 break;
116 case _EGL_PLATFORM_X11:
117 plat_name = "X11";
118 #ifdef HAVE_X11_BACKEND
119 nplat = native_get_x11_platform();
120 #endif
121 break;
122 case _EGL_PLATFORM_WAYLAND:
123 plat_name = "wayland";
124 #ifdef HAVE_WAYLAND_BACKEND
125 nplat = native_get_wayland_platform();
126 #endif
127 break;
128 case _EGL_PLATFORM_DRM:
129 plat_name = "DRM";
130 #ifdef HAVE_DRM_BACKEND
131 nplat = native_get_drm_platform();
132 #endif
133 break;
134 case _EGL_PLATFORM_FBDEV:
135 plat_name = "FBDEV";
136 #ifdef HAVE_FBDEV_BACKEND
137 nplat = native_get_fbdev_platform();
138 #endif
139 break;
140 default:
141 break;
142 }
143
144 if (nplat)
145 nplat->set_event_handler(&egl_g3d_native_event_handler);
146 else
147 _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
148
149 gdrv->platforms[plat] = nplat;
150 }
151
152 return gdrv->platforms[plat];
153 }
154
155 #ifdef EGL_MESA_screen_surface
156
157 static void
158 egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
159 {
160 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
161 const struct native_connector **native_connectors;
162 EGLint num_connectors, i;
163
164 native_connectors =
165 gdpy->native->modeset->get_connectors(gdpy->native, &num_connectors, NULL);
166 if (!num_connectors) {
167 if (native_connectors)
168 FREE(native_connectors);
169 return;
170 }
171
172 for (i = 0; i < num_connectors; i++) {
173 const struct native_connector *nconn = native_connectors[i];
174 struct egl_g3d_screen *gscr;
175 const struct native_mode **native_modes;
176 EGLint num_modes, j;
177
178 /* TODO support for hotplug */
179 native_modes =
180 gdpy->native->modeset->get_modes(gdpy->native, nconn, &num_modes);
181 if (!num_modes) {
182 if (native_modes)
183 FREE(native_modes);
184 continue;
185 }
186
187 gscr = CALLOC_STRUCT(egl_g3d_screen);
188 if (!gscr) {
189 FREE(native_modes);
190 continue;
191 }
192
193 _eglInitScreen(&gscr->base, dpy, num_modes);
194 for (j = 0; j < gscr->base.NumModes; j++) {
195 const struct native_mode *nmode = native_modes[j];
196 _EGLMode *mode = &gscr->base.Modes[j];
197
198 mode->Width = nmode->width;
199 mode->Height = nmode->height;
200 mode->RefreshRate = nmode->refresh_rate;
201 mode->Optimal = EGL_FALSE;
202 mode->Interlaced = EGL_FALSE;
203 /* no need to strdup() */
204 mode->Name = nmode->desc;
205 }
206
207 gscr->native = nconn;
208 gscr->native_modes = native_modes;
209
210 _eglLinkScreen(&gscr->base);
211 }
212
213 FREE(native_connectors);
214 }
215
216 #endif /* EGL_MESA_screen_surface */
217
218 /**
219 * Initialize and validate the EGL config attributes.
220 */
221 static EGLBoolean
222 init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
223 EGLint api_mask, enum pipe_format depth_stencil_format,
224 EGLBoolean preserve_buffer, EGLint max_swap_interval)
225 {
226 uint rgba[4], depth_stencil[2], buffer_size;
227 EGLint surface_type;
228 EGLint i;
229
230 /* get the color and depth/stencil component sizes */
231 assert(nconf->color_format != PIPE_FORMAT_NONE);
232 buffer_size = 0;
233 for (i = 0; i < 4; i++) {
234 rgba[i] = util_format_get_component_bits(nconf->color_format,
235 UTIL_FORMAT_COLORSPACE_RGB, i);
236 buffer_size += rgba[i];
237 }
238 for (i = 0; i < 2; i++) {
239 if (depth_stencil_format != PIPE_FORMAT_NONE) {
240 depth_stencil[i] =
241 util_format_get_component_bits(depth_stencil_format,
242 UTIL_FORMAT_COLORSPACE_ZS, i);
243 }
244 else {
245 depth_stencil[i] = 0;
246 }
247 }
248
249 surface_type = 0x0;
250 /* pixmap surfaces should be EGL_SINGLE_BUFFER */
251 if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) {
252 if (nconf->pixmap_bit)
253 surface_type |= EGL_PIXMAP_BIT;
254 }
255 /* the others surfaces should be EGL_BACK_BUFFER (or settable) */
256 if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) {
257 if (nconf->window_bit)
258 surface_type |= EGL_WINDOW_BIT;
259 #ifdef EGL_MESA_screen_surface
260 if (nconf->scanout_bit)
261 surface_type |= EGL_SCREEN_BIT_MESA;
262 #endif
263 surface_type |= EGL_PBUFFER_BIT;
264 }
265
266 conf->Conformant = api_mask;
267 conf->RenderableType = api_mask;
268
269 conf->RedSize = rgba[0];
270 conf->GreenSize = rgba[1];
271 conf->BlueSize = rgba[2];
272 conf->AlphaSize = rgba[3];
273 conf->BufferSize = buffer_size;
274
275 conf->DepthSize = depth_stencil[0];
276 conf->StencilSize = depth_stencil[1];
277
278 /* st/vega will allocate the mask on demand */
279 if (api_mask & EGL_OPENVG_BIT)
280 conf->AlphaMaskSize = 8;
281
282 conf->SurfaceType = surface_type;
283
284 conf->NativeRenderable = EGL_TRUE;
285 if (surface_type & EGL_WINDOW_BIT) {
286 conf->NativeVisualID = nconf->native_visual_id;
287 conf->NativeVisualType = nconf->native_visual_type;
288 }
289
290 if (surface_type & EGL_PBUFFER_BIT) {
291 conf->BindToTextureRGB = EGL_TRUE;
292 if (rgba[3])
293 conf->BindToTextureRGBA = EGL_TRUE;
294
295 conf->MaxPbufferWidth = 4096;
296 conf->MaxPbufferHeight = 4096;
297 conf->MaxPbufferPixels = 4096 * 4096;
298 }
299
300 conf->Level = nconf->level;
301
302 if (nconf->transparent_rgb) {
303 conf->TransparentType = EGL_TRANSPARENT_RGB;
304 conf->TransparentRedValue = nconf->transparent_rgb_values[0];
305 conf->TransparentGreenValue = nconf->transparent_rgb_values[1];
306 conf->TransparentBlueValue = nconf->transparent_rgb_values[2];
307 }
308
309 conf->MinSwapInterval = 0;
310 conf->MaxSwapInterval = max_swap_interval;
311 if (preserve_buffer)
312 conf->SurfaceType |= EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
313
314 return _eglValidateConfig(conf, EGL_FALSE);
315 }
316
317 /**
318 * Initialize an EGL config from the native config.
319 */
320 static EGLBoolean
321 egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
322 _EGLConfig *conf, const struct native_config *nconf,
323 enum pipe_format depth_stencil_format,
324 int preserve_buffer, int max_swap_interval)
325 {
326 struct egl_g3d_config *gconf = egl_g3d_config(conf);
327 EGLint buffer_mask;
328 EGLBoolean valid;
329
330 buffer_mask = 0x0;
331 if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT))
332 buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
333 if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))
334 buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
335 if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_RIGHT))
336 buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
337 if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_RIGHT))
338 buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
339
340 gconf->stvis.buffer_mask = buffer_mask;
341 gconf->stvis.color_format = nconf->color_format;
342 gconf->stvis.depth_stencil_format = depth_stencil_format;
343 gconf->stvis.accum_format = PIPE_FORMAT_NONE;
344 gconf->stvis.samples = 0;
345
346 /* will be overridden per surface */
347 gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ?
348 ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
349
350 valid = init_config_attributes(&gconf->base,
351 nconf, dpy->ClientAPIs, depth_stencil_format,
352 preserve_buffer, max_swap_interval);
353 if (!valid) {
354 _eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id);
355 return EGL_FALSE;
356 }
357
358 gconf->native = nconf;
359
360 return EGL_TRUE;
361 }
362
363 /**
364 * Get all interested depth/stencil formats of a display.
365 */
366 static EGLint
367 egl_g3d_fill_depth_stencil_formats(_EGLDisplay *dpy,
368 enum pipe_format formats[8])
369 {
370 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
371 struct pipe_screen *screen = gdpy->native->screen;
372 const EGLint candidates[] = {
373 1, PIPE_FORMAT_Z16_UNORM,
374 1, PIPE_FORMAT_Z32_UNORM,
375 2, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
376 2, PIPE_FORMAT_Z24X8_UNORM, PIPE_FORMAT_X8Z24_UNORM,
377 0
378 };
379 const EGLint *fmt = candidates;
380 EGLint count;
381
382 count = 0;
383 formats[count++] = PIPE_FORMAT_NONE;
384
385 while (*fmt) {
386 EGLint i, n = *fmt++;
387
388 /* pick the first supported format */
389 for (i = 0; i < n; i++) {
390 if (screen->is_format_supported(screen, fmt[i],
391 PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL)) {
392 formats[count++] = fmt[i];
393 break;
394 }
395 }
396
397 fmt += n;
398 }
399
400 return count;
401 }
402
403 /**
404 * Add configs to display and return the next config ID.
405 */
406 static EGLint
407 egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
408 {
409 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
410 const struct native_config **native_configs;
411 enum pipe_format depth_stencil_formats[8];
412 int num_formats, num_configs, i, j;
413 int preserve_buffer, max_swap_interval;
414
415 native_configs = gdpy->native->get_configs(gdpy->native, &num_configs);
416 if (!num_configs) {
417 if (native_configs)
418 FREE(native_configs);
419 return id;
420 }
421
422 preserve_buffer =
423 gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESERVE_BUFFER);
424 max_swap_interval =
425 gdpy->native->get_param(gdpy->native, NATIVE_PARAM_MAX_SWAP_INTERVAL);
426
427 num_formats = egl_g3d_fill_depth_stencil_formats(dpy,
428 depth_stencil_formats);
429
430 for (i = 0; i < num_configs; i++) {
431 for (j = 0; j < num_formats; j++) {
432 struct egl_g3d_config *gconf;
433
434 gconf = CALLOC_STRUCT(egl_g3d_config);
435 if (gconf) {
436 _eglInitConfig(&gconf->base, dpy, id);
437 if (!egl_g3d_init_config(drv, dpy, &gconf->base,
438 native_configs[i], depth_stencil_formats[j],
439 preserve_buffer, max_swap_interval)) {
440 FREE(gconf);
441 break;
442 }
443
444 _eglLinkConfig(&gconf->base);
445 id++;
446 }
447 }
448 }
449
450 FREE(native_configs);
451 return id;
452 }
453
454 static void
455 egl_g3d_free_config(void *conf)
456 {
457 struct egl_g3d_config *gconf = egl_g3d_config((_EGLConfig *) conf);
458 FREE(gconf);
459 }
460
461 static void
462 egl_g3d_free_screen(void *scr)
463 {
464 #ifdef EGL_MESA_screen_surface
465 struct egl_g3d_screen *gscr = egl_g3d_screen((_EGLScreen *) scr);
466 FREE(gscr->native_modes);
467 FREE(gscr);
468 #endif
469 }
470
471 static EGLBoolean
472 egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
473 {
474 struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
475
476 _eglReleaseDisplayResources(drv, dpy);
477
478 if (dpy->Configs) {
479 _eglDestroyArray(dpy->Configs, egl_g3d_free_config);
480 dpy->Configs = NULL;
481 }
482 if (dpy->Screens) {
483 _eglDestroyArray(dpy->Screens, egl_g3d_free_screen);
484 dpy->Screens = NULL;
485 }
486
487 _eglCleanupDisplay(dpy);
488
489 if (gdpy->smapi)
490 egl_g3d_destroy_st_manager(gdpy->smapi);
491
492 if (gdpy->native)
493 gdpy->native->destroy(gdpy->native);
494
495 FREE(gdpy);
496 dpy->DriverData = NULL;
497
498 return EGL_TRUE;
499 }
500
501 static EGLBoolean
502 egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
503 {
504 struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
505 struct egl_g3d_display *gdpy;
506 const struct native_platform *nplat;
507
508 nplat = egl_g3d_get_platform(drv, dpy->Platform);
509 if (!nplat)
510 return EGL_FALSE;
511
512 if (dpy->Options.TestOnly)
513 return EGL_TRUE;
514
515 gdpy = CALLOC_STRUCT(egl_g3d_display);
516 if (!gdpy) {
517 _eglError(EGL_BAD_ALLOC, "eglInitialize");
518 goto fail;
519 }
520 gdpy->loader = gdrv->loader;
521 dpy->DriverData = gdpy;
522
523 _eglLog(_EGL_INFO, "use %s for display %p", nplat->name, dpy->PlatformDisplay);
524 gdpy->native = nplat->create_display(dpy->PlatformDisplay,
525 dpy->Options.UseFallback, (void *) dpy);
526 if (!gdpy->native) {
527 _eglError(EGL_NOT_INITIALIZED, "eglInitialize(no usable display)");
528 goto fail;
529 }
530
531 if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_DEFAULT_MASK)
532 dpy->ClientAPIs |= EGL_OPENGL_BIT;
533 if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES1_MASK)
534 dpy->ClientAPIs |= EGL_OPENGL_ES_BIT;
535 if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES2_MASK)
536 dpy->ClientAPIs |= EGL_OPENGL_ES2_BIT;
537 if (gdpy->loader->profile_masks[ST_API_OPENVG] & ST_PROFILE_DEFAULT_MASK)
538 dpy->ClientAPIs |= EGL_OPENVG_BIT;
539
540 gdpy->smapi = egl_g3d_create_st_manager(dpy);
541 if (!gdpy->smapi) {
542 _eglError(EGL_NOT_INITIALIZED,
543 "eglInitialize(failed to create st manager)");
544 goto fail;
545 }
546
547 #ifdef EGL_MESA_screen_surface
548 /* enable MESA_screen_surface before adding (and validating) configs */
549 if (gdpy->native->modeset) {
550 dpy->Extensions.MESA_screen_surface = EGL_TRUE;
551 egl_g3d_add_screens(drv, dpy);
552 }
553 #endif
554
555 dpy->Extensions.KHR_image_base = EGL_TRUE;
556 if (gdpy->native->get_param(gdpy->native, NATIVE_PARAM_USE_NATIVE_BUFFER))
557 dpy->Extensions.KHR_image_pixmap = EGL_TRUE;
558
559 dpy->Extensions.KHR_reusable_sync = EGL_TRUE;
560 dpy->Extensions.KHR_fence_sync = EGL_TRUE;
561
562 dpy->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
563 dpy->Extensions.KHR_surfaceless_gles2 = EGL_TRUE;
564 dpy->Extensions.KHR_surfaceless_opengl = EGL_TRUE;
565
566 if (dpy->Platform == _EGL_PLATFORM_DRM) {
567 dpy->Extensions.MESA_drm_display = EGL_TRUE;
568 if (gdpy->native->buffer)
569 dpy->Extensions.MESA_drm_image = EGL_TRUE;
570 }
571
572 if (dpy->Platform == _EGL_PLATFORM_WAYLAND && gdpy->native->buffer)
573 dpy->Extensions.MESA_drm_image = EGL_TRUE;
574
575 #ifdef EGL_WL_bind_wayland_display
576 if (gdpy->native->wayland_bufmgr)
577 dpy->Extensions.WL_bind_wayland_display = EGL_TRUE;
578 #endif
579
580 if (egl_g3d_add_configs(drv, dpy, 1) == 1) {
581 _eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)");
582 goto fail;
583 }
584
585 dpy->VersionMajor = 1;
586 dpy->VersionMinor = 4;
587
588 return EGL_TRUE;
589
590 fail:
591 if (gdpy)
592 egl_g3d_terminate(drv, dpy);
593 return EGL_FALSE;
594 }
595
596 static _EGLProc
597 egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
598 {
599 struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
600 struct st_api *stapi = NULL;
601
602 if (procname && procname[0] == 'v' && procname[1] == 'g')
603 stapi = gdrv->loader->get_st_api(ST_API_OPENVG);
604 else if (procname && procname[0] == 'g' && procname[1] == 'l')
605 stapi = gdrv->loader->get_st_api(ST_API_OPENGL);
606
607 return (_EGLProc) ((stapi) ?
608 stapi->get_proc_address(stapi, procname) : NULL);
609 }
610
611 _EGLDriver *
612 egl_g3d_create_driver(const struct egl_g3d_loader *loader)
613 {
614 struct egl_g3d_driver *gdrv;
615
616 gdrv = CALLOC_STRUCT(egl_g3d_driver);
617 if (!gdrv)
618 return NULL;
619
620 gdrv->loader = loader;
621
622 egl_g3d_init_driver_api(&gdrv->base);
623 gdrv->base.API.Initialize = egl_g3d_initialize;
624 gdrv->base.API.Terminate = egl_g3d_terminate;
625 gdrv->base.API.GetProcAddress = egl_g3d_get_proc_address;
626
627 /* to be filled by the caller */
628 gdrv->base.Name = NULL;
629 gdrv->base.Unload = NULL;
630
631 return &gdrv->base;
632 }
633
634 void
635 egl_g3d_destroy_driver(_EGLDriver *drv)
636 {
637 struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
638 FREE(gdrv);
639 }