Skip to content

Commit

Permalink
try to continue without a cuda context
Browse files Browse the repository at this point in the history
using software decoding
  • Loading branch information
totaam committed Nov 24, 2022
1 parent 095e108 commit 7f18954
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions xpra/client/window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def south_y():

def assign_cuda_context(self, opengl=False):
if self.cuda_context is None:
from xpra.codecs.nvjpeg.decoder import get_default_device # @NoMove pylint: disable=no-name-in-module, import-outside-toplevel
from xpra.codecs.nvidia.nvjpeg.decoder import get_default_device # @NoMove pylint: disable=no-name-in-module, import-outside-toplevel
dev = get_default_device()
assert dev
#make this an opengl compatible context:
Expand Down Expand Up @@ -473,10 +473,17 @@ def paint_jpega(self, img_data, x, y, width, height, options, callbacks):
def do_paint_jpeg(self, encoding, img_data, x, y, width, height, options, callbacks):
alpha_offset = options.intget("alpha-offset", 0)
log("do_paint_jpeg: nvjpeg_decoder=%s", self.nvjpeg_decoder)
img = None
if self.nvjpeg_decoder and not alpha_offset:
with self.assign_cuda_context(False):
img = self.nvjpeg_decoder.decompress_and_download("RGB", img_data)
else:
try:
with self.assign_cuda_context(False):
img = self.nvjpeg_decoder.decompress_and_download("RGB", img_data)
except Exception as e:
if first_time(str(e)):
log.error("Error accessing cuda context", exc_info=True)
else:
log("cuda context error, again")
if img is None:
if encoding=="jpeg":
rgb_format = "RGBX"
elif encoding=="jpega":
Expand Down

0 comments on commit 7f18954

Please sign in to comment.