xpra icon
Bug tracker and wiki

Opened 3 weeks ago

Closed 2 weeks ago

#2191 closed defect (worksforme)

XPRA_SCALING_INTERPOLATION=nearest not working

Reported by: janinko Owned by: janinko
Priority: major Milestone: 2.5
Component: client Version: 2.4.x
Keywords: Cc:

Description

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.

Attachments (4)

xpra.png (4.3 KB) - added by janinko 3 weeks ago.
Screenshot detail of the application
xpra-orig.png (1.2 KB) - added by janinko 3 weeks ago.
Detail of the application in original scale
xpra-expected.png (1.4 KB) - added by janinko 3 weeks ago.
How I expect the detail should look like when scaled.
gl-nearest.patch (764 bytes) - added by Antoine Martin 3 weeks ago.
use "nearest" instead of "linear"

Download all attachments as: .zip

Change History (12)

comment:1 Changed 3 weeks ago by Antoine Martin

Owner: changed from Antoine Martin to janinko

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.

Last edited 3 weeks ago by Antoine Martin (previous) (diff)

Changed 3 weeks ago by janinko

Attachment: xpra.png added

Screenshot detail of the application

comment:2 Changed 3 weeks ago by 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)

comment:3 Changed 3 weeks ago by 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?

Changed 3 weeks ago by janinko

Attachment: xpra-orig.png added

Detail of the application in original scale

Changed 3 weeks ago by janinko

Attachment: xpra-expected.png added

How I expect the detail should look like when scaled.

comment:4 Changed 3 weeks ago by janinko

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

Changed 3 weeks ago by Antoine Martin

Attachment: gl-nearest.patch added

use "nearest" instead of "linear"

comment:5 Changed 3 weeks ago by Antoine Martin

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

comment:6 Changed 3 weeks ago by 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

comment:7 Changed 3 weeks ago by 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)

comment:8 Changed 2 weeks ago by Antoine Martin

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.