|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for CUDA encoding. More...
#include <bitset>#include <fcntl.h>#include <filesystem>#include <thread>#include <ffnvcodec/dynlink_loader.h>#include <NvFBC.h>#include <libavcodec/avcodec.h>#include <libavutil/hwcontext_cuda.h>#include <libavutil/imgutils.h>#include "cuda.h"#include "graphics.h"#include "src/logging.h"#include "src/utility.h"#include "src/video.h"#include "wayland.h"Classes | |
| class | cuda::nvfbc::ctx_t |
| NvFBC CUDA context selected for a capture session. More... | |
| struct | cuda::cu_resources |
| CUDA frame resources registered for interop conversion. More... | |
| class | cuda::cuda_ram_t |
| CUDA encode device path that converts frames through system memory. More... | |
| class | cuda::cuda_t |
| CUDA encode device that imports captured frames into CUDA memory. More... | |
| class | cuda::cuda_vram_t |
| CUDA encode device path that keeps converted frames in GPU memory. More... | |
| class | cuda::nvfbc::display_t |
| NvFBC display capture backend that produces CUDA frames. More... | |
| class | cuda::gl_cuda_vram_t |
| OpenGL/CUDA interop resources used for GPU-side frame conversion. More... | |
| class | cuda::nvfbc::handle_t |
| NvFBC dynamic-library handle and function table. More... | |
| class | cuda::img_t |
| CUDA image wrapper that owns mapped graphics resources for one frame. More... | |
Macros | |
| #define | CU_CHECK(x, y) |
| Macro for CU CHECK. | |
| #define | CU_CHECK_IGNORE(x, y) |
| Macro for CU CHECK IGNORE. | |
| #define | SUNSHINE_STRINGVIEW(x) |
| Macro for SUNSHINE STRINGVIEW. | |
| #define | SUNSHINE_STRINGVIEW_HELPER(x) |
| Macro for SUNSHINE STRINGVIEW HELPER. | |
Typedefs | |
| using | cuda::cdf_t = util::safe_ptr<CudaFunctions, cff> |
| Handle to a CUDA dynamic-library function table. | |
| using | cuda::registered_resource_t = util::safe_ptr<CUgraphicsResource_st, unregisterResource> |
CUDA graphics resource pointer released with cuGraphicsUnregisterResource. | |
Functions | |
| void | cuda::cff (CudaFunctions *cf) |
| Release a Core Foundation object when the wrapper is destroyed. | |
| void | cuda::freeStream (CUstream stream) |
| Release stream resources. | |
| int | cuda::init () |
| Map CUDA graphics resources for use as an image. | |
| int | cuda::nvfbc::init () |
| Load NvFBC and create the CUDA capture helper. | |
| std::unique_ptr< platf::avcodec_encode_device_t > | cuda::make_avcodec_encode_device (int width, int height, bool vram) |
| Create AVCodec encode device. | |
| std::unique_ptr< platf::avcodec_encode_device_t > | cuda::make_avcodec_gl_encode_device (int width, int height, int offset_x, int offset_y) |
| Create a GL->CUDA encoding device for consuming captured dmabufs. | |
| std::shared_ptr< display_t > | platf::nvfbc_display (mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config) |
| Create an NvFBC CUDA display capture backend. | |
| std::vector< std::string > | platf::nvfbc_display_names () |
| Enumerate display names exposed by NvFBC. | |
| file_t | cuda::open_drm_fd_for_cuda_device (int index) |
| Opens the DRM device associated with the CUDA device index. | |
| void | cuda::pass_error (const std::string_view &sv, const char *name, const char *description) |
| Convert a CUDA result code into Sunshine's capture status. | |
| void | cuda::unregisterResource (CUgraphicsResource resource) |
| Unregister a CUDA graphics resource if it is still registered. | |
Definitions for CUDA encoding.
| #define CU_CHECK | ( | x, | |
| y ) |
Macro for CU CHECK.
| #define CU_CHECK_IGNORE | ( | x, | |
| y ) |
Macro for CU CHECK IGNORE.
| #define SUNSHINE_STRINGVIEW | ( | x | ) |
Macro for SUNSHINE STRINGVIEW.
| #define SUNSHINE_STRINGVIEW_HELPER | ( | x | ) |
Macro for SUNSHINE STRINGVIEW HELPER.
| void cuda::cff | ( | CudaFunctions * | cf | ) |
Release a Core Foundation object when the wrapper is destroyed.
| cf | Core Foundation object passed to the scoped releaser. |
| void cuda::freeStream | ( | CUstream | stream | ) |
Release stream resources.
| stream | CUDA stream or PipeWire stream involved in the operation. |
| int cuda::init | ( | ) |
Map CUDA graphics resources for use as an image.
| int cuda::nvfbc::init | ( | ) |
Load NvFBC and create the CUDA capture helper.
| std::unique_ptr< platf::avcodec_encode_device_t > cuda::make_avcodec_encode_device | ( | int | width, |
| int | height, | ||
| bool | vram ) |
Create AVCodec encode device.
| width | Frame or display width in pixels. |
| height | Frame or display height in pixels. |
| vram | Whether the image should use GPU memory instead of system memory. |
| std::unique_ptr< platf::avcodec_encode_device_t > cuda::make_avcodec_gl_encode_device | ( | int | width, |
| int | height, | ||
| int | offset_x, | ||
| int | offset_y ) |
Create a GL->CUDA encoding device for consuming captured dmabufs.
| width | Width of captured frames. |
| height | Height of captured frames. |
| offset_x | Offset of content in captured frame. |
| offset_y | Offset of content in captured frame. |
| std::shared_ptr< display_t > platf::nvfbc_display | ( | mem_type_e | hwdevice_type, |
| const std::string & | display_name, | ||
| const video::config_t & | config ) |
Create an NvFBC CUDA display capture backend.
| hwdevice_type | Hardware device type requested for capture or encode. |
| display_name | Display name. |
| config | Configuration values to apply. |
| std::vector< std::string > platf::nvfbc_display_names | ( | ) |
Enumerate display names exposed by NvFBC.
| file_t cuda::open_drm_fd_for_cuda_device | ( | int | index | ) |
Opens the DRM device associated with the CUDA device index.
| index | CUDA device index to open. |
| void cuda::pass_error | ( | const std::string_view & | sv, |
| const char * | name, | ||
| const char * | description ) |
Convert a CUDA result code into Sunshine's capture status.
| sv | String view containing the text to inspect. |
| name | Human-readable name to assign. |
| description | Human-readable description used in log output. |
| void cuda::unregisterResource | ( | CUgraphicsResource | resource | ) |
Unregister a CUDA graphics resource if it is still registered.
| resource | CUDA graphics resource being mapped or unmapped. |