[PATCH weston 7/8] compositor: move texture_damage into renderer private
Pekka Paalanen
ppaalanen at gmail.com
Fri Nov 23 05:56:56 PST 2012
Only the gl_renderer uses this field.
Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
src/compositor.c | 3 ---
src/compositor.h | 1 -
src/gl-renderer.c | 15 +++++++++------
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index 2b55b1e..c45a248 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -238,8 +238,6 @@ weston_surface_create(struct weston_compositor *compositor)
return NULL;
}
- pixman_region32_init(&surface->texture_damage);
-
surface->buffer = NULL;
surface->output = NULL;
surface->plane = &compositor->primary_plane;
@@ -778,7 +776,6 @@ destroy_surface(struct wl_resource *resource)
weston_buffer_reference(&surface->buffer, NULL,
&surface->buffer_destroy_listener);
- pixman_region32_fini(&surface->texture_damage);
compositor->renderer->destroy_surface(surface);
pixman_region32_fini(&surface->transform.boundingbox);
diff --git a/src/compositor.h b/src/compositor.h
index 4a8e5df..01686a2 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -376,7 +376,6 @@ struct weston_region {
struct weston_surface {
struct wl_surface surface;
struct weston_compositor *compositor;
- pixman_region32_t texture_damage;
pixman_region32_t clip;
pixman_region32_t damage;
pixman_region32_t opaque;
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index 8b68dc6..9a1d80a 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -58,6 +58,7 @@ struct gl_surface_state {
GLuint textures[3];
int num_textures;
+ pixman_region32_t texture_damage;
EGLImageKHR images[3];
GLenum target;
@@ -1038,8 +1039,8 @@ gl_renderer_flush_damage(struct weston_surface *surface)
int i, n;
#endif
- pixman_region32_union(&surface->texture_damage,
- &surface->texture_damage, &surface->damage);
+ pixman_region32_union(&gs->texture_damage,
+ &gs->texture_damage, &surface->damage);
if (!gs->buffer)
return;
@@ -1052,7 +1053,7 @@ gl_renderer_flush_damage(struct weston_surface *surface)
if (surface->plane != &surface->compositor->primary_plane)
return;
- if (!pixman_region32_not_empty(&surface->texture_damage))
+ if (!pixman_region32_not_empty(&gs->texture_damage))
goto done;
glBindTexture(GL_TEXTURE_2D, gs->textures[0]);
@@ -1070,7 +1071,7 @@ gl_renderer_flush_damage(struct weston_surface *surface)
/* Mesa does not define GL_EXT_unpack_subimage */
glPixelStorei(GL_UNPACK_ROW_LENGTH, gs->pitch);
data = wl_shm_buffer_get_data(gs->buffer);
- rectangles = pixman_region32_rectangles(&surface->texture_damage, &n);
+ rectangles = pixman_region32_rectangles(&gs->texture_damage, &n);
for (i = 0; i < n; i++) {
glPixelStorei(GL_UNPACK_SKIP_PIXELS, rectangles[i].x1);
glPixelStorei(GL_UNPACK_SKIP_ROWS, rectangles[i].y1);
@@ -1083,8 +1084,8 @@ gl_renderer_flush_damage(struct weston_surface *surface)
#endif
done:
- pixman_region32_fini(&surface->texture_damage);
- pixman_region32_init(&surface->texture_damage);
+ pixman_region32_fini(&gs->texture_damage);
+ pixman_region32_init(&gs->texture_damage);
weston_buffer_reference(&gs->buffer, NULL,
&gs->buffer_destroy_listener);
@@ -1242,6 +1243,7 @@ gl_renderer_create_surface(struct weston_surface *surface)
return -1;
gs->buffer_destroy_listener.notify = gl_renderer_handle_buffer_destroy;
+ pixman_region32_init(&gs->texture_damage);
surface->renderer_state = gs;
@@ -1260,6 +1262,7 @@ gl_renderer_destroy_surface(struct weston_surface *surface)
for (i = 0; i < gs->num_images; i++)
gr->destroy_image(gr->egl_display, gs->images[i]);
+ pixman_region32_fini(&gs->texture_damage);
weston_buffer_reference(&gs->buffer, NULL,
&gs->buffer_destroy_listener);
free(gs);
--
1.7.8.6
More information about the wayland-devel
mailing list