When red_marshall_gl_draw_stream() fails before dmabuf encoding completes,
leave gl_draw_ongoing set and skip display_channel_gl_draw_done(). This
blocks subsequent GL draws for non-GL clients using the gl_draw stream
path, for example when scanout is unavailable or multi-plane scanout is
not supported by the video encoder.

Clean up the ongoing gl draw on every early return path, matching the
existing encode error handling and the freeze fix in marshall_gl_draw().

Fixes: b2fcf9b3 (dcc-send: Encode and send gl_draw stream data to the remote 
client)
Signed-off-by: yujun <[email protected]>
---
 server/dcc-send.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/dcc-send.cpp b/server/dcc-send.cpp
index aca79fd6..7255f3e4 100644
--- a/server/dcc-send.cpp
+++ b/server/dcc-send.cpp
@@ -1778,12 +1778,16 @@ static void 
red_marshall_gl_draw_stream(DisplayChannelClient *dcc,
 
     if (!agent->video_encoder || !agent->video_encoder->encode_dmabuf) {
         spice_warning("No video encoder available for this stream");
+        dcc->priv->gl_draw_ongoing = false;
+        display_channel_gl_draw_done(display);
         return;
     }
 
     DmabufData *dmabuf_data = new DmabufData;
     if (!dmabuf_data) {
         spice_warning("Cannot create memory for dmabuf data");
+        dcc->priv->gl_draw_ongoing = false;
+        display_channel_gl_draw_done(display);
         return;
     }
 
@@ -1791,6 +1795,8 @@ static void 
red_marshall_gl_draw_stream(DisplayChannelClient *dcc,
     RedGLScanout *scanout = red_qxl_get_gl_scanout(qxl);
     if (!scanout) {
         spice_warning("Cannot access scanout");
+        dcc->priv->gl_draw_ongoing = false;
+        display_channel_gl_draw_done(display);
         delete dmabuf_data;
         return;
     }
@@ -1799,6 +1805,8 @@ static void 
red_marshall_gl_draw_stream(DisplayChannelClient *dcc,
     if (scanout->num_planes > 1) {
         spice_warning("Video encoder Does not support multi plane");
         red_qxl_put_gl_scanout(qxl, scanout);
+        dcc->priv->gl_draw_ongoing = false;
+        display_channel_gl_draw_done(display);
         delete dmabuf_data;
         return;
     }
-- 
2.25.1

Reply via email to