[PATCH v3 9/9] widget: modify update-area to not require primary surface

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

 



If egl display is enabled, use GL scanout geometry to check intersection
with the monitor area. This solves displaying GL display without
software canvas (currently d->area is empty and gl drawing fails)

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
Acked-by: Pavel Grunt <pgrunt@xxxxxxxxxx>
---
 src/spice-widget.c | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index fdac085..21b1c14 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2188,32 +2188,47 @@ static void update_area(SpiceDisplay *display,
                         gint x, gint y, gint width, gint height)
 {
     SpiceDisplayPrivate *d = display->priv;
-    GdkRectangle primary = {
-        .x = 0,
-        .y = 0,
-        .width = d->width,
-        .height = d->height
-    };
-    GdkRectangle area = {
+    GdkRectangle primary;
+
+    SPICE_DEBUG("update area +%d+%d %dx%d", x, y, width, height);
+    d->area = (GdkRectangle) {
         .x = x,
         .y = y,
         .width = width,
         .height = height
     };
 
-    SPICE_DEBUG("update area, primary: %dx%d, area: +%d+%d %dx%d", d->width, d->height, area.x, area.y, area.width, area.height);
+#ifndef G_OS_WIN32
+    if (d->egl.enabled) {
+        primary = (GdkRectangle) {
+            .width = d->egl.scanout.width,
+            .height = d->egl.scanout.height
+        };
+    } else
+#endif
+    {
+        primary = (GdkRectangle) {
+            .width = d->width,
+            .height = d->height
+        };
+    }
 
-    if (!gdk_rectangle_intersect(&primary, &area, &area)) {
+    SPICE_DEBUG("primary: %dx%d", primary.width, primary.height);
+    if (!gdk_rectangle_intersect(&primary, &d->area, &d->area)) {
         SPICE_DEBUG("The monitor area is not intersecting primary surface");
         memset(&d->area, '\0', sizeof(d->area));
         set_monitor_ready(display, false);
         return;
     }
 
-    spicex_image_destroy(display);
-    d->area = area;
-    if (gtk_widget_get_realized(GTK_WIDGET(display)))
-        update_image(display);
+#ifndef G_OS_WIN32
+    if (!d->egl.enabled)
+#endif
+    {
+        spicex_image_destroy(display);
+        if (gtk_widget_get_realized(GTK_WIDGET(display)))
+            update_image(display);
+    }
 
     update_size_request(display);
 
-- 
2.5.5

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




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