[RFC v1 4/4] video-stream: Force stream creation for a valid dmabuf fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the drawable contains a valid dmabuf fd, then a stream needs
to be created for all the display channels.

Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Cc: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
Cc: Dongwon Kim <dongwon.kim@xxxxxxxxx>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx>
---
 server/video-stream.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/video-stream.cpp b/server/video-stream.cpp
index 056d0c31..5edc7472 100644
--- a/server/video-stream.cpp
+++ b/server/video-stream.cpp
@@ -213,18 +213,20 @@ static bool is_next_stream_frame(const Drawable *candidate,
                                  const VideoStream *stream,
                                  int container_candidate_allowed)
 {
-    RedDrawable *red_drawable;
+    RedDrawable *red_drawable = candidate->red_drawable.get();
 
     if (!candidate->streamable) {
         return FALSE;
     }
+    if (red_drawable->dmabuf_fd > 0) {
+        return TRUE;
+    }
 
     if (candidate->creation_time - other_time >
             (stream ? RED_STREAM_CONTINUOUS_MAX_DELTA : RED_STREAM_DETECTION_MAX_DELTA)) {
         return FALSE;
     }
 
-    red_drawable = candidate->red_drawable.get();
     if (!container_candidate_allowed) {
         SpiceRect* candidate_src;
 
@@ -371,6 +373,7 @@ static void display_channel_create_stream(DisplayChannel *display, Drawable *dra
     DisplayChannelClient *dcc;
     VideoStream *stream;
     SpiceRect* src_rect;
+    bool added = false;
 
     spice_assert(!drawable->stream);
 
@@ -407,6 +410,10 @@ static void display_channel_create_stream(DisplayChannel *display, Drawable *dra
     display->priv->stream_count++;
     FOREACH_DCC(display, dcc) {
         dcc_create_stream(dcc, stream);
+        added = true;
+    }
+    if (!added) {
+        display_channel_encode_done(display, drawable->red_drawable.get());
     }
     spice_debug("stream %d %dx%d (%d, %d) (%d, %d) %u fps",
                 display_channel_get_video_stream_id(display, stream), stream->width,
@@ -442,7 +449,8 @@ static bool video_stream_add_frame(DisplayChannel *display,
         frame_drawable->last_gradual_frame = last_gradual_frame;
     }
 
-    if (is_stream_start(frame_drawable)) {
+    if (is_stream_start(frame_drawable) ||
+        frame_drawable->red_drawable->dmabuf_fd > 0) {
         display_channel_create_stream(display, frame_drawable);
         return TRUE;
     }
-- 
2.37.2




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]