Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* add missing entry in man page
* use "pixel-depth" switch to tell client if we want deep color support
* change default value of "pixel-depth" to 0 (auto)

git-svn-id: https://xpra.org/svn/Xpra/trunk@16303 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 12, 2017
1 parent 927e90c commit c9584b1
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 19 deletions.
11 changes: 11 additions & 0 deletions src/man/xpra.1
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ xpra \- viewer for remote, persistent X applications
[\fB\-\-idle\-timeout\fP=\fIIDLETIMEOUT\fP]
[\fB\-\-server\-idle\-timeout\fP=\fIIDLETIMEOUT\fP]
[\fB\-\-dpi\fP=\fIVALUE\fP]
[\fB\-\-pixel\-depth\fP=\fIVALUE\fP]
[\fB\-\-input\-method\fP=\fIMETHOD\fP]
[\fB\-\-socket\-dir\fP=\fIDIR\fP]
[\fB\-\-socket\-permissions\fP=\fIACCESS\-MODE\fP]
Expand Down Expand Up @@ -154,6 +155,7 @@ xpra \- viewer for remote, persistent X applications
[\fB\-\-remote\-xpra\fP=\fICMD\fP]
[\fB\-\-password\-file\fP=\fIFILENAME\fP]
[\fB\-\-dpi\fP=\fIVALUE\fP]
[\fB\-\-pixel\-depth\fP=\fIVALUE\fP]
[\fB\-\-mouse\-polling\fP=\fIVALUE\fP]
[\fB\-\-socket\-dir\fP=\fIDIR\fP]
[\fB\-\-socket\-dirs\fP=\fIDIRS\fP]
Expand Down Expand Up @@ -1011,6 +1013,15 @@ Many applications will only read this value when starting up,
so connecting to an existing session started with a different DPI
value may not have the desired effect.
.TP
\fB\-\-pixel\-depth\fP=\fIVALUE\fP
When starting a server, this switch controls the bits per pixel
of the virtual framebuffer. Possible values: 0 (auto), 16, 24, 30.
When starting a client, this switch controls the picture rendering
with the opengl backend: values higher than 24 will enable deep color,
the value 24 enables regular true color rendering. Use the value 0
to let the client decide if the rendering will benefit from using
deep color. (this is only supported on some Posix clients)
Other values should not be used.
\fB\-\-cursors\fP=\fIyes\fP|\fIno\fP
Enable or disable forwarding of custom application mouse cursors.
Client applications may change the mouse cursor at any time, which
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/client/client_widget_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def make_new_backing(self, backing_class, ww, wh, bw, bh):
from xpra.client.fake_window_backing import FakeBacking
bc = FakeBacking
log("make_new_backing%s effective backing class=%s, server alpha=%s, window alpha=%s", (backing_class, ww, wh, ww, wh), bc, self._has_alpha, self._window_alpha)
backing = bc(self._id, self._window_alpha)
backing = bc(self._id, self._window_alpha, self.pixel_depth)
if self._client.mmap_enabled:
backing.enable_mmap(self._client.mmap)
backing.init(ww, wh, bw, bh)
Expand Down
5 changes: 3 additions & 2 deletions src/xpra/client/client_window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

class ClientWindowBase(ClientWidgetBase):

