summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/x11
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-04-10 00:36:50 +0800
committerChia-I Wu <olv@lunarg.com>2010-04-11 01:17:47 +0800
commit9b3df661bd50b34ca73ae55f98ced64fd970f443 (patch)
tree5c1567b6713fe326eee1097ec699f0c8663a1510 /src/gallium/state_trackers/egl/x11
parent5fdda9d78d7924fecd711c21910879b7a01dab3f (diff)
st/egl: Remove depth/stencil format from the native interface.
A native display has no interest in depth/stencil format. Remove it from the interface and let the common code derive the supported depth/stencil formats from the pipe screen.
Diffstat (limited to 'src/gallium/state_trackers/egl/x11')
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c47
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c50
2 files changed, 20 insertions, 77 deletions
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 167115708c..9499319424 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -483,36 +483,6 @@ choose_color_format(const __GLcontextModes *mode, enum pipe_format formats[32])
return count;
}
-static int
-choose_depth_stencil_format(const __GLcontextModes *mode,
- enum pipe_format formats[32])
-{
- int count = 0;
-
- switch (mode->depthBits) {
- case 32:
- formats[count++] = PIPE_FORMAT_Z32_UNORM;
- break;
- case 24:
- if (mode->stencilBits) {
- formats[count++] = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
- formats[count++] = PIPE_FORMAT_S8_USCALED_Z24_UNORM;
- }
- else {
- formats[count++] = PIPE_FORMAT_Z24X8_UNORM;
- formats[count++] = PIPE_FORMAT_X8Z24_UNORM;
- }
- break;
- case 16:
- formats[count++] = PIPE_FORMAT_Z16_UNORM;
- break;
- default:
- break;
- }
-
- return count;
-}
-
static boolean
is_format_supported(struct pipe_screen *screen,
enum pipe_format fmt, boolean is_color)
@@ -541,10 +511,6 @@ dri2_display_convert_config(struct native_display *ndpy,
if (!mode->xRenderable || !mode->drawableType)
return FALSE;
- nconf->color_format = PIPE_FORMAT_NONE;
- nconf->depth_format = PIPE_FORMAT_NONE;
- nconf->stencil_format = PIPE_FORMAT_NONE;
-
nconf->buffer_mask = 1 << NATIVE_ATTACHMENT_FRONT_LEFT;
if (mode->doubleBufferMode)
nconf->buffer_mask |= 1 << NATIVE_ATTACHMENT_BACK_LEFT;
@@ -565,19 +531,6 @@ dri2_display_convert_config(struct native_display *ndpy,
if (nconf->color_format == PIPE_FORMAT_NONE)
return FALSE;
- /* choose depth/stencil format */
- num_formats = choose_depth_stencil_format(mode, formats);
- for (i = 0; i < num_formats; i++) {
- if (is_format_supported(ndpy->screen, formats[i], FALSE)) {
- nconf->depth_format = formats[i];
- nconf->stencil_format = formats[i];
- break;
- }
- }
- if ((mode->depthBits && nconf->depth_format == PIPE_FORMAT_NONE) ||
- (mode->stencilBits && nconf->stencil_format == PIPE_FORMAT_NONE))
- return FALSE;
-
if (mode->drawableType & GLX_WINDOW_BIT)
nconf->window_bit = TRUE;
if (mode->drawableType & GLX_PIXMAP_BIT)
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 9d6d63344c..203e06e177 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -466,7 +466,7 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
/* first time */
if (!xdpy->configs) {
const XVisualInfo *visuals;
- int num_visuals, count, j;
+ int num_visuals, count;
visuals = x11_screen_get_visuals(xdpy->xscr, &num_visuals);
if (!visuals)
@@ -482,40 +482,30 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
count = 0;
for (i = 0; i < num_visuals; i++) {
- for (j = 0; j < 2; j++) {
- struct ximage_config *xconf = &xdpy->configs[count];
-
- xconf->visual = &visuals[i];
- xconf->base.color_format = choose_format(xconf->visual);
- if (xconf->base.color_format == PIPE_FORMAT_NONE)
- continue;
-
- xconf->base.buffer_mask =
- (1 << NATIVE_ATTACHMENT_FRONT_LEFT) |
- (1 << NATIVE_ATTACHMENT_BACK_LEFT);
-
- xconf->base.depth_format = PIPE_FORMAT_NONE;
- xconf->base.stencil_format = PIPE_FORMAT_NONE;
- /* create the second config with depth/stencil buffer */
- if (j == 1) {
- xconf->base.depth_format = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
- xconf->base.stencil_format = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
- }
-
- xconf->base.window_bit = TRUE;
- xconf->base.pixmap_bit = TRUE;
-
- xconf->base.native_visual_id = xconf->visual->visualid;
+ struct ximage_config *xconf = &xdpy->configs[count];
+
+ xconf->visual = &visuals[i];
+ xconf->base.color_format = choose_format(xconf->visual);
+ if (xconf->base.color_format == PIPE_FORMAT_NONE)
+ continue;
+
+ xconf->base.buffer_mask =
+ (1 << NATIVE_ATTACHMENT_FRONT_LEFT) |
+ (1 << NATIVE_ATTACHMENT_BACK_LEFT);
+
+ xconf->base.window_bit = TRUE;
+ xconf->base.pixmap_bit = TRUE;
+
+ xconf->base.native_visual_id = xconf->visual->visualid;
#if defined(__cplusplus) || defined(c_plusplus)
- xconf->base.native_visual_type = xconf->visual->c_class;
+ xconf->base.native_visual_type = xconf->visual->c_class;
#else
- xconf->base.native_visual_type = xconf->visual->class;
+ xconf->base.native_visual_type = xconf->visual->class;
#endif
- xconf->base.slow_config = TRUE;
+ xconf->base.slow_config = TRUE;
- count++;
- }
+ count++;
}
xdpy->num_configs = count;