[gnome-remote-desktop] rdp/rdpgfx: Allow surfaces to be created without an hwaccel session



commit 331f30c1311c0f24db47d4aa01462cc2f0fb4c73
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Fri Mar 4 11:24:39 2022 +0100

    rdp/rdpgfx: Allow surfaces to be created without an hwaccel session
    
    For certain surfaces, gnome-remote-desktop will create in the future
    render surfaces.
    These surfaces will use the NVENC (hwaccel) session of the mapped
    surface and therefore don't need their own NVENC session, so don't
    create it for them.

 src/grd-rdp-gfx-surface.c       | 6 ++++++
 src/grd-rdp-gfx-surface.h       | 3 +++
 src/grd-rdp-graphics-pipeline.c | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-rdp-gfx-surface.c b/src/grd-rdp-gfx-surface.c
index 1216164e..edd38846 100644
--- a/src/grd-rdp-gfx-surface.c
+++ b/src/grd-rdp-gfx-surface.c
@@ -83,6 +83,12 @@ grd_rdp_gfx_surface_get_height (GrdRdpGfxSurface *gfx_surface)
   return gfx_surface->height;
 }
 
+gboolean
+grd_rdp_gfx_surface_disallows_hwaccel_sessions (GrdRdpGfxSurface *gfx_surface)
+{
+  return !!(gfx_surface->flags & GRD_RDP_GFX_SURFACE_FLAG_NO_HWACCEL_SESSIONS);
+}
+
 GrdRdpGfxSurface *
 grd_rdp_gfx_surface_get_render_surface (GrdRdpGfxSurface *gfx_surface)
 {
diff --git a/src/grd-rdp-gfx-surface.h b/src/grd-rdp-gfx-surface.h
index 6195ad20..26dcdc4e 100644
--- a/src/grd-rdp-gfx-surface.h
+++ b/src/grd-rdp-gfx-surface.h
@@ -33,6 +33,7 @@ typedef enum _GrdRdpGfxSurfaceFlag
 {
   GRD_RDP_GFX_SURFACE_FLAG_NONE = 0,
   GRD_RDP_GFX_SURFACE_FLAG_ALIGNED_SIZE = 1 << 0,
+  GRD_RDP_GFX_SURFACE_FLAG_NO_HWACCEL_SESSIONS = 1 << 1,
 } GrdRdpGfxSurfaceFlag;
 
 typedef struct _GrdRdpGfxSurfaceDescriptor
@@ -64,6 +65,8 @@ uint16_t grd_rdp_gfx_surface_get_width (GrdRdpGfxSurface *gfx_surface);
 
 uint16_t grd_rdp_gfx_surface_get_height (GrdRdpGfxSurface *gfx_surface);
 
+gboolean grd_rdp_gfx_surface_disallows_hwaccel_sessions (GrdRdpGfxSurface *gfx_surface);
+
 GrdRdpGfxSurface *grd_rdp_gfx_surface_get_render_surface (GrdRdpGfxSurface *gfx_surface);
 
 void grd_rdp_gfx_surface_override_render_surface (GrdRdpGfxSurface *gfx_surface,
diff --git a/src/grd-rdp-graphics-pipeline.c b/src/grd-rdp-graphics-pipeline.c
index 1190cde2..00e3ea29 100644
--- a/src/grd-rdp-graphics-pipeline.c
+++ b/src/grd-rdp-graphics-pipeline.c
@@ -142,7 +142,8 @@ grd_rdp_graphics_pipeline_create_surface (GrdRdpGraphicsPipeline *graphics_pipel
   g_hash_table_insert (graphics_pipeline->serial_surface_table,
                        GUINT_TO_POINTER (surface_serial), surface_context);
 
-  if ((rdpgfx_context->rdpcontext->settings->GfxAVC444v2 ||
+  if (!grd_rdp_gfx_surface_disallows_hwaccel_sessions (gfx_surface) &&
+      (rdpgfx_context->rdpcontext->settings->GfxAVC444v2 ||
        rdpgfx_context->rdpcontext->settings->GfxAVC444 ||
        rdpgfx_context->rdpcontext->settings->GfxH264) &&
       graphics_pipeline->hwaccel_nvidia &&


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