summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2019-11-12 12:18:20 +0200
committerMarius Vlad <marius.vlad@collabora.com>2019-11-21 14:07:54 +0200
commit9ad82d59969d4168721fa2ac1b9c18da8a038414 (patch)
tree96416e47fb8c55405e56f0e7128f5530b4afe74a
parent81bada58db87eb5b726f4e1f4b41b2fce063e650 (diff)
downloadweston-9ad82d59969d4168721fa2ac1b9c18da8a038414.tar.gz
weston-9ad82d59969d4168721fa2ac1b9c18da8a038414.tar.bz2
weston-9ad82d59969d4168721fa2ac1b9c18da8a038414.zip
renderer-gl: Avoid retrieving the EGL image it direct_display flag was set
As we avoid importing the buffer in the GPU, when attaching the buffer we'll not have a valid image to retrieve it from, and as such we'll avoid touching and setting the surface state shader. This adds also 'direct_display' to the surface state and with it, sets the surface state 'direct_display' member whenever the imported buffer will have the direct-display member set. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--libweston/renderer-gl/gl-renderer.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
index 57bd2223..35b278d4 100644
--- a/libweston/renderer-gl/gl-renderer.c
+++ b/libweston/renderer-gl/gl-renderer.c
@@ -171,6 +171,7 @@ struct gl_surface_state {
int pitch; /* in pixels */
int height; /* in pixels */
bool y_inverted;
+ bool direct_display;
/* Extension needed for SHM YUV texture */
int offset[3]; /* offset per plane */
@@ -1804,6 +1805,7 @@ gl_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
gs->buffer_type = BUFFER_TYPE_SHM;
gs->needs_full_upload = true;
gs->y_inverted = true;
+ gs->direct_display = false;
gs->surface = es;
@@ -2425,6 +2427,13 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
egl_image_unref(gs->images[i]);
gs->num_images = 0;
+ gs->pitch = buffer->width;
+ gs->height = buffer->height;
+ gs->buffer_type = BUFFER_TYPE_EGL;
+ gs->y_inverted = buffer->y_inverted;
+ gs->direct_display = dmabuf->direct_display;
+ surface->is_opaque = dmabuf_is_opaque(dmabuf);
+
/*
* We try to always hold an imported EGLImage from the dmabuf
* to prevent the client from preventing re-imports. But, we also
@@ -2433,6 +2442,9 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
*
* Here we release the cache reference which has to be final.
*/
+ if (dmabuf->direct_display)
+ return;
+
image = linux_dmabuf_buffer_get_user_data(dmabuf);
/* The dmabuf_image should have been created during the import */
@@ -2461,11 +2473,6 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
}
gs->shader = image->shader;
- gs->pitch = buffer->width;
- gs->height = buffer->height;
- gs->buffer_type = BUFFER_TYPE_EGL;
- gs->y_inverted = buffer->y_inverted;
- surface->is_opaque = dmabuf_is_opaque(dmabuf);
}
static void
@@ -2493,6 +2500,7 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
gs->num_textures = 0;
gs->buffer_type = BUFFER_TYPE_NULL;
gs->y_inverted = true;
+ gs->direct_display = false;
es->is_opaque = false;
return;
}
@@ -2751,6 +2759,7 @@ gl_renderer_create_surface(struct weston_surface *surface)
*/
gs->pitch = 1;
gs->y_inverted = true;
+ gs->direct_display = false;
gs->surface = surface;