summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-08-05 14:36:14 +0900
committerChia-I Wu <[email protected]>2011-08-28 21:56:22 +0800
commit58911b86a15676f116c693e84ea6b9ebabb906ed (patch)
tree612968f230b2ea4589dd25b770deb222ed82455e /src/egl/drivers/dri2
parentc8fed01c732fa20e1ae035ed5f7b6156a5d6ffe9 (diff)
egl_dri2: allow RGBA masks to be specified for matching
Add rgba_masks to dri2_add_config. When it is non-NULL, the DRI config is accepted only when the offsets and sizes of the its channels match rgba_mask. Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c23
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h3
-rw-r--r--src/egl/drivers/dri2/platform_drm.c2
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c2
-rw-r--r--src/egl/drivers/dri2/platform_x11.c2
5 files changed, 27 insertions, 5 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f09ae14f10c..ba728a1583b 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -111,13 +111,15 @@ dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
struct dri2_egl_config *
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
- int depth, EGLint surface_type, const EGLint *attr_list)
+ int depth, EGLint surface_type, const EGLint *attr_list,
+ const unsigned int *rgba_masks)
{
struct dri2_egl_config *conf;
struct dri2_egl_display *dri2_dpy;
_EGLConfig base;
unsigned int attrib, value, double_buffer;
EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
+ unsigned int dri_masks[4] = { 0, 0, 0, 0 };
_EGLConfig *matching_config;
EGLint num_configs = 0;
EGLint config_id;
@@ -165,6 +167,22 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
double_buffer = value;
break;
+ case __DRI_ATTRIB_RED_MASK:
+ dri_masks[0] = value;
+ break;
+
+ case __DRI_ATTRIB_GREEN_MASK:
+ dri_masks[1] = value;
+ break;
+
+ case __DRI_ATTRIB_BLUE_MASK:
+ dri_masks[2] = value;
+ break;
+
+ case __DRI_ATTRIB_ALPHA_MASK:
+ dri_masks[3] = value;
+ break;
+
default:
key = dri2_to_egl_attribute_map[attrib];
if (key != 0)
@@ -180,6 +198,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
if (depth > 0 && depth != base.BufferSize)
return NULL;
+ if (rgba_masks && memcmp(rgba_masks, dri_masks, sizeof(dri_masks)))
+ return NULL;
+
base.NativeRenderable = EGL_TRUE;
base.SurfaceType = surface_type;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index db93eec14ba..be272f9bb25 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -208,7 +208,8 @@ dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data);
struct dri2_egl_config *
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
- int depth, EGLint surface_type, const EGLint *attr_list);
+ int depth, EGLint surface_type, const EGLint *attr_list,
+ const unsigned int *rgba_masks);
_EGLImage *
dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 04b10e279ec..e2c8dab16bc 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -150,7 +150,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
for (i = 0; dri2_dpy->driver_configs[i]; i++)
dri2_add_config(disp, dri2_dpy->driver_configs[i],
- i + 1, 0, 0, NULL);
+ i + 1, 0, 0, NULL, NULL);
drv->API.CreateImageKHR = dri2_drm_create_image_khr;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index c4fa126951b..92657fc6d8a 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -836,7 +836,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
for (i = 0; dri2_dpy->driver_configs[i]; i++)
dri2_add_config(disp, dri2_dpy->driver_configs[i], i + 1, 0,
- EGL_WINDOW_BIT | EGL_PIXMAP_BIT, NULL);
+ EGL_WINDOW_BIT | EGL_PIXMAP_BIT, NULL, NULL);
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index f27bf176fb6..8dd231a7ad5 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -642,7 +642,7 @@ dri2_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
config_attrs[3] = visuals[i]._class;
dri2_add_config(disp, dri2_dpy->driver_configs[j], id++,
- d.data->depth, surface_type, config_attrs);
+ d.data->depth, surface_type, config_attrs, NULL);
}
}