0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2025-01-09 13:45:21 +00:00
Lakka-LibreELEC/packages/multimedia/ffmpeg/patches/L4T/0013-codecs-nvv4l2-use-sessions-for-transformations.patch
GavinDarkglider 600e246a94 L4T/Ayn: upstream changes from 5.x
Lakka 5.x Switch changes (#1853)
Lakka v5.x switchroot 5.1.2 (#1871)
Fix Switch Issue's in upstream 5.x (#1888)
Minor Switch Changes (#1893)
Lakka v5.x switch 3 (#1895)
Lakka v5.x switch 4 (#1898)
L4T: Xorg-server: Fix build issue (#1924)
Switch: remove ra patch
Lakka v5.x switch 6 (#1926)
Cleanups, More LibreELEC Stuff, more permission fixes, Misc switch stuff. (#1930)
Switch: U-Boot: bump version to 2024-NX02 (#1946)

L4T/Ayn post-upstreaming fixes
- retroarch_joypad_autoconfig: remove spaces from file names
- retroarch: remove Switch specific patch merged upstream
- libXv: move to L4T packages folder (package removed in upstream)
- bring some packages from v5.x to L4T packages
- ffmpeg: remove vulkan
- remove stella core from Switch build (missing C++ headers)
- Ayn/Odin: use proper kernel arg to not hide kernel messages in console
- connman: add wpa_supplicant support back
2024-05-21 15:41:36 +02:00

62 lines
2.3 KiB
Diff

From ac123e70b68b22a99b483ba5b9406e60b35f1519 Mon Sep 17 00:00:00 2001
From: CTCaer <ctcaer@gmail.com>
Date: Fri, 18 Mar 2022 21:53:34 +0000
Subject: [PATCH 13/39] codecs: nvv4l2: use sessions for transformations
Some apps use different processes for init and decoding.
NvBuffer transformations happen on both pids.
So use NvBuffer Session as parameter to id in order to not cause a crash.
That's because nvbuffer_utils can't handle gracefully any error. It just segfaults.
---
libavcodec/nvv4l2_dec.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavcodec/nvv4l2_dec.c b/libavcodec/nvv4l2_dec.c
index e242857b2e..05ae7997fc 100644
--- a/libavcodec/nvv4l2_dec.c
+++ b/libavcodec/nvv4l2_dec.c
@@ -472,8 +472,6 @@ static void *dec_capture_thread(void *arg)
dest_rect.width = ctx->codec_width;
dest_rect.height = ctx->codec_height;
- memset(&transform_params, 0, sizeof(transform_params));
-
/* @transform_flag defines the flags for enabling the
** valid transforms. All the valid parameters are
** present in the nvv4l2_ext_utils header.
@@ -484,6 +482,7 @@ static void *dec_capture_thread(void *arg)
NvBufferTransform_Filter_Smart;
transform_params.src_rect = src_rect;
transform_params.dst_rect = dest_rect;
+ transform_params.session = ctx->buf_session;
pthread_mutex_lock(&ctx->queue_lock);
@@ -704,6 +703,9 @@ nvv4l2_ctx_t *nvv4l2_create_decoder(AVCodecContext *avctx,
/* Get NvBuffer pixel format list version */
ctx->pixfmt_list_ver = nvv4l2_get_pixfmt_list_version(ctx);
+ /* Get a NvBuffer session for interprocess transforms */
+ ctx->buf_session = NvBufferSessionCreate();
+
/* Decoder code assumes that the following do not change.
** If another memory type is wanted, relevant changes should be done
** to the rest of the code.
@@ -858,6 +860,10 @@ int nvv4l2_decoder_close(AVCodecContext *avctx, nvv4l2_ctx_t *ctx)
}
}
+ /* Destroy NvBuffer session. */
+ if (ctx->buf_session)
+ NvBufferSessionDestroy(ctx->buf_session);
+
NVFREE(ctx->export_pool);
/* Close the opened V4L2 device. */
--
2.25.1