diff --git a/sunshine/platform/linux/cuda.cpp b/sunshine/platform/linux/cuda.cpp index 5c79acde..cdcaba57 100644 --- a/sunshine/platform/linux/cuda.cpp +++ b/sunshine/platform/linux/cuda.cpp @@ -213,9 +213,8 @@ public: return -1; } - this->sws = std::move(*sws_opt); - - return 0; + sws = std::move(*sws_opt); + return sws.blank(fb, 0, 0, frame->width, frame->height); } int convert(platf::img_t &img) override { diff --git a/sunshine/platform/linux/graphics.cpp b/sunshine/platform/linux/graphics.cpp index 3e0594b8..8d31e37b 100644 --- a/sunshine/platform/linux/graphics.cpp +++ b/sunshine/platform/linux/graphics.cpp @@ -739,6 +739,20 @@ std::optional sws_t::make(int in_width, int in_height, int out_width, int return std::move(sws); } +int sws_t::blank(gl::frame_buf_t &fb, int offsetX, int offsetY, int width, int height) { + auto f = [&]() { + std::swap(offsetX, this->offsetX); + std::swap(offsetY, this->offsetY); + std::swap(width, this->out_width); + std::swap(height, this->out_height); + }; + + f(); + auto fg = util::fail_guard(f); + + return convert(fb); +} + std::optional sws_t::make(int in_width, int in_height, int out_width, int out_heigth) { auto tex = gl::tex_t::make(2); gl::ctx.BindTexture(GL_TEXTURE_2D, tex[0]); diff --git a/sunshine/platform/linux/graphics.h b/sunshine/platform/linux/graphics.h index 5599d9a4..2cc24b01 100644 --- a/sunshine/platform/linux/graphics.h +++ b/sunshine/platform/linux/graphics.h @@ -282,6 +282,9 @@ public: // Convert the loaded image into the first two framebuffers int convert(gl::frame_buf_t &fb); + // Make an area of the image black + int blank(gl::frame_buf_t &fb, int offsetX, int offsetY, int width, int height); + void load_ram(platf::img_t &img); void load_vram(img_descriptor_t &img, int offset_x, int offset_y, int texture);