Skip to content

Commit

Permalink
let the capture instance tell the shadow server when there are no scr…
Browse files Browse the repository at this point in the history
…een updates since the last refresh then the shadow server can skip calling damage

git-svn-id: https://xpra.org/svn/Xpra/trunk@19157 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 2, 2018
1 parent 58a6573 commit 9a406ce
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/xpra/codecs/nvfbc/fbc_capture_linux.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ cdef class NvFBC_SysCapture:
log("NvFBCToSysGrabFrame(%#x)=%i", <uintptr_t> &self.grab, ret)
cdef double end = monotonic_time()
log("NvFBCToSysGrabFrame: framebuffer=%#x, info=%s, elapsed=%ims", <uintptr_t> self.framebuffer, get_frame_grab_info(&self.grab_info), int((end-start)*1000))
return bool(self.grab_info.bIsNewFrame)

def get_image(self, unsigned int x=0, unsigned int y=0, unsigned int width=0, unsigned int height=0):
log("get_image%s", (x, y, width, height))
Expand Down Expand Up @@ -672,6 +673,7 @@ cdef class NvFBC_CUDACapture:
raise Exception("CUDA Grab Frame failed: %s" % CUDA_ERRORS_INFO.get(res, res))
cdef double end = monotonic_time()
log("NvFBCCudaGrabFrame: info=%s, elapsed=%ims", get_frame_grab_info(&self.grab_info), int((end-start)*1000))
return bool(self.grab_info.bIsNewFrame)

def get_image(self, x=0, y=0, width=0, height=0):
log("get_image%s", (x, y, width, height))
Expand Down
6 changes: 6 additions & 0 deletions src/xpra/codecs/nvfbc/fbc_capture_win.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ cdef class NvFBC_SysCapture:
def __dealloc__(self):
self.clean()

def refresh(self):
return True

def get_image(self, x=0, y=0, width=0, height=0):
log("get_image%s", (x, y, width, height))
cdef double start = monotonic_time()
Expand Down Expand Up @@ -704,6 +707,9 @@ cdef class NvFBC_CUDACapture:
def __dealloc__(self):
self.clean()

def refresh(self):
return True

def get_image(self, x=0, y=0, width=0, height=0):
log("get_image%s", (x, y, width, height))
cdef double start = monotonic_time()
Expand Down
6 changes: 6 additions & 0 deletions src/xpra/server/shadow/gtk_shadow_server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def refresh(self):
if not self.mapped:
self.refresh_timer = None
return False
if self.capture:
if not self.capture.refresh():
#capture doesn't have any screen updates,
#so we can skip calling damage
#(this shortcut is only used with nvfbc)
return True
for window in self._id_to_window.values():
w, h = window.get_dimensions()
self._damage(window, 0, 0, w, h)
Expand Down
7 changes: 6 additions & 1 deletion src/xpra/server/shadow/shadow_server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

class ShadowServerBase(RFBServer):

def __init__(self, root_window):
def __init__(self, root_window, capture=None):
self.capture = capture
self.root = root_window
self.mapped = False
self.pulseaudio = False
Expand All @@ -50,6 +51,10 @@ def cleanup(self):
if n:
n.cleanup()
self.notifier = None
capture = self.capture
if capture:
self.capture = None
capture.clean()


def guess_session_name(self, _procs):
Expand Down
14 changes: 2 additions & 12 deletions src/xpra/x11/shadow_x11_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def refresh(self):
if self.xshm:
#discard to ensure we will call XShmGetImage next time around
self.xshm.discard()
return
return True
try:
with xsync:
log("%s.refresh() xshm=%s", self, self.xshm)
Expand Down Expand Up @@ -109,7 +109,7 @@ def clean(self):
pass

def refresh(self):
pass
return True

def get_image(self, x, y, width, height):
v = get_rgb_rawdata(self.window, x, y, width, height)
Expand Down Expand Up @@ -195,7 +195,6 @@ def __init__(self):
X11ServerCore.__init__(self)
self.session_type = "shadow"
self.cursor_poll_timer = None
self.capture = None

def init(self, opts):
GTKShadowServerBase.init(self, opts)
Expand All @@ -204,15 +203,6 @@ def init(self, opts):
def cleanup(self):
GTKShadowServerBase.cleanup(self)
X11ServerCore.cleanup(self)
capture = self.capture
if capture:
self.capture = None
capture.clean()

def refresh(self):
if self.capture:
self.capture.refresh()
return GTKShadowServerBase.refresh(self)


def start_refresh(self):
Expand Down

0 comments on commit 9a406ce

Please sign in to comment.