diff options
-rw-r--r-- | include/GL/internal/dri_interface.h | 4 | ||||
-rwxr-xr-x | src/egl/drivers/dri2/platform_tizen.c | 16 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 15 |
3 files changed, 31 insertions, 4 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index ea9e560896a..385db466ecf 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -2030,6 +2030,10 @@ struct __DRIimageLoaderExtensionRec { * \since 3 */ void (*flushSwapBuffers)(__DRIdrawable *driDrawable, void *loaderPrivate); +#ifdef HAVE_TIZEN_PLATFORM + bool (*validate)(__DRIdrawable *driDrawable, void *loaderPrivate); +#endif + }; /** diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c index ddc399596f5..68a78ab4056 100755 --- a/src/egl/drivers/dri2/platform_tizen.c +++ b/src/egl/drivers/dri2/platform_tizen.c @@ -551,9 +551,20 @@ get_back_bo(struct dri2_egl_surface *dri2_surf, unsigned int format) 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) { @@ -1391,6 +1402,7 @@ 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 = { diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index cabd20b4cc0..1bee33247ea 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -454,8 +454,19 @@ static bool dri2_validate_drawable(struct dri_drawable *drawable) } return valid; } - else - return TRUE; + else { + const __DRIimageLoaderExtension *image_loader = drawable->sPriv->image.loader; + if (image_loader && image_loader->validate != NULL) { + boolean valid = (image_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; + } + return TRUE; + } + } #endif |