|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for graphics related functions. More...
#include <fcntl.h>#include "graphics.h"#include "src/file_handler.h"#include "src/logging.h"#include "src/video.h"#include <sys/capability.h>#include <libavutil/pixdesc.h>Classes | |
| struct | egl::plane_attr_t |
| EGL attribute pair describing one DMA-BUF plane. More... | |
Macros | |
| #define | DRM_FORMAT_MOD_INVALID fourcc_mod_code(0, ((1ULL << 56) - 1)) |
| Macro for DRM FORMAT MOD INVALID. | |
| #define | fourcc_code(a, b, c, d) |
| Macro for fourcc code. | |
| #define | fourcc_mod_code(vendor, val) |
| Macro for fourcc mod code. | |
| #define | SUNSHINE_SHADERS_DIR SUNSHINE_ASSETS_DIR "/shaders/opengl" |
| Macro for SUNSHINE SHADERS DIR. | |
Functions | |
| int | egl::configure_sws_pipeline (sws_t &sws, const video::color_t *color_p, gl::tex_t &&tex, bool is_yuv444) |
| Configure the EGL/OpenGL scaling and colorspace conversion pipeline. | |
| rgb_t | egl::create_blank (platf::img_t &img) |
| Create a black RGB texture of the specified image size. | |
| std::optional< nv12_t > | egl::create_nv12_target (int width, int height, AVPixelFormat format) |
| Create biplanar YUV textures to render into. | |
| std::optional< yuv444_t > | egl::create_yuv444_target (int width, int height, AVPixelFormat format) |
| Create YUV444 target. | |
| void | gl::drain_errors (const std::string_view &prefix) |
| Drain and log pending OpenGL errors. | |
| PFNGLEGLIMAGETARGETTEXTURE2DOESPROC | gl::egl_image_target_texture_2d () |
| Bind an EGL image to the current OpenGL texture target. | |
| bool | egl::fail () |
| Log EGL failure details and return an error code. | |
| void | free_frame (AVFrame *frame) |
| Release an FFmpeg frame allocated by the capture or conversion backend. | |
| plane_attr_t | egl::get_plane (std::uint32_t plane_indice) |
| Build EGL attributes for one DMA-BUF plane. | |
| std::optional< rgb_t > | egl::import_source (display_t::pointer egl_display, const surface_descriptor_t &xrgb) |
| Import the source frame texture for EGL/OpenGL conversion. | |
| std::optional< nv12_t > | egl::import_target (display_t::pointer egl_display, std::array< file_t, nv12_img_t::num_fds > &&fds, const surface_descriptor_t &y, const surface_descriptor_t &uv) |
| Import the output frame target for EGL/OpenGL conversion. | |
| std::optional< yuv444_t > | egl::import_target_yuv444 (display_t::pointer egl_display, std::array< file_t, yuv444_img_t::num_fds > &&fds, const surface_descriptor_t &y, const surface_descriptor_t &u, const surface_descriptor_t &v) |
| Import a YUV444 target image from DMA-BUF descriptors. | |
| int | gbm::init () |
| Load GBM symbols required for EGL device creation. | |
| std::optional< ctx_t > | egl::make_ctx (display_t::pointer display) |
| Create an EGL/OpenGL context for capture or conversion. | |
| display_t | egl::make_display (std::variant< gbm::gbm_t::pointer, wl_display *, _XDisplay * > native_display) |
| Open and initialize the display connection used for capture. | |
| void | egl::nv12_bind_framebuffers (nv12_t &nv12) |
| Bind NV12 target framebuffers to their Y and UV plane textures. | |
| std::vector< EGLAttrib > | egl::surface_descriptor_to_egl_attribs (const surface_descriptor_t &surface) |
| Get EGL attributes for eglCreateImage() to import the provided surface. | |
| void | egl::yuv44_bind_framebuffers (yuv444_t &yuv444) |
| Bind YUV444 target framebuffers to their Y, U, and V plane textures. | |
Variables | |
| create_device_fn | gbm::create_device |
| Create device. | |
| GladGLContext | gl::ctx |
| Loaded OpenGL function table for the active context. | |
| device_destroy_fn | gbm::device_destroy |
| Device destroy. | |
| const float | egl::uv_black [] = {0.5f, 0.5f, 0.5f, 0.5f} |
| Uv black. | |
| const float | egl::y_black [] = {0.0f, 0.0f, 0.0f, 0.0f} |
| Y black. | |
Definitions for graphics related functions.
| #define fourcc_code | ( | a, | |
| b, | |||
| c, | |||
| d ) |
Macro for fourcc code.
| #define fourcc_mod_code | ( | vendor, | |
| val ) |
Macro for fourcc mod code.
| int egl::configure_sws_pipeline | ( | sws_t & | sws, |
| const video::color_t * | color_p, | ||
| gl::tex_t && | tex, | ||
| bool | is_yuv444 ) |
Configure the EGL/OpenGL scaling and colorspace conversion pipeline.
| sws | Software-scaling pipeline to configure. |
| color_p | Color p. |
| tex | Texture resource used by the converter. |
| is_yuv444 | Is YUV444. |
| rgb_t egl::create_blank | ( | platf::img_t & | img | ) |
Create a black RGB texture of the specified image size.
Create a blank RGB texture for an image.
| img | The image to use for texture sizing. |
| std::optional< nv12_t > egl::create_nv12_target | ( | int | width, |
| int | height, | ||
| AVPixelFormat | format ) |
Create biplanar YUV textures to render into.
Creates biplanar YUV textures to render into.
| width | Width of the target frame. |
| height | Height of the target frame. |
| format | Format of the target frame. |
| std::optional< yuv444_t > egl::create_yuv444_target | ( | int | width, |
| int | height, | ||
| AVPixelFormat | format ) |
Create YUV444 target.
| width | Frame or display width in pixels. |
| height | Frame or display height in pixels. |
| format | Pixel, audio, or protocol format being converted. |
| void gl::drain_errors | ( | const std::string_view & | prefix | ) |
Drain and log pending OpenGL errors.
| prefix | Text prefix used when formatting the message. |
| PFNGLEGLIMAGETARGETTEXTURE2DOESPROC gl::egl_image_target_texture_2d | ( | ) |
Bind an EGL image to the current OpenGL texture target.
Resolve the GLES extension used to bind EGL images as textures.
| bool egl::fail | ( | ) |
Log EGL failure details and return an error code.
| void free_frame | ( | AVFrame * | frame | ) |
Release an FFmpeg frame allocated by the capture or conversion backend.
| frame | Video or graphics frame being processed. |
|
inline |
Build EGL attributes for one DMA-BUF plane.
| plane_indice | Zero-based plane index in the DMA-BUF descriptor. |
| std::optional< rgb_t > egl::import_source | ( | display_t::pointer | egl_display, |
| const surface_descriptor_t & | xrgb ) |
Import the source frame texture for EGL/OpenGL conversion.
Import an RGB source surface.
| egl_display | EGL display used to create the image. |
| xrgb | XRGB surface descriptor to import. |
| std::optional< nv12_t > egl::import_target | ( | display_t::pointer | egl_display, |
| std::array< file_t, nv12_img_t::num_fds > && | fds, | ||
| const surface_descriptor_t & | y, | ||
| const surface_descriptor_t & | uv ) |
Import the output frame target for EGL/OpenGL conversion.
Import an NV12 target surface.
| egl_display | EGL display used to create the images. |
| fds | File descriptors backing the NV12 image. |
| y | Luma plane descriptor. |
| uv | Chroma plane descriptor. |
| std::optional< yuv444_t > egl::import_target_yuv444 | ( | display_t::pointer | egl_display, |
| std::array< file_t, yuv444_img_t::num_fds > && | fds, | ||
| const surface_descriptor_t & | y, | ||
| const surface_descriptor_t & | u, | ||
| const surface_descriptor_t & | v ) |
Import a YUV444 target image from DMA-BUF descriptors.
| egl_display | EGL display used to create the images. |
| fds | File descriptors backing the YUV444 image. |
| y | Luma plane descriptor. |
| u | U chroma plane descriptor. |
| v | V chroma plane descriptor. |
| int gbm::init | ( | ) |
Load GBM symbols required for EGL device creation.
| std::optional< ctx_t > egl::make_ctx | ( | display_t::pointer | display | ) |
Create an EGL/OpenGL context for capture or conversion.
| display | Display object or identifier associated with the operation. |
| display_t egl::make_display | ( | std::variant< gbm::gbm_t::pointer, wl_display *, _XDisplay * > | native_display | ) |
Open and initialize the display connection used for capture.
| native_display | Native display. |
| void egl::nv12_bind_framebuffers | ( | nv12_t & | nv12 | ) |
Bind NV12 target framebuffers to their Y and UV plane textures.
| nv12 | Imported NV12 target whose textures receive rendered output. |
| std::vector< EGLAttrib > egl::surface_descriptor_to_egl_attribs | ( | const surface_descriptor_t & | surface | ) |
Get EGL attributes for eglCreateImage() to import the provided surface.
| surface | The surface descriptor. |
| void egl::yuv44_bind_framebuffers | ( | yuv444_t & | yuv444 | ) |
Bind YUV444 target framebuffers to their Y, U, and V plane textures.
| yuv444 | Imported YUV444 target whose textures receive rendered output. |