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

Submitted by Derek Foreman on Oct. 16, 2014, 3:55 p.m.

Details

Message ID 1413474938-2407-14-git-send-email-derekf@osg.samsung.com
State Changes Requested
Headers show

Not browsing as part of any series.

Commit Message

Derek Foreman Oct. 16, 2014, 3:55 p.m.
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(-)

Patch hide | download patch | download mbox

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);

Comments

On 10/16/2014 08:55 AM, Derek Foreman wrote:
>  we still do our
> own test here because the pixman check misses a few opportunities when the
> display is flipped.

I have a patch posted to the pixman list to fix this, though I am not 
sure what is happening there or if they will use it. It also makes the 
down-scale filtering work.