summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2010-01-18 15:49:20 +0800
committerChia-I Wu <olvaffe@gmail.com>2010-01-18 17:04:02 +0800
commitf8244e294646c1b5127a2bf3e92811300b0e3b9e (patch)
tree3fe630ed870c28e2ad629902ef093f78a9f13aae /src/gallium/state_trackers/egl_g3d/x11/native_dri2.c
parentfda897ad71738dd76a218280fd2e635d5dcdcee1 (diff)
st/egl_g3d: Add is_pixmap_supported to native display interface.
The function may be used to support, for example, EGL_MATCH_NATIVE_PIXMAP and EGL_KHR_image_pixmap.
Diffstat (limited to 'src/gallium/state_trackers/egl_g3d/x11/native_dri2.c')
-rw-r--r--src/gallium/state_trackers/egl_g3d/x11/native_dri2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c b/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c
index f675a8e686..07f82d878c 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c
@@ -588,6 +588,21 @@ dri2_display_get_configs(struct native_display *ndpy, int *num_configs)
return configs;
}
+static boolean
+dri2_display_is_pixmap_supported(struct native_display *ndpy,
+ EGLNativePixmapType pix,
+ const struct native_config *nconf)
+{
+ struct dri2_display *dri2dpy = dri2_display(ndpy);
+ uint depth, nconf_depth;
+
+ depth = x11_drawable_get_depth(dri2dpy->xscr, (Drawable) pix);
+ nconf_depth = util_format_get_blocksizebits(nconf->color_format);
+
+ /* simple depth match for now */
+ return (depth == nconf_depth || (depth == 24 && depth + 8 == nconf_depth));
+}
+
static void
dri2_display_destroy(struct native_display *ndpy)
{
@@ -680,6 +695,7 @@ x11_create_dri2_display(EGLNativeDisplayType dpy, struct drm_api *api)
dri2dpy->base.destroy = dri2_display_destroy;
dri2dpy->base.get_configs = dri2_display_get_configs;
+ dri2dpy->base.is_pixmap_supported = dri2_display_is_pixmap_supported;
dri2dpy->base.create_context = dri2_display_create_context;
dri2dpy->base.create_window_surface = dri2_display_create_window_surface;
dri2dpy->base.create_pixmap_surface = dri2_display_create_pixmap_surface;