diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2009-10-27 16:15:54 +0800 |
---|---|---|
committer | Chia-I Wu <olvaffe@gmail.com> | 2009-10-27 17:45:13 +0800 |
commit | f457f7a31c03f218cdcb31108fefb343d6be14a8 (patch) | |
tree | a44a14177d08286f192e3ec4f9d1102e405bf44b /src/egl/drivers/android/egl_android.c | |
parent | 11ff6a0e6f18d434ae0f9502ae0711977db6c22e (diff) |
egl_android: Decide image config by matching the native pixmap.
Diffstat (limited to 'src/egl/drivers/android/egl_android.c')
-rw-r--r-- | src/egl/drivers/android/egl_android.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/egl/drivers/android/egl_android.c b/src/egl/drivers/android/egl_android.c index c1bc1f3224..d8eb5fd463 100644 --- a/src/egl/drivers/android/egl_android.c +++ b/src/egl/drivers/android/egl_android.c @@ -412,14 +412,30 @@ droid_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, { struct droid_egl_display *droid_dpy = lookup_display(dpy); struct droid_egl_image *droid_img; - const __DRIconfig *dri_conf; - int depth; + struct droid_egl_config *droid_conf; + _EGLConfig *conf; + EGLint val, i; + /* only EGL_KHR_image_pixmap is supported */ if (target != EGL_NATIVE_PIXMAP_KHR || ctx) { _eglError(EGL_BAD_PARAMETER, "eglCreateImageKHR"); return NULL; } + for (i = 0; i < dpy->NumConfigs; i++) { + conf = dpy->Configs[i]; + if (droid_dpy->backend->match_pixmap(droid_dpy->backend, conf, + (NativePixmapType) buffer)) { + EGLint val; + val = GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB); + val |= GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA); + if (val) + break; + } + } + if (i >= dpy->NumConfigs) + return NULL; + droid_img = calloc(1, sizeof(*droid_img)); if (!droid_img) { _eglError(EGL_BAD_ALLOC, "eglCreateImageKHR"); @@ -433,23 +449,15 @@ droid_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, droid_img->surface = droid_dpy->backend->create_image_surface(droid_dpy->backend, - (NativePixmapType) buffer, - &depth); + (NativePixmapType) buffer); if (!droid_img->surface) { free(droid_img); return NULL; } - dri_conf = droid_dpy->screen->image_configs[depth]; - if (!dri_conf) { - droid_dpy->backend->destroy_surface(droid_dpy->backend, - droid_img->surface); - free(droid_img); - return NULL; - } - + droid_conf = lookup_config(conf); droid_img->drawable = - droid_screen_create_drawable(droid_dpy->screen, dri_conf, + droid_screen_create_drawable(droid_dpy->screen, droid_conf->config, droid_img->surface); if (!droid_img->drawable) { |