summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhaowei Yuan <zhaowei.yuan@samsung.com>2019-04-26 17:09:34 +0800
committerSooChan Lim <sc1.lim@samsung.com>2019-04-29 01:50:36 +0000
commitf409ef598976a4fd4f74ab4695478b1fc1651c06 (patch)
tree1bcdcf07881d6382b99478362cda98e354be11f0
parentdf676e1ffc3dab6ce316e463d773a51cbba0dde3 (diff)
downloadmesa-f409ef598976a4fd4f74ab4695478b1fc1651c06.tar.gz
mesa-f409ef598976a4fd4f74ab4695478b1fc1651c06.tar.bz2
mesa-f409ef598976a4fd4f74ab4695478b1fc1651c06.zip
Patch includes: 1. Add EGL_PBUFFER_BIT to surface_type if maskes match 2. Alloc local buffer when render buffer type is "FRONT_LEFT" which will be used by Pbuffer Change-Id: I8cb2b7776a334f96cf67408b81c8325bd9b46bf9 Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
-rw-r--r--src/egl/drivers/dri2/platform_tizen.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index ad145b62ee2..0d33138e2e7 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -52,6 +52,13 @@
#include <drm_fourcc.h>
int tbm_bufmgr_fd = -1;
+struct rgba_masks {
+ unsigned int red;
+ unsigned int green;
+ unsigned int blue;
+ unsigned int alpha;
+};
+
static void tizen_free_local_buffers(struct dri2_egl_surface *dri2_surf);
/* createImageFromFds requires fourcc format */
@@ -359,7 +366,6 @@ tizen_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
tpl_surf_type = TPL_SURFACE_TYPE_WINDOW;
} else if (type == EGL_PIXMAP_BIT) {
-
if (!native_window) {
_eglError(EGL_BAD_NATIVE_PIXMAP, "tizen_create_surface needs valid native pixmap");
goto cleanup_surface;
@@ -376,17 +382,16 @@ tizen_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
}
tpl_surf_type = TPL_SURFACE_TYPE_PIXMAP;
- } else {
- _eglError(EGL_BAD_NATIVE_WINDOW, "tizen_create_surface does not support PBuffer");
- goto cleanup_surface;
}
- dri2_surf->tpl_surface = tpl_surface_create(dri2_dpy->tpl_display,
+ if(type == EGL_WINDOW_BIT || type == EGL_PIXMAP_BIT) {
+ dri2_surf->tpl_surface = tpl_surface_create(dri2_dpy->tpl_display,
(tpl_handle_t)native_window,
tpl_surf_type,
dri2_surf->tbm_format);
- if (!dri2_surf->tpl_surface)
- goto cleanup_surface;
+ if (!dri2_surf->tpl_surface)
+ goto cleanup_surface;
+ }
if (dri2_dpy->dri2) {
createNewDrawable = dri2_dpy->dri2->createNewDrawable;
@@ -464,7 +469,8 @@ tizen_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
- tpl_object_unreference((tpl_object_t *)dri2_surf->tpl_surface);
+ if (dri2_surf->tpl_surface)
+ tpl_object_unreference((tpl_object_t *)dri2_surf->tpl_surface);
free(dri2_surf);
@@ -1047,6 +1053,9 @@ tizen_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf,
break;
}
/* fall through for pbuffers */
+ case __DRI_BUFFER_FRONT_LEFT:
+ if (dri2_surf->base.Type != EGL_PBUFFER_BIT)
+ break;
case __DRI_BUFFER_DEPTH:
case __DRI_BUFFER_STENCIL:
case __DRI_BUFFER_ACCUM:
@@ -1059,7 +1068,6 @@ tizen_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf,
num_buffers++;
}
break;
- case __DRI_BUFFER_FRONT_LEFT:
case __DRI_BUFFER_FRONT_RIGHT:
case __DRI_BUFFER_FAKE_FRONT_LEFT:
case __DRI_BUFFER_FAKE_FRONT_RIGHT:
@@ -1232,6 +1240,11 @@ tizen_add_configs(_EGLDriver *drv, _EGLDisplay *dpy)
int count, i;
for (i = 0, count = 0; dri2_dpy->driver_configs[i]; i++) {
+ static const struct rgba_masks pbuffer_masks[] = {
+ { 0xff0000, 0xff00, 0xff, 0xff000000 }, /* ARGB8888 */
+ { 0xff0000, 0xff00, 0xff, 0x0 }, /* RGB888 */
+ { 0x00f800, 0x07e0, 0x1f, 0x0 }, /* RGB565 */
+ };
struct dri2_egl_config *dri2_cfg;
unsigned int red, blue, green, alpha, depth;
int surface_type = 0;
@@ -1241,6 +1254,8 @@ tizen_add_configs(_EGLDriver *drv, _EGLDisplay *dpy)
EGL_NONE,
};
tpl_result_t res;
+ struct rgba_masks masks;
+ int j;
dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
__DRI_ATTRIB_RED_SIZE, &red);
@@ -1265,6 +1280,27 @@ tizen_add_configs(_EGLDriver *drv, _EGLDisplay *dpy)
if (res == TPL_ERROR_NONE)
surface_type |= EGL_PIXMAP_BIT;
+ dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
+ __DRI_ATTRIB_RED_MASK, &masks.red);
+ dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
+ __DRI_ATTRIB_GREEN_MASK, &masks.green);
+ dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
+ __DRI_ATTRIB_BLUE_MASK, &masks.blue);
+ dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[i],
+ __DRI_ATTRIB_ALPHA_MASK, &masks.alpha);
+
+ for (j = 0; j < ARRAY_SIZE(pbuffer_masks); j++) {
+ const struct rgba_masks *pbuffer_mask = &pbuffer_masks[j];
+
+ if (pbuffer_mask->red == masks.red &&
+ pbuffer_mask->green == masks.green &&
+ pbuffer_mask->blue == masks.blue &&
+ pbuffer_mask->alpha == masks.alpha) {
+ surface_type |= EGL_PBUFFER_BIT;
+ break;
+ }
+ }
+
if (!surface_type)
continue;