def __init__(self, client, group_leader, wid, x, y, ww, wh, bw, bh, metadata, override_redirect, client_properties, border, max_window_size, default_cursor_data):
log("%s%s", type(self), (client, group_leader, wid, x, y, ww, wh, bw, bh, metadata, override_redirect, client_properties, max_window_size, default_cursor_data))
def __init__(self, client, group_leader, wid, x, y, ww, wh, bw, bh, metadata, override_redirect, client_properties, border, max_window_size, default_cursor_data, pixel_depth):
log("%s%s", type(self), (client, group_leader, wid, x, y, ww, wh, bw, bh, metadata, override_redirect, client_properties, max_window_size, default_cursor_data, pixel_depth))
ClientWidgetBase.__init__(self, client, wid, metadata.boolget("has-alpha"))
self._override_redirect = override_redirect
self.group_leader = group_leader
Expand All @@ -56,6 +56,7 @@ def __init__(self, client, group_leader, wid, x, y, ww, wh, bw, bh, metadata, ov
self.default_cursor_data = default_cursor_data
self.max_window_size = max_window_size
self.button_state = {}
self.pixel_depth = pixel_depth #0 for default

self.init_window(metadata)
self.setup_window(bw, bh)
Expand Down
15 changes: 6 additions & 9 deletions src/xpra/client/gl/gl_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import struct
import time, math

from xpra.os_util import monotonic_time, OSX
from xpra.os_util import monotonic_time, OSX, POSIX
from xpra.util import envint, envbool, repr_ellipsized
from xpra.log import Logger
log = Logger("opengl", "paint")
Expand Down Expand Up @@ -204,7 +204,7 @@ class GLWindowBackingBase(GTKWindowBacking):
RGB_MODES = ["YUV420P", "YUV422P", "YUV444P", "GBRP", "BGRA", "BGRX", "RGBA", "RGBX", "RGB", "BGR"]
HAS_ALPHA = GL_ALPHA_SUPPORTED

def __init__(self, wid, window_alpha):
def __init__(self, wid, window_alpha, pixel_depth=0):
self.wid = wid
self.size = 0, 0
self.render_size = 0, 0
Expand All @@ -228,13 +228,10 @@ def __init__(self, wid, window_alpha):
GTKWindowBacking.__init__(self, wid, window_alpha)
self.init_gl_config(window_alpha)
self.init_backing()
#this is how many bpp we keep in the texture
#OSX workaround (we hacked the bindings are removed this method - oops!)
if hasattr(self.glconfig, "get_depth"):
self.bit_depth = self.glconfig.get_depth()
else:
self.bit_depth = 24
if FORCE_HIGH_BIT_DEPTH or (self.bit_depth==30 and HIGH_BIT_DEPTH):
self.bit_depth = self.glconfig.get_depth()
high_bit_depth = HIGH_BIT_DEPTH and (pixel_depth>24 or (pixel_depth==0 and POSIX and self.bit_depth>24))
log("high_bit_depth=%s (HIGH_BIT_DEPTH=%s, pixel_depth=%i, bit_depth=%i)", high_bit_depth, HIGH_BIT_DEPTH, pixel_depth, self.bit_depth)
if high_bit_depth:
self.texture_pixel_format = GL_RGBA
self.internal_format = GL_RGB10_A2
if "r210" not in GLWindowBackingBase.RGB_MODES:
Expand Down
6 changes: 3 additions & 3 deletions src/xpra/client/gtk_base/gtk_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,9 @@ def err(msg, e):
opengllog("OpenGL initialization error", exc_info=True)
self.GLClientWindowClass = None
self.client_supports_opengl = False
opengllog.warn("%s", msg)
opengllog.error("%s", msg)
for x in str(e).split("\n"):
opengllog.warn(" %s", x)
opengllog.error(" %s", x)
self.opengl_props["info"] = str(e)

if warnings:
Expand Down Expand Up @@ -708,7 +708,7 @@ def err(msg, e):
window = None
try:
w, h = 50, 50
window = self.GLClientWindowClass(self, None, 2**32-1, -100, -100, w, h, w, h, typedict({}), False, typedict({}), self.border, self.max_window_size, self.default_cursor_data)
window = self.GLClientWindowClass(self, None, 2**32-1, -100, -100, w, h, w, h, typedict({}), False, typedict({}), self.border, self.max_window_size, self.default_cursor_data, self.pixel_depth)
window.realize()
pixel_format = "BGRX"
bpp = len(pixel_format)
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/client/gtk_base/gtk_window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ class GTKWindowBacking(WindowBackingBase):

HAS_ALPHA = GTK_ALPHA_SUPPORTED

def __init__(self, wid, window_alpha):
def __init__(self, wid, window_alpha, pixel_depth=0):
WindowBackingBase.__init__(self, wid, window_alpha and self.HAS_ALPHA, glib.idle_add)
7 changes: 6 additions & 1 deletion src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def __init__(self):
self.auto_refresh_delay = -1
self.max_window_size = 0, 0
self.dpi = 0
self.pixel_depth = 0
self.initial_scaling = 1, 1
self.xscale, self.yscale = self.initial_scaling
self.scale_change_embargo = 0
Expand Down Expand Up @@ -339,6 +340,10 @@ def init(self, opts):
self.initial_scaling = self.parse_scaling(opts.desktop_scaling)
self.xscale, self.yscale = self.initial_scaling

self.pixel_depth = int(opts.pixel_depth)
if self.pixel_depth<0 or (self.pixel_depth>0 and self.pixel_depth<24) or (self.pixel_depth>24 and self.pixel_depth<30):
log.warn("Warning: invalid pixel depth %i", self.pixel_depth)
self.pixel_depth = 0
self.dpi = int(opts.dpi)
self.xsettings_enabled = opts.xsettings
if MMAP_SUPPORTED:
Expand Down Expand Up @@ -2850,7 +2855,7 @@ def make_new_window(self, wid, x, y, ww, wh, bw, bh, metadata, override_redirect
windowlog("make_new_window(..) client_window_classes=%s, group_leader_window=%s", client_window_classes, group_leader_window)
for cwc in client_window_classes:
try:
window = cwc(self, group_leader_window, wid, x, y, ww, wh, bw, bh, metadata, override_redirect, client_properties, self.border.clone(), self.max_window_size, self.default_cursor_data)
window = cwc(self, group_leader_window, wid, x, y, ww, wh, bw, bh, metadata, override_redirect, client_properties, self.border.clone(), self.max_window_size, self.default_cursor_data, self.pixel_depth)
break
except:
windowlog.warn("failed to instantiate %s", cwc, exc_info=True)
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def addtrailingslash(v):
"idle-timeout" : 0,
"server-idle-timeout" : 0,
"sync-xvfb" : 0,
"pixel-depth" : 24,
"pixel-depth" : 0,
"uid" : getuid(),
"gid" : getgid(),
"auto-refresh-delay": 0.15,
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ def ignore(defaults):
help="The 'dots per inch' value that client applications should try to honour, from 10 to 1000 or 0 for automatic setting. Default: %s." % print_number(defaults.dpi))
group.add_option("--pixel-depth", action="store",
dest="pixel_depth", default=defaults.pixel_depth,
help="The bits per pixel of the virtual framebuffer (8, 16, 24 or 30). Default: %s." % defaults.pixel_depth)
help="The bits per pixel of the virtual framebuffer when starting a server (8, 16, 24 or 30), or for rendering when starting a client. Default: %s." % (defaults.pixel_depth or "0 (auto)"))
group.add_option("--sync-xvfb", action="store",
dest="sync_xvfb", default=defaults.sync_xvfb,
help="How often to synchronize the virtual framebuffer used for X11 seamless servers (0 to disable). Default: %s." % defaults.sync_xvfb)
Expand Down
2 changes: 2 additions & 0 deletions src/xpra/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def validate_pixel_depth(pixel_depth, starting_desktop=False):
pixel_depth = int(pixel_depth)
except ValueError:
raise InitException("invalid value '%s' for pixel depth, must be a number" % pixel_depth)
if pixel_depth==0:
pixel_depth = 24
if pixel_depth not in (8, 16, 24, 30):
raise InitException("invalid pixel depth: %s" % pixel_depth)
if not starting_desktop and pixel_depth==8:
Expand Down

0 comments on commit c9584b1

Please sign in to comment.