[PATCH weston v2 13/20] renderers: use weston_matrix_needs_filtering to choose filter parameters in gl and pixman renderers

Derek Foreman derekf at osg.samsung.com
Thu Oct 16 08:55:31 PDT 2014


Note: This causes a performance drop when zoomed under pixman.  Also, pixman
has clever optimization algorithms to switch from BILINEAR to NEAREST
automatically when it detects they'll have the same result - we still do our
own test here because the pixman check misses a few opportunities when the
display is flipped.
---
 src/gl-renderer.c     | 11 +++++++++--
 src/pixman-renderer.c |  3 +--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index cfc1e88..e1ad5ca 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -528,6 +528,7 @@ static void
 draw_view(struct weston_view *ev, struct weston_output *output,
 	  pixman_region32_t *damage) /* in global coordinates */
 {
+	struct weston_matrix transform;
 	struct weston_compositor *ec = ev->surface->compositor;
 	struct gl_renderer *gr = get_renderer(ec);
 	struct gl_surface_state *gs = get_surface_state(ev->surface);
@@ -561,9 +562,15 @@ draw_view(struct weston_view *ev, struct weston_output *output,
 
 	use_shader(gr, gs->shader);
 	shader_uniforms(gs->shader, ev, output);
+	transform = ev->surface->buffer_to_surface_matrix;
+	if (ev->transform.enabled)
+		weston_matrix_multiply(&transform, &ev->transform.matrix);
+	else
+		weston_matrix_translate(&transform,
+					ev->geometry.x, ev->geometry.y, 0);
+	weston_matrix_multiply(&transform, &output->matrix);
 
-	if (ev->transform.enabled || output->zoom.active ||
-	    output->current_scale != ev->surface->buffer_viewport.buffer.scale)
+	if (weston_matrix_needs_filtering(&transform))
 		filter = GL_LINEAR;
 	else
 		filter = GL_NEAREST;
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 2f54a64..f6fe3c7 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -161,7 +161,6 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
 		(struct pixman_renderer *) output->compositor->renderer;
 	struct pixman_surface_state *ps = get_surface_state(ev->surface);
 	struct pixman_output_state *po = get_output_state(output);
-	struct weston_buffer_viewport *vp = &ev->surface->buffer_viewport;
 	pixman_region32_t final_region;
 	float view_x, view_y;
 	pixman_transform_t transform;
@@ -216,7 +215,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output,
 	weston_matrix_to_pixman_transform(&transform, &matrix);
 	pixman_image_set_transform(ps->image, &transform);
 
-	if (ev->transform.enabled || output->current_scale != vp->buffer.scale)
+	if (weston_matrix_needs_filtering(&matrix))
 		pixman_image_set_filter(ps->image, PIXMAN_FILTER_BILINEAR, NULL, 0);
 	else
 		pixman_image_set_filter(ps->image, PIXMAN_FILTER_NEAREST, NULL, 0);
-- 
2.1.1



More information about the wayland-devel mailing list