summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c47
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c59
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.h3
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_image.c9
-rw-r--r--src/gallium/state_trackers/egl/common/native.h6
-rw-r--r--src/gallium/state_trackers/egl/gdi/native_gdi.c1
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c85
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c81
-rw-r--r--src/gallium/state_trackers/vega/api_masks.c4
-rw-r--r--src/gallium/state_trackers/vega/renderer.c1
-rw-r--r--src/gallium/state_trackers/vega/shader.c2
-rw-r--r--src/gallium/state_trackers/vega/text.c1
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c2
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c2
14 files changed, 146 insertions, 157 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index a3750ac56f..f2b137a674 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -183,17 +183,21 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
}
surface_type = 0x0;
- if (nconf->window_bit)
- surface_type |= EGL_WINDOW_BIT;
- if (nconf->pixmap_bit)
- surface_type |= EGL_PIXMAP_BIT;
+ /* pixmap surfaces should be EGL_SINGLE_BUFFER */
+ if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) {
+ if (nconf->pixmap_bit)
+ surface_type |= EGL_PIXMAP_BIT;
+ }
+ /* the others surfaces should be EGL_BACK_BUFFER (or settable) */
+ if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) {
+ if (nconf->window_bit)
+ surface_type |= EGL_WINDOW_BIT;
#ifdef EGL_MESA_screen_surface
- if (nconf->scanout_bit)
- surface_type |= EGL_SCREEN_BIT_MESA;
+ if (nconf->scanout_bit)
+ surface_type |= EGL_SCREEN_BIT_MESA;
#endif
-
- if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))
surface_type |= EGL_PBUFFER_BIT;
+ }
conf->Conformant = api_mask;
conf->RenderableType = api_mask;
@@ -226,11 +230,6 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf,
}
conf->Level = nconf->level;
- conf->Samples = nconf->samples;
- conf->SampleBuffers = 0;
-
- if (nconf->slow_config)
- conf->ConfigCaveat = EGL_SLOW_CONFIG;
if (nconf->transparent_rgb) {
conf->TransparentType = EGL_TRANSPARENT_RGB;
@@ -257,13 +256,9 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
int preserve_buffer, int max_swap_interval)
{
struct egl_g3d_config *gconf = egl_g3d_config(conf);
- EGLint buffer_mask, api_mask;
+ EGLint buffer_mask;
EGLBoolean valid;
- /* skip single-buffered configs */
- if (!(nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)))
- return EGL_FALSE;
-
buffer_mask = 0x0;
if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT))
buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
@@ -278,24 +273,14 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
gconf->stvis.color_format = nconf->color_format;
gconf->stvis.depth_stencil_format = depth_stencil_format;
gconf->stvis.accum_format = PIPE_FORMAT_NONE;
- gconf->stvis.samples = nconf->samples;
+ gconf->stvis.samples = 0;
+ /* will be overridden per surface */
gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ?
ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
- api_mask = dpy->ClientAPIsMask;
- /* this is required by EGL, not by OpenGL ES */
- if (nconf->window_bit &&
- gconf->stvis.render_buffer != ST_ATTACHMENT_BACK_LEFT)
- api_mask &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT);
-
- if (!api_mask) {
- _eglLog(_EGL_DEBUG, "no state tracker supports config 0x%x",
- nconf->native_visual_id);
- }
-
valid = init_config_attributes(&gconf->base,
- nconf, api_mask, depth_stencil_format,
+ nconf, dpy->ClientAPIsMask, depth_stencil_format,
preserve_buffer, max_swap_interval);
if (!valid) {
_eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 8e53e1dccb..c9f94a3c49 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -158,17 +158,17 @@ egl_g3d_choose_config(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attribs,
(_EGLArrayForEach) egl_g3d_match_config, (void *) &criteria);
/* perform sorting of configs */
- if (tmp_configs && tmp_size) {
+ if (configs && tmp_size) {
_eglSortConfigs((const _EGLConfig **) tmp_configs, tmp_size,
egl_g3d_compare_config, (void *) &criteria);
- size = MIN2(tmp_size, size);
- for (i = 0; i < size; i++)
+ tmp_size = MIN2(tmp_size, size);
+ for (i = 0; i < tmp_size; i++)
configs[i] = _eglGetConfigHandle(tmp_configs[i]);
}
FREE(tmp_configs);
- *num_configs = size;
+ *num_configs = tmp_size;
return EGL_TRUE;
}
@@ -324,7 +324,8 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
gsurf->stvis = gconf->stvis;
- if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER)
+ if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER &&
+ gconf->stvis.buffer_mask & ST_ATTACHMENT_FRONT_LEFT_MASK)
gsurf->stvis.render_buffer = ST_ATTACHMENT_FRONT_LEFT;
gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);
@@ -402,7 +403,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLConfig *conf, const EGLint *attribs)
{
struct egl_g3d_surface *gsurf;
- struct pipe_resource *ptex = NULL;
gsurf = create_pbuffer_surface(dpy, conf, attribs,
"eglCreatePbufferSurface");
@@ -411,13 +411,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
gsurf->client_buffer_type = EGL_NONE;
- if (!gsurf->stfbi->validate(gsurf->stfbi,
- &gsurf->stvis.render_buffer, 1, &ptex)) {
- egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
- FREE(gsurf);
- return NULL;
- }
-
return &gsurf->base;
}
@@ -477,12 +470,14 @@ egl_g3d_create_pbuffer_from_client_buffer(_EGLDriver *drv, _EGLDisplay *dpy,
gsurf->client_buffer_type = buftype;
gsurf->client_buffer = buffer;
+ /* validate now so that it fails if the client buffer is invalid */
if (!gsurf->stfbi->validate(gsurf->stfbi,
&gsurf->stvis.render_buffer, 1, &ptex)) {
egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
FREE(gsurf);
return NULL;
}
+ pipe_resource_reference(&ptex, NULL);
return &gsurf->base;
}
@@ -643,19 +638,13 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
_EGLContext *ctx = _eglGetCurrentContext();
- struct egl_g3d_config *gconf;
struct native_surface *nsurf;
struct pipe_resource *ptex;
if (!gsurf->render_texture)
return EGL_TRUE;
- gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, target));
- if (!gconf)
- return _eglError(EGL_BAD_NATIVE_PIXMAP, "eglCopyBuffers");
-
- nsurf = gdpy->native->create_pixmap_surface(gdpy->native,
- target, gconf->native);
+ nsurf = gdpy->native->create_pixmap_surface(gdpy->native, target, NULL);
if (!nsurf)
return _eglError(EGL_BAD_NATIVE_PIXMAP, "eglCopyBuffers");
@@ -676,14 +665,13 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
if (ptex) {
- struct pipe_resource *psrc = gsurf->render_texture;
struct pipe_box src_box;
+
u_box_origin_2d(ptex->width0, ptex->height0, &src_box);
- if (psrc) {
- gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0,
- gsurf->render_texture, 0, &src_box);
- nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
- }
+ gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0,
+ gsurf->render_texture, 0, &src_box);
+ gdpy->pipe->flush(gdpy->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+ nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
pipe_resource_reference(&ptex, NULL);
}
@@ -888,25 +876,6 @@ egl_g3d_show_screen_surface(_EGLDriver *drv, _EGLDisplay *dpy,
#endif /* EGL_MESA_screen_surface */
-/**
- * Find a config that supports the pixmap.
- */
-_EGLConfig *
-egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix)
-{
- struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
- struct egl_g3d_config *gconf;
- EGLint i;
-
- for (i = 0; i < dpy->Configs->Size; i++) {
- gconf = egl_g3d_config((_EGLConfig *) dpy->Configs->Elements[i]);
- if (gdpy->native->is_pixmap_supported(gdpy->native, pix, gconf->native))
- break;
- }
-
- return (i < dpy->Configs->Size) ? &gconf->base : NULL;
-}
-
void
egl_g3d_init_driver_api(_EGLDriver *drv)
{
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.h b/src/gallium/state_trackers/egl/common/egl_g3d_api.h
index d5196c12fe..17fd7958aa 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.h
@@ -31,7 +31,4 @@
void
egl_g3d_init_driver_api(_EGLDriver *drv);
-_EGLConfig *
-egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix);
-
#endif /* _EGL_G3D_API_H_ */
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index b2d6b433c5..78c035a2af 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -35,7 +35,6 @@
#include "native.h"
#include "egl_g3d.h"
-#include "egl_g3d_api.h"
#include "egl_g3d_image.h"
/* for struct winsys_handle */
@@ -48,17 +47,11 @@ static struct pipe_resource *
egl_g3d_reference_native_pixmap(_EGLDisplay *dpy, EGLNativePixmapType pix)
{
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
- struct egl_g3d_config *gconf;
struct native_surface *nsurf;
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
enum native_attachment natt;
- gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, pix));
- if (!gconf)
- return NULL;
-
- nsurf = gdpy->native->create_pixmap_surface(gdpy->native,
- pix, gconf->native);
+ nsurf = gdpy->native->create_pixmap_surface(gdpy->native, pix, NULL);
if (!nsurf)
return NULL;
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 3886ca2056..654f445fca 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -126,8 +126,6 @@ struct native_config {
int native_visual_id;
int native_visual_type;
int level;
- int samples;
- boolean slow_config;
boolean transparent_rgb;
int transparent_rgb_values[3];
};
@@ -185,7 +183,9 @@ struct native_display {
const struct native_config *nconf);
/**
- * Create a pixmap surface. Required unless no config has pixmap_bit set.
+ * Create a pixmap surface. The native config may be NULL. In that case, a
+ * "best config" will be picked. Required unless no config has pixmap_bit
+ * set.
*/
struct native_surface *(*create_pixmap_surface)(struct native_display *ndpy,
EGLNativePixmapType pix,
diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index d259e6edc8..2d0450604c 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -319,7 +319,6 @@ gdi_display_get_configs(struct native_display *ndpy, int *num_configs)
nconf->color_format = formats[i];
nconf->window_bit = TRUE;
- nconf->slow_config = TRUE;
}
gdpy->num_configs = count;
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 8108ce4586..adcc3b39d6 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -40,11 +40,6 @@
#ifdef GLX_DIRECT_RENDERING
-enum dri2_surface_type {
- DRI2_SURFACE_TYPE_WINDOW,
- DRI2_SURFACE_TYPE_PIXMAP,
-};
-
struct dri2_display {
struct native_display base;
Display *dpy;
@@ -66,7 +61,6 @@ struct dri2_display {
struct dri2_surface {
struct native_surface base;
Drawable drawable;
- enum dri2_surface_type type;
enum pipe_format color_format;
struct dri2_display *dri2dpy;
@@ -439,12 +433,10 @@ dri2_surface_destroy(struct native_surface *nsurf)
static struct dri2_surface *
dri2_display_create_surface(struct native_display *ndpy,
- enum dri2_surface_type type,
Drawable drawable,
- const struct native_config *nconf)
+ enum pipe_format color_format)
{
struct dri2_display *dri2dpy = dri2_display(ndpy);
- struct dri2_config *dri2conf = dri2_config(nconf);
struct dri2_surface *dri2surf;
dri2surf = CALLOC_STRUCT(dri2_surface);
@@ -452,9 +444,8 @@ dri2_display_create_surface(struct native_display *ndpy,
return NULL;
dri2surf->dri2dpy = dri2dpy;
- dri2surf->type = type;
dri2surf->drawable = drawable;
- dri2surf->color_format = dri2conf->base.color_format;
+ dri2surf->color_format = color_format;
dri2surf->base.destroy = dri2_surface_destroy;
dri2surf->base.present = dri2_surface_present;
@@ -480,8 +471,8 @@ dri2_display_create_window_surface(struct native_display *ndpy,
{
struct dri2_surface *dri2surf;
- dri2surf = dri2_display_create_surface(ndpy, DRI2_SURFACE_TYPE_WINDOW,
- (Drawable) win, nconf);
+ dri2surf = dri2_display_create_surface(ndpy,
+ (Drawable) win, nconf->color_format);
return (dri2surf) ? &dri2surf->base : NULL;
}
@@ -492,8 +483,29 @@ dri2_display_create_pixmap_surface(struct native_display *ndpy,
{
struct dri2_surface *dri2surf;
- dri2surf = dri2_display_create_surface(ndpy, DRI2_SURFACE_TYPE_PIXMAP,
- (Drawable) pix, nconf);
+ if (!nconf) {
+ struct dri2_display *dri2dpy = dri2_display(ndpy);
+ uint depth, nconf_depth;
+ int i;
+
+ depth = x11_drawable_get_depth(dri2dpy->xscr, (Drawable) pix);
+ for (i = 0; i < dri2dpy->num_configs; i++) {
+ nconf_depth = util_format_get_blocksizebits(
+ dri2dpy->configs[i].base.color_format);
+ /* simple depth match for now */
+ if (depth == nconf_depth ||
+ (depth == 24 && depth + 8 == nconf_depth)) {
+ nconf = &dri2dpy->configs[i].base;
+ break;
+ }
+ }
+
+ if (!nconf)
+ return NULL;
+ }
+
+ dri2surf = dri2_display_create_surface(ndpy,
+ (Drawable) pix, nconf->color_format);
return (dri2surf) ? &dri2surf->base : NULL;
}
@@ -548,6 +560,10 @@ dri2_display_convert_config(struct native_display *ndpy,
if (!mode->xRenderable || !mode->drawableType)
return FALSE;
+ /* fast/slow configs are probably not relevant */
+ if (mode->visualRating == GLX_SLOW_CONFIG)
+ return FALSE;
+
nconf->buffer_mask = 1 << NATIVE_ATTACHMENT_FRONT_LEFT;
if (mode->doubleBufferMode)
nconf->buffer_mask |= 1 << NATIVE_ATTACHMENT_BACK_LEFT;
@@ -568,17 +584,33 @@ dri2_display_convert_config(struct native_display *ndpy,
if (nconf->color_format == PIPE_FORMAT_NONE)
return FALSE;
- if (mode->drawableType & GLX_WINDOW_BIT)
+ if ((mode->drawableType & GLX_WINDOW_BIT) && mode->visualID)
nconf->window_bit = TRUE;
if (mode->drawableType & GLX_PIXMAP_BIT)
nconf->pixmap_bit = TRUE;
nconf->native_visual_id = mode->visualID;
- nconf->native_visual_type = mode->visualType;
+ switch (mode->visualType) {
+ case GLX_TRUE_COLOR:
+ nconf->native_visual_type = TrueColor;
+ break;
+ case GLX_DIRECT_COLOR:
+ nconf->native_visual_type = DirectColor;
+ break;
+ case GLX_PSEUDO_COLOR:
+ nconf->native_visual_type = PseudoColor;
+ break;
+ case GLX_STATIC_COLOR:
+ nconf->native_visual_type = StaticColor;
+ break;
+ case GLX_GRAY_SCALE:
+ nconf->native_visual_type = GrayScale;
+ break;
+ case GLX_STATIC_GRAY:
+ nconf->native_visual_type = StaticGray;
+ break;
+ }
nconf->level = mode->level;
- nconf->samples = mode->samples;
-
- nconf->slow_config = (mode->visualRating == GLX_SLOW_CONFIG);
if (mode->transparentPixel == GLX_TRANSPARENT_RGB) {
nconf->transparent_rgb = TRUE;
@@ -614,8 +646,17 @@ dri2_display_get_configs(struct native_display *ndpy, int *num_configs)
count = 0;
for (i = 0; i < num_modes; i++) {
struct native_config *nconf = &dri2dpy->configs[count].base;
- if (dri2_display_convert_config(&dri2dpy->base, modes, nconf))
- count++;
+
+ if (dri2_display_convert_config(&dri2dpy->base, modes, nconf)) {
+ int j;
+ /* look for duplicates */
+ for (j = 0; j < count; j++) {
+ if (memcmp(&dri2dpy->configs[j], nconf, sizeof(*nconf)) == 0)
+ break;
+ }
+ if (j == count)
+ count++;
+ }
modes = modes->next;
}
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 84811fb6e1..d4f4dd04df 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -38,11 +38,6 @@
#include "native_x11.h"
#include "x11_screen.h"
-enum ximage_surface_type {
- XIMAGE_SURFACE_TYPE_WINDOW,
- XIMAGE_SURFACE_TYPE_PIXMAP,
-};
-
struct ximage_display {
struct native_display base;
Display *dpy;
@@ -60,7 +55,6 @@ struct ximage_display {
struct ximage_surface {
struct native_surface base;
Drawable drawable;
- enum ximage_surface_type type;
enum pipe_format color_format;
XVisualInfo visual;
struct ximage_display *xdpy;
@@ -245,7 +239,6 @@ ximage_surface_destroy(struct native_surface *nsurf)
static struct ximage_surface *
ximage_display_create_surface(struct native_display *ndpy,
- enum ximage_surface_type type,
Drawable drawable,
const struct native_config *nconf)
{
@@ -258,7 +251,6 @@ ximage_display_create_surface(struct native_display *ndpy,
return NULL;
xsurf->xdpy = xdpy;
- xsurf->type = type;
xsurf->color_format = xconf->base.color_format;
xsurf->drawable = drawable;
@@ -297,11 +289,37 @@ ximage_display_create_window_surface(struct native_display *ndpy,
{
struct ximage_surface *xsurf;
- xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_WINDOW,
- (Drawable) win, nconf);
+ xsurf = ximage_display_create_surface(ndpy, (Drawable) win, nconf);
return (xsurf) ? &xsurf->base : NULL;
}
+static enum pipe_format
+get_pixmap_format(struct native_display *ndpy, EGLNativePixmapType pix)
+{
+ struct ximage_display *xdpy = ximage_display(ndpy);
+ enum pipe_format fmt;
+ uint depth;
+
+ depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix);
+
+ switch (depth) {
+ case 32:
+ fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
+ break;
+ case 24:
+ fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
+ break;
+ case 16:
+ fmt = PIPE_FORMAT_B5G6R5_UNORM;
+ break;
+ default:
+ fmt = PIPE_FORMAT_NONE;
+ break;
+ }
+
+ return fmt;
+}
+
static struct native_surface *
ximage_display_create_pixmap_surface(struct native_display *ndpy,
EGLNativePixmapType pix,
@@ -309,8 +327,26 @@ ximage_display_create_pixmap_surface(struct native_display *ndpy,
{
struct ximage_surface *xsurf;
- xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_PIXMAP,
- (Drawable) pix, nconf);
+ /* find the config */
+ if (!nconf) {
+ struct ximage_display *xdpy = ximage_display(ndpy);
+ enum pipe_format fmt = get_pixmap_format(&xdpy->base, pix);
+ int i;
+
+ if (fmt != PIPE_FORMAT_NONE) {
+ for (i = 0; i < xdpy->num_configs; i++) {
+ if (xdpy->configs[i].base.color_format == fmt) {
+ nconf = &xdpy->configs[i].base;
+ break;
+ }
+ }
+ }
+
+ if (!nconf)
+ return NULL;
+ }
+
+ xsurf = ximage_display_create_surface(ndpy, (Drawable) pix, nconf);
return (xsurf) ? &xsurf->base : NULL;
}
@@ -384,8 +420,6 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
xconf->base.native_visual_type = xconf->visual->class;
#endif
- xconf->base.slow_config = TRUE;
-
count++;
}
@@ -408,24 +442,7 @@ ximage_display_is_pixmap_supported(struct native_display *ndpy,
const struct native_config *nconf)
{
struct ximage_display *xdpy = ximage_display(ndpy);
- enum pipe_format fmt;
- uint depth;
-
- depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix);
- switch (depth) {
- case 32:
- fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
- break;
- case 24:
- fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
- break;
- case 16:
- fmt = PIPE_FORMAT_B5G6R5_UNORM;
- break;
- default:
- fmt = PIPE_FORMAT_NONE;
- break;
- }
+ enum pipe_format fmt = get_pixmap_format(&xdpy->base, pix);
return (fmt == nconf->color_format);
}
diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c
index beb15c33a5..d96afe6638 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -32,10 +32,6 @@
#include "vg_context.h"
#include "pipe/p_context.h"
-#include "util/u_inlines.h"
-
-#include "util/u_pack_color.h"
-#include "util/u_draw_quad.h"
void vegaMask(VGHandle mask, VGMaskOperation operation,
VGint x, VGint y,
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 7871c516c4..e42bad7649 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -28,7 +28,6 @@
#include "renderer.h"
#include "vg_context.h"
-#include "image.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c
index 0ed721376c..2a6bae8a63 100644
--- a/src/gallium/state_trackers/vega/shader.c
+++ b/src/gallium/state_trackers/vega/shader.c
@@ -34,9 +34,7 @@
#include "renderer.h"
#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
#include "pipe/p_state.h"
-#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_format.h"
diff --git a/src/gallium/state_trackers/vega/text.c b/src/gallium/state_trackers/vega/text.c
index 01ff602f58..6714ee9ad3 100644
--- a/src/gallium/state_trackers/vega/text.c
+++ b/src/gallium/state_trackers/vega/text.c
@@ -30,7 +30,6 @@
#include "text.h"
#include "image.h"
#include "path.h"
-#include "api.h"
#ifdef OPENVG_VERSION_1_1
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 0844012cc3..f36f55d6c8 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -30,7 +30,6 @@
#include "renderer.h"
#include "shaders_cache.h"
#include "shader.h"
-#include "asm_util.h"
#include "vg_manager.h"
#include "api.h"
#include "mask.h"
@@ -40,7 +39,6 @@
#include "cso_cache/cso_context.h"
-#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
#include "util/u_blit.h"
#include "util/u_sampler.h"
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index de935768b2..ec713b7fb1 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -33,14 +33,12 @@
#include "pipe/p_screen.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
-#include "util/u_sampler.h"
#include "util/u_box.h"
#include "util/u_surface.h"
#include "vg_api.h"
#include "vg_manager.h"
#include "vg_context.h"
-#include "image.h"
#include "api.h"
static boolean