From fade8a6eb639d633cfdbba4a3ba3aa3cc5c04fa6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 5 Mar 2010 11:00:15 +0800 Subject: 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(+) (limited to 'src/gallium/state_trackers/egl') diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 4533b3abf9..9c22ff3e43 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. */ @@ -145,6 +153,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 90c82eaf6c..94588bfa74 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 858033e1c1..8d2a8b1dff 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 5e0270c296..3421c1951a 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; -- cgit v1.2.3