diff options
author | Joonbum Ko <joonbum.ko@samsung.com> | 2019-06-03 06:21:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2019-06-03 06:21:58 +0000 |
commit | 685ebcc62f6a43d67939ce05bde6aebe7f683e43 (patch) | |
tree | 9110b6ee071df926297c28c88436f5f06d5abac1 | |
parent | e235e1fe2cc6046cac22135c9779b5630eeb8a3c (diff) | |
parent | 670d77331c986a92bcf2459567ccd6dfc181bc66 (diff) | |
download | mesa-685ebcc62f6a43d67939ce05bde6aebe7f683e43.tar.gz mesa-685ebcc62f6a43d67939ce05bde6aebe7f683e43.tar.bz2 mesa-685ebcc62f6a43d67939ce05bde6aebe7f683e43.zip |
Merge "Fix resize issue 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." into tizen
-rw-r--r-- | include/GL/internal/dri_interface.h | 5 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 1 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_tizen.c | 29 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/st_api.h | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 22 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_drawable.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_drawable.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_manager.c | 34 |
8 files changed, 111 insertions, 3 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index f2e46f65f92..ea9e560896a 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -49,7 +49,7 @@ typedef struct drm_clip_rect drm_clip_rect_t; #endif #include <stdint.h> - +#include <stdbool.h> /** * \name DRI interface structures * @@ -1114,6 +1114,9 @@ struct __DRIdri2LoaderExtensionRec { * \since 4 */ unsigned (*getCapability)(void *loaderPrivate, enum dri_loader_cap cap); +#ifdef HAVE_TIZEN_PLATFORM + bool (*validate)(__DRIdrawable *driDrawable, void *loaderPrivate); +#endif }; /** diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index b77f97b3944..48473874f90 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -315,6 +315,7 @@ struct dri2_egl_surface __DRIimage *dri_image_front; int buffer_count; + bool valid; #endif #if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || defined(HAVE_TIZEN_PLATFORM) diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c index 648f1669f84..f9dcbf2790a 100644 --- a/src/egl/drivers/dri2/platform_tizen.c +++ b/src/egl/drivers/dri2/platform_tizen.c @@ -182,6 +182,7 @@ tizen_window_dequeue_buffer(struct dri2_egl_surface *dri2_surf) 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); @@ -348,7 +349,7 @@ tizen_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, 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); @@ -483,6 +484,21 @@ update_buffers(struct dri2_egl_surface *dri2_surf) 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"); @@ -1027,6 +1043,16 @@ tizen_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate) { } +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) @@ -1355,6 +1381,7 @@ static const __DRIdri2LoaderExtension tizen_dri2_loader_extension = { .getBuffers = NULL, .getBuffersWithFormat = tizen_get_buffers_with_format, .flushFrontBuffer = tizen_flush_front_buffer, + .validate = tizen_validate_drawable, }; static const __DRIimageLoaderExtension tizen_image_loader_extension = { diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 2b63b8a3d2a..0426e699beb 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -347,6 +347,9 @@ struct st_framebuffer_iface struct pipe_resource **out); boolean (*flush_swapbuffers) (struct st_context_iface *stctx, struct st_framebuffer_iface *stfbi); +#ifdef HAVE_TIZEN_PLATFORM + boolean (*validate_drawable)(struct st_framebuffer_iface *stfbi); +#endif }; /** diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 930d440a1e2..cabd20b4cc0 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -440,6 +440,25 @@ dri2_release_buffer(__DRIscreen *sPriv, __DRIbuffer *bPriv) /* * Backend functions for st_framebuffer interface. */ +#ifdef HAVE_TIZEN_PLATFORM +static bool dri2_validate_drawable(struct dri_drawable *drawable) +{ + __DRIdrawable *dri_drawable = drawable->dPriv; + const __DRIdri2LoaderExtension *loader = drawable->sPriv->dri2.loader; + + if (loader && loader->validate != NULL) { + boolean valid = (loader->validate)(dri_drawable, dri_drawable->loaderPrivate); + if (valid == FALSE) /*drawable may be resized, not valid anymore*/ { + drawable->dPriv->lastStamp = drawable->dPriv->dri2.stamp; + drawable->texture_mask = 0; + } + return valid; + } + else + return TRUE; +} +#endif + static void dri2_allocate_textures(struct dri_context *ctx, @@ -2074,6 +2093,9 @@ dri2_create_buffer(__DRIscreen * sPriv, 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 TRUE; } diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 92047584224..1caead110df 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -43,6 +43,20 @@ static uint32_t drifb_ID = 0; static void swap_fences_unref(struct dri_drawable *draw); +#ifdef HAVE_TIZEN_PLATFORM +static boolean +dri_st_framebuffer_validate_drawable(struct st_framebuffer_iface *stfbi) +{ + struct dri_drawable *drawable = + (struct dri_drawable *) stfbi->st_manager_private; + + if (drawable->validate_drawable == NULL) + return TRUE; + else + return drawable->validate_drawable(drawable); +} +#endif + static boolean dri_st_framebuffer_validate(struct st_context_iface *stctx, struct st_framebuffer_iface *stfbi, @@ -162,6 +176,9 @@ dri_create_buffer(__DRIscreen * sPriv, 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->base.st_manager_private = (void *) drawable; drawable->screen = screen; diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h index 7c45004ba64..b21645ac417 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.h +++ b/src/gallium/state_trackers/dri/dri_drawable.h @@ -87,6 +87,9 @@ struct dri_drawable struct pipe_resource *res); void (*flush_swapbuffers)(struct dri_context *ctx, struct dri_drawable *drawable); +#ifdef HAVE_TIZEN_PLATFORM + bool (*validate_drawable)(struct dri_drawable *drawable); +#endif }; static inline struct dri_drawable * diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 5efbd1fa1d2..52897dfc1cc 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -203,7 +203,11 @@ st_set_ws_renderbuffer_surface(struct st_renderbuffer *strb, */ static void st_framebuffer_validate(struct st_framebuffer *stfb, - struct st_context *st) + struct st_context *st +#ifdef HAVE_TIZEN_PLATFORM + , boolean valid +#endif + ) { struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; uint width, height; @@ -212,7 +216,11 @@ st_framebuffer_validate(struct st_framebuffer *stfb, int32_t new_stamp; new_stamp = p_atomic_read(&stfb->iface->stamp); +#ifdef HAVE_TIZEN_PLATFORM + if (valid == TRUE && stfb->iface_stamp == new_stamp) +#else if (stfb->iface_stamp == new_stamp) +#endif return; memset(textures, 0, stfb->num_statts * sizeof(textures[0])); @@ -1061,6 +1069,9 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi, struct st_context *st = (struct st_context *) stctxi; struct st_framebuffer *stdraw, *stread; boolean ret; +#ifdef HAVE_TIZEN_PLATFORM + boolean valid = TRUE; +#endif if (st) { /* reuse or create the draw fb */ @@ -1078,10 +1089,24 @@ st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi, st_framebuffer_reference(&stread, stdraw); } +#ifdef HAVE_TIZEN_PLATFORM + if (stdraw->iface->validate_drawable) + valid = stdraw->iface->validate_drawable(stdraw->iface); +#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->Base, &stread->Base); @@ -1157,10 +1182,17 @@ st_manager_validate_framebuffers(struct st_context *st) struct st_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer); struct st_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer); +#ifdef HAVE_TIZEN_PLATFORM + if (stdraw) + st_framebuffer_validate(stdraw, st, TRUE); + if (stread && stread != stdraw) + st_framebuffer_validate(stread, st, 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); } |