Mesa (master): egl: Remove st/egl probe code.

Chia-I Wu olv at kemper.freedesktop.org
Tue Jun 29 02:17:26 PDT 2010


Module: Mesa
Branch: master
Commit: 4cb853402b6c55f5dbabf4475cd46b34bd7b1bc1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4cb853402b6c55f5dbabf4475cd46b34bd7b1bc1

Author: Chia-I Wu <olv at lunarg.com>
Date:   Fri Jun 25 00:41:56 2010 +0800

egl: Remove st/egl probe code.

It is no longer needed.

---

 src/egl/main/egldriver.c                           |   48 -------------
 src/egl/main/egldriver.h                           |    8 --
 src/gallium/state_trackers/egl/common/egl_g3d.c    |   74 +-------------------
 src/gallium/state_trackers/egl/common/egl_g3d.h    |    1 -
 src/gallium/state_trackers/egl/common/native.h     |   15 ----
 .../state_trackers/egl/common/native_probe.h       |   52 --------------
 .../state_trackers/egl/fbdev/native_fbdev.c        |    2 -
 src/gallium/state_trackers/egl/gdi/native_gdi.c    |    2 -
 src/gallium/state_trackers/egl/kms/native_kms.c    |    2 -
 src/gallium/state_trackers/egl/x11/native_x11.c    |    2 -
 10 files changed, 1 insertions(+), 205 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index f3a6940..447f67d 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -98,13 +98,6 @@ library_suffix(void)
 #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().
  */
@@ -563,44 +556,3 @@ _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *),
    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;
-}
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 8b34c43..711de8a 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -97,12 +97,4 @@ _eglSearchPathForEach(EGLBoolean (*callback)(const char *, size_t, void *),
                       void *callback_data);
 
 
-PUBLIC void
-_eglSetProbeCache(EGLint key, const void *val);
-
-
-PUBLIC const void *
-_eglGetProbeCache(EGLint key);
-
-
 #endif /* EGLDRIVER_INCLUDED */
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 494d6dd..d7a2aa8 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -88,51 +88,6 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
    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
@@ -510,9 +465,6 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
    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;
@@ -595,28 +547,7 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
 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 *
@@ -637,9 +568,6 @@ egl_g3d_create_driver(const struct egl_g3d_loader *loader)
 
    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;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index d9ecb20..ed2b040 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -47,7 +47,6 @@ struct egl_g3d_driver {
    _EGLDriver base;
    const struct egl_g3d_loader *loader;
    const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
-   EGLint probe_key;
 };
 
 struct egl_g3d_display {
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 7e84d74..9f34c51 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -34,7 +34,6 @@
 #include "pipe/p_state.h"
 #include "state_tracker/sw_winsys.h"
 
-#include "native_probe.h"
 #include "native_modeset.h"
 
 /**
@@ -216,20 +215,6 @@ native_attachment_mask_test(uint mask, enum native_attachment att)
 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);
diff --git a/src/gallium/state_trackers/egl/common/native_probe.h b/src/gallium/state_trackers/egl/common/native_probe.h
deleted file mode 100644
index c0b7f2a..0000000
--- a/src/gallium/state_trackers/egl/common/native_probe.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.8
- *
- * Copyright (C) 2009-2010 Chia-I Wu <olv at 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_ */
diff --git a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
index 7c276c2..e459402 100644
--- a/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
+++ b/src/gallium/state_trackers/egl/fbdev/native_fbdev.c
@@ -457,8 +457,6 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
 
 static const struct native_platform fbdev_platform = {
    "FBDEV", /* name */
-   NULL, /* create_probe */
-   NULL, /* get_probe_result */
    native_create_display
 };
 
diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index ed955c4..06e3edf 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -389,8 +389,6 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
 
 static const struct native_platform gdi_platform = {
    "GDI", /* name */
-   NULL, /* create_probe */
-   NULL, /* get_probe_result */
    native_create_display
 };
 
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c
index 5833d27..d4e8fbc 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -767,8 +767,6 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
 
 static const struct native_platform kms_platform = {
    "KMS", /* name */
-   NULL, /* create_probe */
-   NULL, /* get_probe_result */
    native_create_display
 };
 
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index 8dc19d0..fc12720 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -59,8 +59,6 @@ native_create_display(void *dpy, struct native_event_handler *event_handler,
 
 static const struct native_platform x11_platform = {
    "X11", /* name */
-   NULL, /* create_probe */
-   NULL, /* get_probe_result */
    native_create_display
 };
 



More information about the mesa-commit mailing list