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

Author: Chia-I Wu <[email protected]>
Date:   Fri Mar  5 11:00:15 2010 +0800

st/egl: Add get_param to native display interface.

get_param can be used to query the parameters of a native display.
There is only NATIVE_PARAM_USE_NATIVE_BUFFER right now.  It queries
whether the window/pixmap surfaces use the native buffers instead of
private buffers.

---

 src/gallium/state_trackers/egl/common/native.h     |   16 ++++++++++++++++
 src/gallium/state_trackers/egl/kms/native_kms.c    |   16 ++++++++++++++++
 src/gallium/state_trackers/egl/x11/native_dri2.c   |   20 ++++++++++++++++++++
 src/gallium/state_trackers/egl/x11/native_ximage.c |   20 ++++++++++++++++++++
 4 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 4533b3a..9c22ff3 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -49,6 +49,14 @@ enum native_attachment {
    NUM_NATIVE_ATTACHMENTS
 };
 
+enum native_param_type {
+   /*
+    * Return TRUE if window/pixmap surfaces use the buffers of the native
+    * types.
+    */
+   NATIVE_PARAM_USE_NATIVE_BUFFER
+};
+
 /**
  * Enumerations for probe results.
  */
@@ -146,6 +154,14 @@ struct native_display {
    void (*destroy)(struct native_display *ndpy);
 
    /**
+    * Query the parameters of the native display.
+    *
+    * The return value is defined by the parameter.
+    */
+   int (*get_param)(struct native_display *ndpy,
+                    enum native_param_type param);
+
+   /**
     * Get the supported configs.  The configs are owned by the display, but
     * the returned array should be free()ed.
     *
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c 
b/src/gallium/state_trackers/egl/kms/native_kms.c
index 90c82ea..94588bf 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -665,6 +665,21 @@ kms_display_get_configs(struct native_display *ndpy, int 
*num_configs)
    return configs;
 }
 
+static int
+kms_display_get_param(struct native_display *ndpy,
+                      enum native_param_type param)
+{
+   int val;
+
+   switch (param) {
+   default:
+      val = 0;
+      break;
+   }
+
+   return val;
+}
+
 static void
 kms_display_destroy(struct native_display *ndpy)
 {
@@ -811,6 +826,7 @@ kms_create_display(EGLNativeDisplayType dpy,
    }
 
    kdpy->base.destroy = kms_display_destroy;
+   kdpy->base.get_param = kms_display_get_param;
    kdpy->base.get_configs = kms_display_get_configs;
    kdpy->base.create_pbuffer_surface = kms_display_create_pbuffer_surface;
 
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c 
b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 858033e..8d2a8b1 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -707,6 +707,25 @@ dri2_display_is_pixmap_supported(struct native_display 
*ndpy,
    return (depth == nconf_depth || (depth == 24 && depth + 8 == nconf_depth));
 }
 
+static int
+dri2_display_get_param(struct native_display *ndpy,
+                       enum native_param_type param)
+{
+   int val;
+
+   switch (param) {
+   case NATIVE_PARAM_USE_NATIVE_BUFFER:
+      /* DRI2GetBuffers use the native buffers */
+      val = TRUE;
+      break;
+   default:
+      val = 0;
+      break;
+   }
+
+   return val;
+}
+
 static void
 dri2_display_destroy(struct native_display *ndpy)
 {
@@ -850,6 +869,7 @@ x11_create_dri2_display(EGLNativeDisplayType dpy,
    }
 
    dri2dpy->base.destroy = dri2_display_destroy;
+   dri2dpy->base.get_param = dri2_display_get_param;
    dri2dpy->base.get_configs = dri2_display_get_configs;
    dri2dpy->base.is_pixmap_supported = dri2_display_is_pixmap_supported;
    dri2dpy->base.create_window_surface = dri2_display_create_window_surface;
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c 
b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 5e0270c..3421c19 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -699,6 +699,25 @@ ximage_display_is_pixmap_supported(struct native_display 
*ndpy,
    return (fmt == nconf->color_format);
 }
 
+static int
+ximage_display_get_param(struct native_display *ndpy,
+                         enum native_param_type param)
+{
+   int val;
+
+   switch (param) {
+   case NATIVE_PARAM_USE_NATIVE_BUFFER:
+      /* private buffers are allocated */
+      val = FALSE;
+      break;
+   default:
+      val = 0;
+      break;
+   }
+
+   return val;
+}
+
 static void
 ximage_display_destroy(struct native_display *ndpy)
 {
@@ -753,6 +772,7 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
    xdpy->base.screen = softpipe_create_screen(xdpy->winsys);
 
    xdpy->base.destroy = ximage_display_destroy;
+   xdpy->base.get_param = ximage_display_get_param;
 
    xdpy->base.get_configs = ximage_display_get_configs;
    xdpy->base.is_pixmap_supported = ximage_display_is_pixmap_supported;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to