Handle 1x1 issue for driimage
When evas resize window after dequeue, then draw and swapbuffers,
window is shown with old size until next makecurrent.
Add validate_drawable function to check if resize happen each time
makecurrent is called.
For RPI4, render node is used, so buffer is allocated on another
device, when 1x1 issue happen, we need to make sure if driimage
size is changed, then created new if yes.
Merged Commit:
commit
2dc471b0e167693b81c24c9a3f89b985cb98249f
Author: Zhaowei Yuan <zhaowei.yuan@samsung.com>
- Check if stdraw is NULL before access
Variable "stdraw" could be NULL in some case, check it before access.
commit
cc2dc99365906ea52b645be3bb10f50708d67e84
Author: Xuelian Bai <xuelian.bai@samsung.com>
- Fix 1x1 issue of task-mgr
Makecurrent is called just before resize callback is called, so we
have to check if size is changed when drawcall.
commit
670d77331c986a92bcf2459567ccd6dfc181bc66
Author: Xuelian Bai <xuelian.bai@samsung.com>
- Fix resize issue
Change-Id: Ieaebe72661a081d496ab6214c1c1526f7d16f19b
Signed-Off-by: Xuelian Bai <xuelian.bai@samsung.com>
- Handle 1x1 issue for driimage
Change-Id: Id5a463a8db290ca5b80c130ebcdcb13c7786d70c
Signed-off-by: Xuelian Bai <xuelian.bai@samsung.com>
#include <stdbool.h>
#include <stdint.h>
-
+#include <stdbool.h>
/**
* \name DRI interface structures
*
* \since 5
*/
void (*destroyLoaderImageState)(void *loaderPrivate);
+#ifdef HAVE_TIZEN_PLATFORM
+ bool (*validate)(__DRIdrawable *driDrawable, void *loaderPrivate);
+#endif
};
/**
* \since 4
*/
void (*destroyLoaderImageState)(void *loaderPrivate);
+#ifdef HAVE_TIZEN_PLATFORM
+ bool (*validate)(__DRIdrawable *driDrawable, void *loaderPrivate);
+#endif
+
};
/**
__DRIimage *dri_image_front;
int buffer_count;
+ bool valid;
#endif
#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || defined(HAVE_TIZEN_PLATFORM)
if (!dri2_surf->tbm_surface)
return EGL_FALSE;
+ dri2_surf->valid = true;
tbm_surface_internal_ref(dri2_surf->tbm_surface);
tpl_surface_get_size(dri2_surf->tpl_surface, &width, &height);
goto cleanup_surface;
}
dri2_surf->native_win = native_window;
-
+ dri2_surf->valid = true;
dri2_dpy->core->getConfigAttrib(config, __DRI_ATTRIB_DEPTH_SIZE, &depth);
dri2_dpy->core->getConfigAttrib(config, __DRI_ATTRIB_ALPHA_SIZE, &alpha);
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
return 0;
+ if (dri2_surf->valid == false) {
+ int i;
+ if (dri2_surf->tbm_surface) {
+ tpl_surface_cancel_dequeued_buffer(dri2_surf->tpl_surface,
+ dri2_surf->tbm_surface);
+ tbm_surface_internal_unref(dri2_surf->tbm_surface);
+ for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
+ dri2_surf->color_buffers[i].tbm_surface = NULL;
+ dri2_surf->color_buffers[i].age = 0;
+ }
+
+ dri2_surf->back = NULL;
+ dri2_surf->tbm_surface = NULL;
+ }
+ }
/* try to dequeue the next back buffer */
if (!dri2_surf->tbm_surface && !tizen_window_dequeue_buffer(dri2_surf)) {
_eglLog(_EGL_WARNING, "Could not dequeue buffer from native window");
int fourcc, pitch;
int offset = 0, fd;
tbm_surface_info_s surf_info;
+ EGLBoolean query;
+ int width, height;
- if (dri2_surf->dri_image_back)
- return 0;
+ if (dri2_surf->dri_image_back) {
+ query = dri2_dpy->image->queryImage(dri2_surf->dri_image_back, __DRI_IMAGE_ATTRIB_WIDTH, &width);
+ query &= dri2_dpy->image->queryImage(dri2_surf->dri_image_back, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
+
+ if (width == dri2_surf->base.Width && height == dri2_surf->base.Height)
+ return 0;
+ else {
+ dri2_dpy->image->destroyImage(dri2_surf->dri_image_back);
+ dri2_surf->dri_image_back = NULL;
+ }
+ }
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
if (!dri2_surf->tbm_surface) {
{
}
+static bool
+tizen_validate_drawable(__DRIdrawable * driDrawable, void *loaderPrivate)
+{
+ struct dri2_egl_surface *dri2_surf = loaderPrivate;
+ bool v = tpl_surface_validate(dri2_surf->tpl_surface);
+
+ dri2_surf->valid = v;
+ return v;
+}
+
static int
tizen_get_buffers_parse_attachments(struct dri2_egl_surface *dri2_surf,
unsigned int *attachments, int count)
.getBuffers = NULL,
.getBuffersWithFormat = tizen_get_buffers_with_format,
.flushFrontBuffer = tizen_flush_front_buffer,
+ .validate = tizen_validate_drawable,
};
static const __DRIimageLoaderExtension tizen_image_loader_extension = {
.getBuffers = tizen_image_get_buffers,
.flushFrontBuffer = tizen_flush_front_buffer,
+ .validate = tizen_validate_drawable,
};
static const __DRIswrastLoaderExtension tizen_swrast_loader_extension = {
/*
* Backend functions for pipe_frontend_drawable.
*/
+#ifdef HAVE_TIZEN_PLATFORM
+static bool dri2_validate_drawable(struct dri_drawable *drawable)
+{
+ const __DRIdri2LoaderExtension *loader = drawable->screen->dri2.loader;
+
+ if (loader && loader->validate != NULL) {
+ bool valid = (loader->validate)(opaque_dri_drawable(drawable), drawable->loaderPrivate);
+ if (valid == false) /*drawable may be resized, not valid anymore*/ {
+ drawable->lastStamp = drawable->base.stamp;
+ drawable->texture_mask = 0;
+ }
+ return valid;
+ }
+ else {
+ const __DRIimageLoaderExtension *image_loader = drawable->screen->image.loader;
+ if (image_loader && image_loader->validate != NULL) {
+ bool valid = (image_loader->validate)(opaque_dri_drawable(drawable),drawable->loaderPrivate);
+ if (valid == false) /*drawable may be resized, not valid anymore*/ {
+ drawable->lastStamp = drawable->base.stamp;
+ drawable->texture_mask = 0;
+ }
+ return valid;
+ }
+ return true;
+ }
+
+}
+#endif
+
static void
dri2_allocate_textures(struct dri_context *ctx,
drawable->flush_frontbuffer = dri2_flush_frontbuffer;
drawable->update_tex_buffer = dri2_update_tex_buffer;
drawable->flush_swapbuffers = dri2_flush_swapbuffers;
-
+#ifdef HAVE_TIZEN_PLATFORM
+ drawable->validate_drawable = dri2_validate_drawable;
+#endif
return drawable;
}
static uint32_t drifb_ID = 0;
+#ifdef HAVE_TIZEN_PLATFORM
+static bool
+dri_st_framebuffer_validate_drawable(struct pipe_frontend_drawable *pdrawable)
+{
+ struct dri_drawable *drawable = (struct dri_drawable *)pdrawable;
+ if (drawable->validate_drawable == NULL)
+ return true;
+ else
+ return drawable->validate_drawable(drawable);
+}
+#endif
+
static bool
dri_st_framebuffer_validate(struct st_context *st,
struct pipe_frontend_drawable *pdrawable,
drawable->base.flush_front = dri_st_framebuffer_flush_front;
drawable->base.validate = dri_st_framebuffer_validate;
drawable->base.flush_swapbuffers = dri_st_framebuffer_flush_swapbuffers;
+#ifdef HAVE_TIZEN_PLATFORM
+ drawable->base.validate_drawable = dri_st_framebuffer_validate_drawable;
+#endif
drawable->screen = screen;
struct dri_drawable *drawable);
void (*swap_buffers)(struct dri_drawable *drawable);
+#ifdef HAVE_TIZEN_PLATFORM
+ bool (*validate_drawable)(struct dri_drawable *drawable);
+#endif
};
/* Typecast the opaque pointer to our own type. */
unsigned count,
struct pipe_resource **out,
struct pipe_resource **resolve);
+#ifdef HAVE_TIZEN_PLATFORM
+ bool (*validate_drawable)(struct pipe_frontend_drawable *drawable);
+#endif
bool (*flush_swapbuffers)(struct st_context *st,
struct pipe_frontend_drawable *drawable);
} clip;
struct pipe_blit_info blit;
+#ifdef HAVE_TIZEN_PLATFORM
+ st_manager_validate_framebuffers(st, true);
+#else
st_manager_validate_framebuffers(st);
+#endif
/* Make sure bitmap rendering has landed in the framebuffers */
st_flush_bitmap_cache(st);
GLuint i;
/* Window framebuffer changes are received here. */
+#ifdef HAVE_TIZEN_PLATFORM
+ st_manager_validate_framebuffers(st, true);
+#else
st_manager_validate_framebuffers(st);
+#endif
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
+#if 0 /*Move this function to header file to be used by other files*/
static inline struct gl_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
return fb;
return NULL;
}
+#endif
/**
* Map an attachment to a buffer index.
*/
static void
st_framebuffer_validate(struct gl_framebuffer *stfb,
- struct st_context *st)
+ struct st_context *st
+#ifdef HAVE_TIZEN_PLATFORM
+ , bool valid
+#endif
+ )
{
struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
struct pipe_resource *resolve = NULL;
int32_t new_stamp;
new_stamp = p_atomic_read(&stfb->drawable->stamp);
+#ifdef HAVE_TIZEN_PLATFORM
+ if (valid == GL_TRUE && stfb->drawable_stamp == new_stamp)
+#else
if (stfb->drawable_stamp == new_stamp)
+#endif
return;
memset(textures, 0, stfb->num_statts * sizeof(textures[0]));
{
struct gl_framebuffer *stdraw, *stread;
bool ret;
+#ifdef HAVE_TIZEN_PLATFORM
+ bool valid = true;
+#endif
if (st) {
/* reuse or create the draw fb */
if ((stdrawi && !stdraw) || (streadi && !stread))
return false;
+#ifdef HAVE_TIZEN_PLATFORM
+ if (stdraw && stdraw->drawable->validate_drawable)
+ valid = stdraw->drawable->validate_drawable(stdraw->drawable);
+#endif
+
if (stdraw && stread) {
+#ifdef HAVE_TIZEN_PLATFORM
+ st_framebuffer_validate(stdraw, st, valid);
+#else
st_framebuffer_validate(stdraw, st);
+#endif
+
if (stread != stdraw)
+#ifdef HAVE_TIZEN_PLATFORM
+ st_framebuffer_validate(stread, st, true);
+#else
st_framebuffer_validate(stread, st);
+#endif
ret = _mesa_make_current(st->ctx, stdraw, stread);
/**
* Re-validate the framebuffers.
*/
+#ifdef HAVE_TIZEN_PLATFORM
+void
+st_manager_validate_framebuffers(struct st_context *st, bool valid)
+#else
void
st_manager_validate_framebuffers(struct st_context *st)
+#endif
{
struct gl_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer);
struct gl_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer);
+#ifdef HAVE_TIZEN_PLATFORM
+ if (stdraw)
+ st_framebuffer_validate(stdraw, st, valid);
+ if (stread && stread != stdraw)
+ st_framebuffer_validate(stread, st, GL_TRUE);
+#else
if (stdraw)
st_framebuffer_validate(stdraw, st);
if (stread && stread != stdraw)
st_framebuffer_validate(stread, st);
+#endif
st_context_validate(st, stdraw, stread);
}
struct gl_renderbuffer;
struct pipe_surface;
+
+static inline struct gl_framebuffer *
+st_ws_framebuffer(struct gl_framebuffer *fb)
+{
+ /* FBO cannot be casted. See st_new_framebuffer */
+ if (fb && _mesa_is_winsys_fbo(fb) &&
+ fb != _mesa_get_incomplete_framebuffer())
+ return fb;
+ return NULL;
+}
+
void
st_manager_flush_frontbuffer(struct st_context *st);
+#ifdef HAVE_TIZEN_PLATFORM
+void
+st_manager_validate_framebuffers(struct st_context *st, bool valid);
+#else
void
st_manager_validate_framebuffers(struct st_context *st);
+#endif
bool
st_manager_add_color_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,