Xpra: Ticket #2191: XPRA_SCALING_INTERPOLATION=nearest not working

XPRA_SCALING_INTERPOLATION=nearest setting doesn't work.

the gdk.INTERP_NEAREST is evaluated as false, so the condition in client/gtk2/pixmap_backing.py doesn't work and don't recognize the setting. Also the warning "Warning: invalid interpolation '%s'" is missing value for the %s placeholder.

But howerer even when I fixed both problems, the picture was still interpolated.

My aim is to have x2 scaling such that thare are 4 same pixels in ouput instead of one pixel in source.



Tue, 05 Mar 2019 01:56:39 GMT - Antoine Martin: owner changed

The code you refer to was actually unused and has now been removed: r21963.

Something similar could be implemented using cairo's set_filter: https://pycairo.readthedocs.io/en/latest/reference/patterns.html.

But you should be using the opengl backend instead, which should be using 'nearest' by default. Why is opengl disabled? What command lines are you using? What OS? etc.


Tue, 05 Mar 2019 09:32:37 GMT - janinko: attachment set

Screenshot detail of the application


Tue, 05 Mar 2019 09:36:15 GMT - janinko:

I'm using run_scaled script: https://github.com/kaueraal/run_scaled/blob/master/run_scaled

Even with --opengl=yes, it doesn't look like I want. You can see in the picture that there are gradients. It shoul all look similarly to the top right corner (2x2 pixels of same color) (this mesh looks OK probably only because of the specific mesh pattern)

Here is output from the script:

2019-03-05 10:28:13,097 Xpra gtk2 client version 2.4.3-r21350 64-bit
2019-03-05 10:28:13,098  running on Linux Fedora 29 TwentyNine
2019-03-05 10:28:13,099  window manager is 'GNOME Shell'
2019-03-05 10:28:13,721 GStreamer version 1.14.4 for Python 2.7.15 64-bit
2019-03-05 10:28:13,802 OpenGL_accelerate module loaded
2019-03-05 10:28:13,805 Using accelerated ArrayDatatype
2019-03-05 10:28:14,023 OpenGL enabled with AMD Radeon (TM) R9 390 Series (HAWAII, DRM 3.27.0, 4.20.12-200.fc29.x86_64, LLVM 7.0.1)
2019-03-05 10:28:14,030  keyboard settings: rules=evdev, model=pc105, layout=us
2019-03-05 10:28:14,031  desktop size is 3840x2160 with 1 screen:
2019-03-05 10:28:14,031   :0.0 (1016x572 mm - DPI: 96x95)
2019-03-05 10:28:14,031     monitor 1 (700x390 mm - DPI: 139x140)
2019-03-05 10:28:14,031  upscaled by 200%, virtual screen size: 1920x1080
2019-03-05 10:28:14,031   :0.0 (1016x572 mm - DPI: 48x47)
2019-03-05 10:28:14,031     monitor 1 (700x390 mm - DPI: 69x70)
2019-03-05 10:28:14,379 enabled fast mmap transfers using 256MB shared memory area
2019-03-05 10:28:14,379 enabled remote logging
2019-03-05 10:28:14,379 Xpra X11 server version 2.4.3-r21350 64-bit
2019-03-05 10:28:14,380  running on Linux Fedora 29 TwentyNine
2019-03-05 10:28:14,383 Attached to :78817481
2019-03-05 10:28:14,383  (press Control-C to detach)

Tue, 05 Mar 2019 09:50:16 GMT - Antoine Martin:

Can you include a screenshot, unscaled, of what it should look like? Can you give us an example of an application that can be used to reproduce the problem?


Tue, 05 Mar 2019 09:56:15 GMT - janinko: attachment set

Detail of the application in original scale


Tue, 05 Mar 2019 09:56:52 GMT - janinko: attachment set

How I expect the detail should look like when scaled.


Tue, 05 Mar 2019 10:02:45 GMT - janinko:

Well I'm trying it with Ultima Online over Wine, but tried it with eog now and still I'm getting interpolation.


Tue, 05 Mar 2019 10:17:26 GMT - Antoine Martin: attachment set

use "nearest" instead of "linear"


Tue, 05 Mar 2019 10:17:49 GMT - Antoine Martin:

@janinko: try the patch attached, does it help or make it worse?


Tue, 05 Mar 2019 23:35:47 GMT - janinko:

I have xpra 2.4.3, and your patch looks for slightly different version (according the line numbers). However making the change didn't help.

I tried playing around in the file and this change did it for me:

@@ -175,9 +175,9 @@
 def set_texture_level(target=GL_TEXTURE_RECTANGLE_ARB):
     #only really needed with some drivers (NVidia)
     #may cause errors with older drivers:
     try:
-        glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+        glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
     except:
         pass

Wed, 06 Mar 2019 04:37:32 GMT - Antoine Martin:

Your change cannot be used because it makes applications like xterms very hard to read with non-integer scaling values (ie: 125%)

How about r21980 instead? Does that work for you? Looks good here. (not tested very thoroughly because I hit #2194)


Mon, 11 Mar 2019 03:13:28 GMT - Antoine Martin: status changed; resolution set


Sat, 23 Jan 2021 05:44:38 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2191