diff --git a/src/grd-egl-thread.c b/src/grd-egl-thread.c index 4b36cccda2ca4a9dbf5d7a3150b8c93db9586b5a..ebff9605f252a14a313e5ea8920da7768639e6aa 100644 --- a/src/grd-egl-thread.c +++ b/src/grd-egl-thread.c @@ -56,7 +56,6 @@ typedef struct _GrdEglTask GFunc func; GDestroyNotify destroy; - GMainContext *callback_context; GrdEglThreadCallback callback; gpointer callback_user_data; GDestroyNotify callback_destroy; @@ -140,9 +139,6 @@ typedef struct _GrdEglTaskDownload uint64_t *modifiers; } GrdEglTaskDownload; -typedef void (* GrdEglFrameReady) (uint8_t *data, - gpointer user_data); - static gboolean is_hardware_accelerated (void) { diff --git a/src/grd-rdp-buffer-pool.c b/src/grd-rdp-buffer-pool.c index c4a5dcbe4b1325ee1448e03a341b654e16cc1b75..847333fbf12a7c7ae623defe27cc31d7fb206046 100644 --- a/src/grd-rdp-buffer-pool.c +++ b/src/grd-rdp-buffer-pool.c @@ -119,7 +119,7 @@ grd_rdp_buffer_pool_resize_buffers (GrdRdpBufferPool *buffer_pool, static gboolean buffer_has_mapped_data (GrdRdpBuffer *buffer) { - if (buffer->mapped_cuda_pointer) + if (grd_rdp_buffer_get_mapped_cuda_pointer (buffer)) return TRUE; return FALSE; @@ -250,7 +250,7 @@ unmap_untaken_buffers (gpointer user_data) (gpointer *) &buffer_info)) { if (!buffer_info->buffer_taken) - grd_rdp_buffer_unmap_resources (buffer); + grd_rdp_buffer_queue_resource_unmap (buffer); } g_mutex_unlock (&buffer_pool->pool_mutex); diff --git a/src/grd-rdp-buffer.c b/src/grd-rdp-buffer.c index 9439f559db0d588a45e9e767bb5140c813efaafd..f474069ae3553755adf6b388f48b3295070c37ac 100644 --- a/src/grd-rdp-buffer.c +++ b/src/grd-rdp-buffer.c @@ -21,8 +21,6 @@ #include "grd-rdp-buffer.h" -#include - #include "grd-egl-thread.h" #include "grd-hwaccel-nvidia.h" #include "grd-rdp-buffer-pool.h" @@ -39,7 +37,7 @@ typedef struct typedef struct { GrdHwAccelNvidia *hwaccel_nvidia; - GrdRdpBuffer *buffer; + GrdRdpBuffer *rdp_buffer; } AllocateBufferData; typedef struct @@ -49,19 +47,38 @@ typedef struct CUstream cuda_stream; } UnmapBufferData; +struct _GrdRdpBuffer +{ + GrdRdpBufferPool *buffer_pool; + + GrdEglThread *egl_thread; + GrdHwAccelNvidia *hwaccel_nvidia; + + uint32_t width; + uint32_t height; + + uint8_t *local_data; + + uint32_t pbo; + + CUgraphicsResource cuda_resource; + CUstream cuda_stream; + CUdeviceptr mapped_cuda_pointer; +}; + static gboolean cuda_allocate_buffer (gpointer user_data, uint32_t pbo) { AllocateBufferData *data = user_data; - GrdRdpBuffer *buffer = data->buffer; + GrdRdpBuffer *rdp_buffer = data->rdp_buffer; gboolean success; success = grd_hwaccel_nvidia_register_read_only_gl_buffer (data->hwaccel_nvidia, - &buffer->cuda_resource, + &rdp_buffer->cuda_resource, pbo); if (success) - buffer->pbo = pbo; + rdp_buffer->pbo = pbo; return success; } @@ -90,34 +107,34 @@ grd_rdp_buffer_new (GrdRdpBufferPool *buffer_pool, uint32_t stride, gboolean preallocate_on_gpu) { - GrdRdpBuffer *buffer; + g_autoptr (GrdRdpBuffer) rdp_buffer = NULL; gboolean success = TRUE; - buffer = g_new0 (GrdRdpBuffer, 1); - buffer->buffer_pool = buffer_pool; - buffer->egl_thread = egl_thread; - buffer->hwaccel_nvidia = hwaccel_nvidia; + rdp_buffer = g_new0 (GrdRdpBuffer, 1); + rdp_buffer->buffer_pool = buffer_pool; + rdp_buffer->egl_thread = egl_thread; + rdp_buffer->hwaccel_nvidia = hwaccel_nvidia; - buffer->cuda_stream = cuda_stream; + rdp_buffer->cuda_stream = cuda_stream; - buffer->width = width; - buffer->height = height; - buffer->local_data = g_malloc0 (stride * height * sizeof (uint8_t)); + rdp_buffer->width = width; + rdp_buffer->height = height; + rdp_buffer->local_data = g_malloc0 (stride * height * sizeof (uint8_t)); if (preallocate_on_gpu && - buffer->hwaccel_nvidia) + rdp_buffer->hwaccel_nvidia) { AllocateBufferData data = {}; GrdSyncPoint sync_point = {}; - g_assert (buffer->egl_thread); + g_assert (rdp_buffer->egl_thread); grd_sync_point_init (&sync_point); - data.hwaccel_nvidia = buffer->hwaccel_nvidia; - data.buffer = buffer; + data.hwaccel_nvidia = rdp_buffer->hwaccel_nvidia; + data.rdp_buffer = rdp_buffer; - grd_egl_thread_allocate (buffer->egl_thread, - buffer->height, + grd_egl_thread_allocate (rdp_buffer->egl_thread, + rdp_buffer->height, stride, cuda_allocate_buffer, &data, @@ -130,9 +147,9 @@ grd_rdp_buffer_new (GrdRdpBufferPool *buffer_pool, } if (!success) - g_clear_pointer (&buffer, grd_rdp_buffer_free); + return NULL; - return buffer; + return g_steal_pointer (&rdp_buffer); } static void @@ -152,37 +169,108 @@ cuda_deallocate_buffer (gpointer user_data) data->cuda_stream); } -static void -clear_buffers (GrdRdpBuffer *buffer) +void +grd_rdp_buffer_free (GrdRdpBuffer *rdp_buffer) { - if (buffer->cuda_resource) + if (rdp_buffer->cuda_resource) { ClearBufferData *data; data = g_new0 (ClearBufferData, 1); - data->hwaccel_nvidia = buffer->hwaccel_nvidia; - data->cuda_resource = buffer->cuda_resource; - data->cuda_stream = buffer->cuda_stream; - data->is_mapped = !!buffer->mapped_cuda_pointer; - grd_egl_thread_deallocate (buffer->egl_thread, - buffer->pbo, + data->hwaccel_nvidia = rdp_buffer->hwaccel_nvidia; + data->cuda_resource = rdp_buffer->cuda_resource; + data->cuda_stream = rdp_buffer->cuda_stream; + data->is_mapped = !!rdp_buffer->mapped_cuda_pointer; + grd_egl_thread_deallocate (rdp_buffer->egl_thread, + rdp_buffer->pbo, cuda_deallocate_buffer, data, NULL, data, g_free); - buffer->mapped_cuda_pointer = 0; - buffer->cuda_resource = NULL; - buffer->pbo = 0; + rdp_buffer->mapped_cuda_pointer = 0; + rdp_buffer->cuda_resource = NULL; + rdp_buffer->pbo = 0; } - g_clear_pointer (&buffer->local_data, g_free); + g_clear_pointer (&rdp_buffer->local_data, g_free); + + g_free (rdp_buffer); +} + +uint32_t +grd_rdp_buffer_get_width (GrdRdpBuffer *rdp_buffer) +{ + return rdp_buffer->width; +} + +uint32_t +grd_rdp_buffer_get_height (GrdRdpBuffer *rdp_buffer) +{ + return rdp_buffer->height; +} + +uint8_t * +grd_rdp_buffer_get_local_data (GrdRdpBuffer *rdp_buffer) +{ + return rdp_buffer->local_data; +} + +uint32_t +grd_rdp_buffer_get_pbo (GrdRdpBuffer *rdp_buffer) +{ + return rdp_buffer->pbo; +} + +CUdeviceptr +grd_rdp_buffer_get_mapped_cuda_pointer (GrdRdpBuffer *rdp_buffer) +{ + return rdp_buffer->mapped_cuda_pointer; +} + +void +grd_rdp_buffer_release (GrdRdpBuffer *rdp_buffer) +{ + grd_rdp_buffer_pool_release_buffer (rdp_buffer->buffer_pool, rdp_buffer); +} + +gboolean +grd_rdp_buffer_register_read_only_gl_buffer (GrdRdpBuffer *rdp_buffer, + uint32_t pbo) +{ + gboolean success; + + success = + grd_hwaccel_nvidia_register_read_only_gl_buffer (rdp_buffer->hwaccel_nvidia, + &rdp_buffer->cuda_resource, + pbo); + if (success) + rdp_buffer->pbo = pbo; + + return success; +} + +gboolean +grd_rdp_buffer_map_cuda_resource (GrdRdpBuffer *rdp_buffer) +{ + size_t mapped_size = 0; + + return grd_hwaccel_nvidia_map_cuda_resource (rdp_buffer->hwaccel_nvidia, + rdp_buffer->cuda_resource, + &rdp_buffer->mapped_cuda_pointer, + &mapped_size, + rdp_buffer->cuda_stream); } void -grd_rdp_buffer_free (GrdRdpBuffer *buffer) +grd_rdp_buffer_unmap_cuda_resource (GrdRdpBuffer *rdp_buffer) { - clear_buffers (buffer); - g_free (buffer); + if (!rdp_buffer->mapped_cuda_pointer) + return; + + grd_hwaccel_nvidia_unmap_cuda_resource (rdp_buffer->hwaccel_nvidia, + rdp_buffer->cuda_resource, + rdp_buffer->cuda_stream); + rdp_buffer->mapped_cuda_pointer = 0; } static gboolean @@ -198,31 +286,25 @@ cuda_unmap_resource (gpointer user_data) } void -grd_rdp_buffer_unmap_resources (GrdRdpBuffer *buffer) -{ - if (buffer->mapped_cuda_pointer) - { - UnmapBufferData *data; - - data = g_new0 (UnmapBufferData, 1); - data->hwaccel_nvidia = buffer->hwaccel_nvidia; - data->cuda_resource = buffer->cuda_resource; - data->cuda_stream = buffer->cuda_stream; - grd_egl_thread_run_custom_task (buffer->egl_thread, - cuda_unmap_resource, - data, - NULL, data, g_free); - - /* - * The mapped CUDA pointer indicates whether the resource is mapped, but - * it is itself not needed to unmap the resource. - */ - buffer->mapped_cuda_pointer = 0; - } -} - -void -grd_rdp_buffer_release (GrdRdpBuffer *buffer) +grd_rdp_buffer_queue_resource_unmap (GrdRdpBuffer *rdp_buffer) { - grd_rdp_buffer_pool_release_buffer (buffer->buffer_pool, buffer); + UnmapBufferData *data; + + if (!rdp_buffer->mapped_cuda_pointer) + return; + + data = g_new0 (UnmapBufferData, 1); + data->hwaccel_nvidia = rdp_buffer->hwaccel_nvidia; + data->cuda_resource = rdp_buffer->cuda_resource; + data->cuda_stream = rdp_buffer->cuda_stream; + grd_egl_thread_run_custom_task (rdp_buffer->egl_thread, + cuda_unmap_resource, + data, + NULL, data, g_free); + + /* + * The mapped CUDA pointer indicates whether the resource is mapped, but + * it is itself not needed to unmap the resource. + */ + rdp_buffer->mapped_cuda_pointer = 0; } diff --git a/src/grd-rdp-buffer.h b/src/grd-rdp-buffer.h index 5ff689f5d91430750208b4c913e2a30b2ef36c4c..68dd8bf0e376f821f9fb33f2b3a6e28078837c0b 100644 --- a/src/grd-rdp-buffer.h +++ b/src/grd-rdp-buffer.h @@ -22,29 +22,9 @@ #include #include -#include #include "grd-types.h" -struct _GrdRdpBuffer -{ - GrdRdpBufferPool *buffer_pool; - - GrdEglThread *egl_thread; - GrdHwAccelNvidia *hwaccel_nvidia; - - uint32_t width; - uint32_t height; - - uint8_t *local_data; - - uint32_t pbo; - - CUgraphicsResource cuda_resource; - CUstream cuda_stream; - CUdeviceptr mapped_cuda_pointer; -}; - GrdRdpBuffer *grd_rdp_buffer_new (GrdRdpBufferPool *buffer_pool, GrdEglThread *egl_thread, GrdHwAccelNvidia *hwaccel_nvidia, @@ -54,10 +34,29 @@ GrdRdpBuffer *grd_rdp_buffer_new (GrdRdpBufferPool *buffer_pool, uint32_t stride, gboolean preallocate_on_gpu); -void grd_rdp_buffer_free (GrdRdpBuffer *buffer); +void grd_rdp_buffer_free (GrdRdpBuffer *rdp_buffer); + +uint32_t grd_rdp_buffer_get_width (GrdRdpBuffer *rdp_buffer); + +uint32_t grd_rdp_buffer_get_height (GrdRdpBuffer *rdp_buffer); + +uint8_t *grd_rdp_buffer_get_local_data (GrdRdpBuffer *rdp_buffer); + +uint32_t grd_rdp_buffer_get_pbo (GrdRdpBuffer *rdp_buffer); + +CUdeviceptr grd_rdp_buffer_get_mapped_cuda_pointer (GrdRdpBuffer *rdp_buffer); + +void grd_rdp_buffer_release (GrdRdpBuffer *rdp_buffer); + +gboolean grd_rdp_buffer_register_read_only_gl_buffer (GrdRdpBuffer *rdp_buffer, + uint32_t pbo); + +gboolean grd_rdp_buffer_map_cuda_resource (GrdRdpBuffer *rdp_buffer); + +void grd_rdp_buffer_unmap_cuda_resource (GrdRdpBuffer *rdp_buffer); -void grd_rdp_buffer_unmap_resources (GrdRdpBuffer *buffer); +void grd_rdp_buffer_queue_resource_unmap (GrdRdpBuffer *rdp_buffer); -void grd_rdp_buffer_release (GrdRdpBuffer *buffer); +G_DEFINE_AUTOPTR_CLEANUP_FUNC (GrdRdpBuffer, grd_rdp_buffer_free) #endif /* GRD_RDP_BUFFER_H */ diff --git a/src/grd-rdp-damage-detector-cuda.c b/src/grd-rdp-damage-detector-cuda.c index 74f079779a2b3e798b5e7dbb166e4c86e5a5f161..e828de936a272dbd33f3485ad18c16fdf90ccb76 100644 --- a/src/grd-rdp-damage-detector-cuda.c +++ b/src/grd-rdp-damage-detector-cuda.c @@ -151,6 +151,8 @@ submit_new_framebuffer (GrdRdpDamageDetector *detector, CudaFunctions *cuda_funcs = detector_cuda->cuda_funcs; uint32_t surface_width = detector_cuda->surface_width; uint32_t surface_height = detector_cuda->surface_height; + CUdeviceptr current_data; + CUdeviceptr previous_data; unsigned int grid_dim_x, grid_dim_y, grid_dim_z; unsigned int block_dim_x, block_dim_y, block_dim_z; void *args[8]; @@ -181,6 +183,10 @@ submit_new_framebuffer (GrdRdpDamageDetector *detector, return FALSE; } + current_data = grd_rdp_buffer_get_mapped_cuda_pointer (buffer); + previous_data = + grd_rdp_buffer_get_mapped_cuda_pointer (detector_cuda->last_framebuffer); + /* Threads per blocks */ block_dim_x = 32; block_dim_y = 16; @@ -194,8 +200,8 @@ submit_new_framebuffer (GrdRdpDamageDetector *detector, args[0] = &detector_cuda->damage_array; args[1] = &detector_cuda->region_is_damaged; - args[2] = &buffer->mapped_cuda_pointer; - args[3] = &detector_cuda->last_framebuffer->mapped_cuda_pointer; + args[2] = ¤t_data; + args[3] = &previous_data; args[4] = &surface_width; args[5] = &surface_width; args[6] = &surface_height; diff --git a/src/grd-rdp-damage-detector-memcmp.c b/src/grd-rdp-damage-detector-memcmp.c index e28d5153a2eb931a26d7ac23cc70c85ab8605419..33a15231673310f170ab4f4290ca39a833a74e81 100644 --- a/src/grd-rdp-damage-detector-memcmp.c +++ b/src/grd-rdp-damage-detector-memcmp.c @@ -123,6 +123,7 @@ submit_new_framebuffer (GrdRdpDamageDetector *detector, { for (x = 0; x < detector_memcmp->cols; ++x) { + GrdRdpBuffer *last_framebuffer = detector_memcmp->last_framebuffer; cairo_rectangle_int_t tile; uint8_t tile_damaged = 0; @@ -133,9 +134,8 @@ submit_new_framebuffer (GrdRdpDamageDetector *detector, tile.height = surface_height - tile.y < TILE_HEIGHT ? surface_height - tile.y : TILE_HEIGHT; - if (grd_is_tile_dirty (&tile, - buffer->local_data, - detector_memcmp->last_framebuffer->local_data, + if (grd_is_tile_dirty (&tile, grd_rdp_buffer_get_local_data (buffer), + grd_rdp_buffer_get_local_data (last_framebuffer), surface_width * 4, 4)) { tile_damaged = 1; diff --git a/src/grd-rdp-graphics-pipeline.c b/src/grd-rdp-graphics-pipeline.c index afab6452d2f275dd9b1b564d04ca0741d08a2013..ef1670ef0b89955167c0c01a5c8227400c8ce2f5 100644 --- a/src/grd-rdp-graphics-pipeline.c +++ b/src/grd-rdp-graphics-pipeline.c @@ -551,6 +551,7 @@ refresh_gfx_surface_avc420 (GrdRdpGraphicsPipeline *graphics_pipeline, grd_rdp_gfx_surface_get_render_surface (gfx_surface); GrdRdpGfxFrameController *frame_controller = grd_rdp_gfx_surface_get_frame_controller (gfx_surface); + CUdeviceptr src_data = grd_rdp_buffer_get_mapped_cuda_pointer (buffer); RDPGFX_SURFACE_COMMAND cmd = {0}; RDPGFX_START_FRAME_PDU cmd_start = {0}; RDPGFX_END_FRAME_PDU cmd_end = {0}; @@ -577,7 +578,7 @@ refresh_gfx_surface_avc420 (GrdRdpGraphicsPipeline *graphics_pipeline, if (!grd_hwaccel_nvidia_avc420_encode_bgrx_frame (graphics_pipeline->hwaccel_nvidia, hwaccel_context->encode_session_id, - buffer->mapped_cuda_pointer, + src_data, &rdp_surface->avc.main_view, surface_width, surface_height, aligned_width, aligned_height, @@ -900,7 +901,7 @@ refresh_gfx_surface_rfx_progressive (GrdRdpGraphicsPipeline *graphics_pipeline, rfx_message = rfx_encode_message (graphics_pipeline->rfx_context, rfx_rects, n_rects, - buffer->local_data, + grd_rdp_buffer_get_local_data (buffer), surface_width, surface_height, src_stride); diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c index edc09f6d35dc8b618806d51b921edad5c4d82270..11146635456f02ec26d193dd865dd6b3b714f81b 100644 --- a/src/grd-rdp-pipewire-stream.c +++ b/src/grd-rdp-pipewire-stream.c @@ -82,19 +82,16 @@ struct _GrdRdpFrame typedef struct { - GrdHwAccelNvidia *hwaccel_nvidia; GrdRdpBuffer *rdp_buffer; } UnmapBufferData; typedef struct { - GrdHwAccelNvidia *hwaccel_nvidia; GrdRdpBuffer *rdp_buffer; } AllocateBufferData; typedef struct { - GrdHwAccelNvidia *hwaccel_nvidia; GrdRdpBuffer *rdp_buffer; } RealizeBufferData; @@ -465,7 +462,7 @@ copy_frame_data (GrdRdpFrame *frame, for (y = 0; y < height; ++y) { - memcpy (((uint8_t *) buffer->local_data) + y * dst_stride, + memcpy (grd_rdp_buffer_get_local_data (buffer) + y * dst_stride, ((uint8_t *) src_data) + y * src_stride, width * 4); } @@ -476,26 +473,18 @@ cuda_unmap_resource (gpointer user_data) { UnmapBufferData *data = user_data; - if (!data->rdp_buffer->mapped_cuda_pointer) - return TRUE; - - grd_hwaccel_nvidia_unmap_cuda_resource (data->hwaccel_nvidia, - data->rdp_buffer->cuda_resource, - data->rdp_buffer->cuda_stream); - data->rdp_buffer->mapped_cuda_pointer = 0; + grd_rdp_buffer_unmap_cuda_resource (data->rdp_buffer); return TRUE; } static void -unmap_cuda_resources (GrdEglThread *egl_thread, - GrdHwAccelNvidia *hwaccel_nvidia, - GrdRdpBuffer *rdp_buffer) +unmap_cuda_resources (GrdEglThread *egl_thread, + GrdRdpBuffer *rdp_buffer) { UnmapBufferData *data; data = g_new0 (UnmapBufferData, 1); - data->hwaccel_nvidia = hwaccel_nvidia; data->rdp_buffer = rdp_buffer; grd_egl_thread_run_custom_task (egl_thread, @@ -509,15 +498,8 @@ cuda_allocate_buffer (gpointer user_data, { AllocateBufferData *data = user_data; GrdRdpBuffer *rdp_buffer = data->rdp_buffer; - gboolean success; - - success = grd_hwaccel_nvidia_register_read_only_gl_buffer (data->hwaccel_nvidia, - &rdp_buffer->cuda_resource, - pbo); - if (success) - rdp_buffer->pbo = pbo; - return success; + return grd_rdp_buffer_register_read_only_gl_buffer (rdp_buffer, pbo); } static gboolean @@ -534,13 +516,8 @@ cuda_map_resource (gpointer user_data) { RealizeBufferData *data = user_data; GrdRdpBuffer *rdp_buffer = data->rdp_buffer; - size_t mapped_size = 0; - return grd_hwaccel_nvidia_map_cuda_resource (data->hwaccel_nvidia, - rdp_buffer->cuda_resource, - &rdp_buffer->mapped_cuda_pointer, - &mapped_size, - rdp_buffer->cuda_stream); + return grd_rdp_buffer_map_cuda_resource (rdp_buffer); } static gboolean @@ -621,7 +598,7 @@ process_frame_data (GrdRdpPipeWireStream *stream, return; } rdp_buffer = frame->buffer; - pbo = rdp_buffer->pbo; + pbo = grd_rdp_buffer_get_pbo (rdp_buffer); if (stream->rdp_surface->needs_no_local_data && src_stride == dst_stride) @@ -643,7 +620,7 @@ process_frame_data (GrdRdpPipeWireStream *stream, munmap (map, size); - data_to_upload = rdp_buffer->local_data; + data_to_upload = grd_rdp_buffer_get_local_data (rdp_buffer); } if (!hwaccel_nvidia) @@ -652,14 +629,12 @@ process_frame_data (GrdRdpPipeWireStream *stream, return; } - unmap_cuda_resources (egl_thread, hwaccel_nvidia, rdp_buffer); + unmap_cuda_resources (egl_thread, rdp_buffer); allocate_buffer_data = g_new0 (AllocateBufferData, 1); - allocate_buffer_data->hwaccel_nvidia = hwaccel_nvidia; allocate_buffer_data->rdp_buffer = rdp_buffer; realize_buffer_data = g_new0 (RealizeBufferData, 1); - realize_buffer_data->hwaccel_nvidia = hwaccel_nvidia; realize_buffer_data->rdp_buffer = rdp_buffer; grd_egl_thread_upload (egl_thread, @@ -724,27 +699,24 @@ process_frame_data (GrdRdpPipeWireStream *stream, } if (!stream->rdp_surface->needs_no_local_data) - dst_data = frame->buffer->local_data; + dst_data = grd_rdp_buffer_get_local_data (frame->buffer); if (hwaccel_nvidia) { - unmap_cuda_resources (egl_thread, hwaccel_nvidia, rdp_buffer); + unmap_cuda_resources (egl_thread, rdp_buffer); iface.allocate = allocate_buffer; iface.realize = realize_buffer; import_buffer_data = g_new0 (ImportBufferData, 1); - import_buffer_data->allocate.hwaccel_nvidia = hwaccel_nvidia; import_buffer_data->allocate.rdp_buffer = rdp_buffer; - - import_buffer_data->realize.hwaccel_nvidia = hwaccel_nvidia; import_buffer_data->realize.rdp_buffer = rdp_buffer; import_buffer_data->rdp_buffer = rdp_buffer; } grd_egl_thread_download (egl_thread, - rdp_buffer->pbo, + grd_rdp_buffer_get_pbo (rdp_buffer), height, dst_stride, hwaccel_nvidia ? &iface : NULL, diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c index 718f3c8b5f6eab1767c027c9a13b102147dfae06..ae21e120ec901aa1a757bfd605be26e7cdc515d3 100644 --- a/src/grd-session-rdp.c +++ b/src/grd-session-rdp.c @@ -289,8 +289,8 @@ take_or_encode_frame (GrdSessionRdp *session_rdp, GrdRdpBuffer *buffer) { SessionMetrics *session_metrics = &session_rdp->session_metrics; - uint16_t width = buffer->width; - uint16_t height = buffer->height; + uint16_t width = grd_rdp_buffer_get_width (buffer); + uint16_t height = grd_rdp_buffer_get_height (buffer); if (!session_metrics->received_first_frame) { @@ -779,7 +779,7 @@ rdp_peer_refresh_rfx (GrdSessionRdp *session_rdp, RdpPeerContext *rdp_peer_context = (RdpPeerContext *) peer->context; rdpSettings *rdp_settings = peer->settings; rdpUpdate *rdp_update = peer->update; - uint8_t *data = buffer->local_data; + uint8_t *data = grd_rdp_buffer_get_local_data (buffer); uint32_t src_stride = grd_session_rdp_get_stride_for_width (session_rdp, rdp_surface->width); SURFACE_BITS_COMMAND cmd = {0}; @@ -929,7 +929,7 @@ rdp_peer_refresh_nsc (GrdSessionRdp *session_rdp, RdpPeerContext *rdp_peer_context = (RdpPeerContext *) peer->context; rdpSettings *rdp_settings = peer->settings; rdpUpdate *rdp_update = peer->update; - uint8_t *data = buffer->local_data; + uint8_t *data = grd_rdp_buffer_get_local_data (buffer); uint32_t src_stride = grd_session_rdp_get_stride_for_width (session_rdp, rdp_surface->width); NSCThreadPoolContext *thread_pool_context = @@ -1174,7 +1174,7 @@ rdp_peer_refresh_raw (GrdSessionRdp *session_rdp, RdpPeerContext *rdp_peer_context = (RdpPeerContext *) peer->context; rdpSettings *rdp_settings = peer->settings; rdpUpdate *rdp_update = peer->update; - uint8_t *data = buffer->local_data; + uint8_t *data = grd_rdp_buffer_get_local_data (buffer); uint32_t src_stride = grd_session_rdp_get_stride_for_width (session_rdp, rdp_surface->width); RawThreadPoolContext *thread_pool_context =