Re: [xrandr] Select NearestNeighbour filtering for pixel exact scaling

2016-04-04 Thread Chris Wilson
On Mon, Apr 04, 2016 at 05:11:11PM +0100, Chris Wilson wrote:
> When using pixel-exact scaling from for example running a 3840x2160 monitor
> at 1920x1080 half-resolution upscaling using a bilinear filter
> introduces blur where none is expected.

Missed --scale, this only changes --scale-from.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[xrandr] Select NearestNeighbour filtering for pixel exact scaling

2016-04-04 Thread Chris Wilson
When using pixel-exact scaling from for example running a 3840x2160 monitor
at 1920x1080 half-resolution upscaling using a bilinear filter
introduces blur where none is expected.

References: https://bugs.freedesktop.org/show_bug.cgi?id=94816
Signed-off-by: Chris Wilson 
---
 xrandr.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index dcfdde0..b6b208c 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -1292,6 +1292,7 @@ set_output_info (output_t *output, RROutput xid, 
XRROutputInfo *output_info)
/* for --scale-from, figure out the mode size and compute the transform
 * for the target framebuffer area */
if (output->scale_from_w > 0 && output->mode_info) {
+   XTransform *t = >transform.transform;
double sx = (double)output->scale_from_w /
output->mode_info->width;
double sy = (double)output->scale_from_h /
@@ -1300,10 +1301,10 @@ set_output_info (output_t *output, RROutput xid, 
XRROutputInfo *output_info)
printf("scaling %s by %lfx%lf\n", output->output.string, sx,
   sy);
init_transform (>transform);
-   output->transform.transform.matrix[0][0] = XDoubleToFixed (sx);
-   output->transform.transform.matrix[1][1] = XDoubleToFixed (sy);
-   output->transform.transform.matrix[2][2] = XDoubleToFixed (1.0);
-   if (sx != 1 || sy != 1)
+   t->matrix[0][0] = XDoubleToFixed (sx);
+   t->matrix[1][1] = XDoubleToFixed (sy);
+   t->matrix[2][2] = XDoubleToFixed (1.0);
+   if ((t->matrix[0][0] | t->matrix[1][1]) & 0x)
output->transform.filter = "bilinear";
else
output->transform.filter = "nearest";
-- 
2.8.0.rc3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel