docs(doxygen): enforce warn if undocumented (#5337)

This commit is contained in:
Dave Lane authored and GitHub committed 2026-06-25 22:43:17 -04:00
1 parent be7c1bcdfb
commit a991a9622c
141 files changed
+11804 -1524

No files matched your search

+103 -13
View File
@@ -24,25 +24,47 @@ extern "C" {
// There aren't that many DRM_FORMAT I need to use, so define them here
//
// They aren't likely to change any time soon.
/**
* @def fourcc_code(a, b, c, d)
* @brief Macro for fourcc code.
*/
#define fourcc_code(a, b, c, d) ((std::uint32_t) (a) | ((std::uint32_t) (b) << 8) | ((std::uint32_t) (c) << 16) | ((std::uint32_t) (d) << 24))
/**
* @def fourcc_mod_code(vendor, val)
* @brief Macro for fourcc mod code.
*/
#define fourcc_mod_code(vendor, val) ((((uint64_t) vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
/**
* @def DRM_FORMAT_MOD_INVALID
* @brief Macro for DRM FORMAT MOD INVALID.
*/
#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(0, ((1ULL << 56) - 1))
#if !defined(SUNSHINE_SHADERS_DIR) // for testing this needs to be defined in cmake as we don't do an install
/**
* @def SUNSHINE_SHADERS_DIR
* @brief Macro for SUNSHINE SHADERS DIR.
*/
#define SUNSHINE_SHADERS_DIR SUNSHINE_ASSETS_DIR "/shaders/opengl"
#endif
using namespace std::literals;
namespace gl {
GladGLContext ctx;
GladGLContext ctx; ///< Loaded OpenGL function table for the active context.
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC egl_image_target_texture_2d_fn = nullptr;
/**
* @brief Bind an EGL image to the current OpenGL texture target.
*/
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC egl_image_target_texture_2d() {
return egl_image_target_texture_2d_fn;
}
/**
* @brief Drain and log pending OpenGL errors.
*/
void drain_errors(const std::string_view &prefix) {
GLenum err;
while ((err = ctx.GetError()) != GL_NO_ERROR) {
@@ -275,9 +297,12 @@ namespace gl {
} // namespace gl
namespace gbm {
device_destroy_fn device_destroy;
create_device_fn create_device;
device_destroy_fn device_destroy; ///< Device destroy.
create_device_fn create_device; ///< Create device.
/**
* @brief Load GBM symbols required for EGL device creation.
*/
int init() {
static void *handle {nullptr};
static bool funcs_loaded = false;
@@ -309,13 +334,13 @@ namespace gbm {
namespace egl {
/**
* @brief Log EGL failure details and return an error code.
*/
bool fail() {
return eglGetError() != EGL_SUCCESS;
}
/**
* @memberof egl::display_t
*/
display_t make_display(std::variant<gbm::gbm_t::pointer, wl_display *, _XDisplay *> native_display) {
int egl_platform;
void *native_display_p;
@@ -391,6 +416,9 @@ namespace egl {
return display;
}
/**
* @brief Create an EGL/OpenGL context for capture or conversion.
*/
std::optional<ctx_t> make_ctx(display_t::pointer display) {
bool nice_warning = false;
#if !defined(__FreeBSD__)
@@ -503,14 +531,23 @@ namespace egl {
return ctx;
}
/**
* @brief EGL attribute pair describing one DMA-BUF plane.
*/
struct plane_attr_t {
EGLAttrib fd;
EGLAttrib offset;
EGLAttrib pitch;
EGLAttrib lo;
EGLAttrib hi;
EGLAttrib fd; ///< EGL attribute key for a plane file descriptor.
EGLAttrib offset; ///< Offset.
EGLAttrib pitch; ///< Pitch.
EGLAttrib lo; ///< Lo.
EGLAttrib hi; ///< Hi.
};
/**
* @brief Build EGL attributes for one DMA-BUF plane.
*
* @param plane_indice Zero-based plane index in the DMA-BUF descriptor.
* @return EGL attribute keys for that plane's file descriptor, offset, pitch, and modifier.
*/
inline plane_attr_t get_plane(std::uint32_t plane_indice) {
switch (plane_indice) {
case 0:
@@ -593,6 +630,13 @@ namespace egl {
return attribs;
}
/**
* @brief Import the source frame texture for EGL/OpenGL conversion.
*
* @param egl_display EGL display used to create the image.
* @param xrgb XRGB surface descriptor to import.
* @return Imported RGB image, or empty when import fails.
*/
std::optional<rgb_t> import_source(display_t::pointer egl_display, const surface_descriptor_t &xrgb) {
auto attribs = surface_descriptor_to_egl_attribs(xrgb);
@@ -652,9 +696,14 @@ namespace egl {
}
// Constants for clear black color Y, U, V. U & V are same so:
const float y_black[] = {0.0f, 0.0f, 0.0f, 0.0f};
const float uv_black[] = {0.5f, 0.5f, 0.5f, 0.5f};
const float y_black[] = {0.0f, 0.0f, 0.0f, 0.0f}; ///< Y black.
const float uv_black[] = {0.5f, 0.5f, 0.5f, 0.5f}; ///< Uv black.
/**
* @brief Bind NV12 target framebuffers to their Y and UV plane textures.
*
* @param nv12 Imported NV12 target whose textures receive rendered output.
*/
void nv12_bind_framebuffers(nv12_t &nv12) {
constexpr std::array<GLenum, 2> attachments {{GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1}};
@@ -669,6 +718,11 @@ namespace egl {
gl_drain_errors;
}
/**
* @brief Bind YUV444 target framebuffers to their Y, U, and V plane textures.
*
* @param yuv444 Imported YUV444 target whose textures receive rendered output.
*/
void yuv44_bind_framebuffers(yuv444_t &yuv444) {
constexpr std::array<GLenum, 3> attachments {{GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2}};
@@ -683,6 +737,15 @@ namespace egl {
gl_drain_errors;
}
/**
* @brief Import the output frame target for EGL/OpenGL conversion.
*
* @param egl_display EGL display used to create the images.
* @param fds File descriptors backing the NV12 image.
* @param y Luma plane descriptor.
* @param uv Chroma plane descriptor.
* @return Imported NV12 image, or empty when import fails.
*/
std::optional<nv12_t> 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) {
auto y_attribs = surface_descriptor_to_egl_attribs(y);
auto uv_attribs = surface_descriptor_to_egl_attribs(uv);
@@ -719,6 +782,16 @@ namespace egl {
return nv12;
}
/**
* @brief Import a YUV444 target image from DMA-BUF descriptors.
*
* @param egl_display EGL display used to create the images.
* @param fds File descriptors backing the YUV444 image.
* @param y Luma plane descriptor.
* @param u U chroma plane descriptor.
* @param v V chroma plane descriptor.
* @return Imported YUV444 image, or empty when import fails.
*/
std::optional<yuv444_t> import_target_yuv444(
display_t::pointer egl_display,
std::array<file_t, yuv444_img_t::num_fds> &&fds,
@@ -811,6 +884,9 @@ namespace egl {
return nv12;
}
/**
* @brief Create YUV444 target.
*/
std::optional<yuv444_t> create_yuv444_target(int width, int height, AVPixelFormat format) {
yuv444_t yuv444 {
EGL_NO_DISPLAY,
@@ -876,6 +952,15 @@ namespace egl {
}
}
/**
* @brief Configure the EGL/OpenGL scaling and colorspace conversion pipeline.
*
* @param sws Software-scaling pipeline to configure.
* @param color_p Color p.
* @param tex Texture resource used by the converter.
* @param is_yuv444 Is YUV444.
* @return 0 when shaders, framebuffers, and color uniforms are ready; nonzero on failure.
*/
int configure_sws_pipeline(sws_t &sws, const video::color_t *color_p, gl::tex_t &&tex, bool is_yuv444) {
std::array<std::pair<const char *, std::string_view>, 5> members {{
std::make_pair("color_vec_y", util::view(color_p->color_vec_y)),
@@ -1310,6 +1395,11 @@ namespace egl {
}
} // namespace egl
/**
* @brief Release an FFmpeg frame allocated by the capture or conversion backend.
*
* @param frame Video or graphics frame being processed.
*/
void free_frame(AVFrame *frame) {
av_frame_free(&frame);
}