It is no longer needed.
#endif
-#define NUM_PROBE_CACHE_SLOTS 8
-static struct {
- EGLint keys[NUM_PROBE_CACHE_SLOTS];
- const void *values[NUM_PROBE_CACHE_SLOTS];
-} _eglProbeCache;
-
-
/**
* Open the named driver and find its bootstrap function: _eglMain().
*/
const char *search_path = _eglGetSearchPath();
_eglPreloadForEach(search_path, callback, callback_data);
}
-
-
-/**
- * Set the probe cache at the given key.
- *
- * A key, instead of a _EGLDriver, is used to allow the probe cache to be share
- * by multiple drivers.
- */
-void
-_eglSetProbeCache(EGLint key, const void *val)
-{
- EGLint idx;
-
- for (idx = 0; idx < NUM_PROBE_CACHE_SLOTS; idx++) {
- if (!_eglProbeCache.keys[idx] || _eglProbeCache.keys[idx] == key)
- break;
- }
- assert(key > 0);
- assert(idx < NUM_PROBE_CACHE_SLOTS);
-
- _eglProbeCache.keys[idx] = key;
- _eglProbeCache.values[idx] = val;
-}
-
-
-/**
- * Return the probe cache at the given key.
- */
-const void *
-_eglGetProbeCache(EGLint key)
-{
- EGLint idx;
-
- for (idx = 0; idx < NUM_PROBE_CACHE_SLOTS; idx++) {
- if (!_eglProbeCache.keys[idx] || _eglProbeCache.keys[idx] == key)
- break;
- }
-
- return (idx < NUM_PROBE_CACHE_SLOTS && _eglProbeCache.keys[idx] == key) ?
- _eglProbeCache.values[idx] : NULL;
-}
void *callback_data);
-PUBLIC void
-_eglSetProbeCache(EGLint key, const void *val);
-
-
-PUBLIC const void *
-_eglGetProbeCache(EGLint key);
-
-
#endif /* EGLDRIVER_INCLUDED */
return gdrv->platforms[plat];
}
-/**
- * Get the probe result of the display.
- *
- * Note that this function may be called before the display is initialized.
- */
-static enum native_probe_result
-egl_g3d_get_probe_result(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- struct native_probe *nprobe;
- const struct native_platform *nplat;
-
- nplat = egl_g3d_get_platform(drv, dpy->Platform);
- if (!nplat || !nplat->create_probe)
- return NATIVE_PROBE_UNKNOWN;
-
- nprobe = (struct native_probe *) _eglGetProbeCache(gdrv->probe_key);
- if (!nprobe || nprobe->display != dpy->PlatformDisplay) {
- if (nprobe)
- nprobe->destroy(nprobe);
- nprobe = nplat->create_probe(dpy->PlatformDisplay);
- _eglSetProbeCache(gdrv->probe_key, (void *) nprobe);
- }
-
- return nplat->get_probe_result(nprobe);
-}
-
-/**
- * Destroy the probe object of the display. The display may be NULL.
- *
- * Note that this function may be called before the display is initialized.
- */
-static void
-egl_g3d_destroy_probe(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- struct native_probe *nprobe;
-
- nprobe = (struct native_probe *) _eglGetProbeCache(gdrv->probe_key);
- if (nprobe && (!dpy || nprobe->display == dpy->PlatformDisplay)) {
- nprobe->destroy(nprobe);
- _eglSetProbeCache(gdrv->probe_key, NULL);
- }
-}
-
#ifdef EGL_MESA_screen_surface
static void
struct egl_g3d_display *gdpy;
const struct native_platform *nplat;
- /* the probe object is unlikely to be needed again */
- egl_g3d_destroy_probe(drv, dpy);
-
nplat = egl_g3d_get_platform(drv, dpy->Platform);
if (!nplat)
return EGL_FALSE;
static EGLint
egl_g3d_probe(_EGLDriver *drv, _EGLDisplay *dpy)
{
- enum native_probe_result res;
- EGLint score;
-
- res = egl_g3d_get_probe_result(drv, dpy);
-
- switch (res) {
- case NATIVE_PROBE_UNKNOWN:
- default:
- score = 0;
- break;
- case NATIVE_PROBE_FALLBACK:
- score = 40;
- break;
- case NATIVE_PROBE_SUPPORTED:
- score = 50;
- break;
- case NATIVE_PROBE_EXACT:
- score = 100;
- break;
- }
-
- return score;
+ return (egl_g3d_get_platform(drv, dpy->Platform)) ? 90 : 0;
}
_EGLDriver *
gdrv->base.Probe = egl_g3d_probe;
- /* the key is " EGL G3D" */
- gdrv->probe_key = 0x0E61063D;
-
/* to be filled by the caller */
gdrv->base.Name = NULL;
gdrv->base.Unload = NULL;
_EGLDriver base;
const struct egl_g3d_loader *loader;
const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
- EGLint probe_key;
};
struct egl_g3d_display {
#include "pipe/p_state.h"
#include "state_tracker/sw_winsys.h"
-#include "native_probe.h"
#include "native_modeset.h"
/**
struct native_platform {
const char *name;
- /**
- * Return a probe object for the given display.
- *
- * Note that the returned object may be cached and used by different native
- * display modules. It allows fast probing when multiple modules probe the
- * same display.
- */
- struct native_probe *(*create_probe)(void *dpy);
-
- /**
- * Probe the probe object.
- */
- enum native_probe_result (*get_probe_result)(struct native_probe *nprobe);
-
struct native_display *(*create_display)(void *dpy,
struct native_event_handler *handler,
void *user_data);
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- * Version: 7.8
- *
- * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _NATIVE_PROBE_H_
-#define _NATIVE_PROBE_H_
-
-#include "EGL/egl.h" /* for EGL native types */
-
-/**
- * Enumerations for probe results.
- */
-enum native_probe_result {
- NATIVE_PROBE_UNKNOWN,
- NATIVE_PROBE_FALLBACK,
- NATIVE_PROBE_SUPPORTED,
- NATIVE_PROBE_EXACT,
-};
-
-/**
- * A probe object for display probe.
- */
-struct native_probe {
- int magic;
- void *display;
- void *data;
-
- void (*destroy)(struct native_probe *nprobe);
-};
-
-#endif /* _NATIVE_PROBE_H_ */
static const struct native_platform fbdev_platform = {
"FBDEV", /* name */
- NULL, /* create_probe */
- NULL, /* get_probe_result */
native_create_display
};
static const struct native_platform gdi_platform = {
"GDI", /* name */
- NULL, /* create_probe */
- NULL, /* get_probe_result */
native_create_display
};
static const struct native_platform kms_platform = {
"KMS", /* name */
- NULL, /* create_probe */
- NULL, /* get_probe_result */
native_create_display
};
static const struct native_platform x11_platform = {
"X11", /* name */
- NULL, /* create_probe */
- NULL, /* get_probe_result */
native_create_display
};