#include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
#include <asm/ioctl.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <libdrm/drm_fourcc.h>
#include <linux/types.h>
#include <spa/param/video/format-utils.h>
#include <unistd.h>
#include <xf86drm.h>
#include "absl/memory/memory.h"
#include "absl/types/optional.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/sanitizer.h"
#include "rtc_base/string_encode.h"
namespace webrtc {
eglBindAPI_func;
eglCreateContext_func;
eglDestroyContext_func;
eglTerminate_func;
eglCreateImageKHR_func;
eglDestroyImageKHR_func;
eglGetError_func;
eglGetProcAddress_func;
eglGetPlatformDisplayEXT_func;
eglGetPlatformDisplay_func;
eglInitialize_func;
eglMakeCurrent_func;
eglQueryDmaBufFormatsEXT_func;
eglQueryDmaBufModifiersEXT_func;
eglQueryString_func;
glEGLImageTargetTexture2DOES_func;
eglBindAPI_func EglBindAPI = …;
eglCreateContext_func EglCreateContext = …;
eglDestroyContext_func EglDestroyContext = …;
eglTerminate_func EglTerminate = …;
eglCreateImageKHR_func EglCreateImageKHR = …;
eglDestroyImageKHR_func EglDestroyImageKHR = …;
eglGetError_func EglGetError = …;
eglGetProcAddress_func EglGetProcAddress = …;
eglGetPlatformDisplayEXT_func EglGetPlatformDisplayEXT = …;
eglGetPlatformDisplay_func EglGetPlatformDisplay = …;
eglInitialize_func EglInitialize = …;
eglMakeCurrent_func EglMakeCurrent = …;
eglQueryDmaBufFormatsEXT_func EglQueryDmaBufFormatsEXT = …;
eglQueryDmaBufModifiersEXT_func EglQueryDmaBufModifiersEXT = …;
eglQueryString_func EglQueryString = …;
glEGLImageTargetTexture2DOES_func GlEGLImageTargetTexture2DOES = …;
glBindTexture_func;
glDeleteTextures_func;
glGenTextures_func;
glGetError_func;
glGetString_func;
glReadPixels_func;
glGenFramebuffers_func;
glDeleteFramebuffers_func;
glBindFramebuffer_func;
glFramebufferTexture2D_func;
glCheckFramebufferStatus_func;
glTexParameteri_func;
glXGetProcAddressARB_func;
glBindTexture_func GlBindTexture = …;
glDeleteTextures_func GlDeleteTextures = …;
glGenTextures_func GlGenTextures = …;
glGetError_func GlGetError = …;
glGetString_func GlGetString = …;
glReadPixels_func GlReadPixels = …;
glGenFramebuffers_func GlGenFramebuffers = …;
glDeleteFramebuffers_func GlDeleteFramebuffers = …;
glBindFramebuffer_func GlBindFramebuffer = …;
glFramebufferTexture2D_func GlFramebufferTexture2D = …;
glCheckFramebufferStatus_func GlCheckFramebufferStatus = …;
glTexParameteri_func GlTexParameteri = …;
glXGetProcAddressARB_func GlXGetProcAddressARB = …;
static const std::string FormatGLError(GLenum err) { … }
static const std::string FormatEGLError(EGLint err) { … }
static uint32_t SpaPixelFormatToDrmFormat(uint32_t spa_format) { … }
static void CloseLibrary(void* library) { … }
static void* g_lib_egl = …;
RTC_NO_SANITIZE("cfi-icall")
static bool OpenEGL() { … }
RTC_NO_SANITIZE("cfi-icall")
static bool LoadEGL() { … }
static void* g_lib_gl = …;
RTC_NO_SANITIZE("cfi-icall")
static bool OpenGL() { … }
RTC_NO_SANITIZE("cfi-icall")
static bool LoadGL() { … }
RTC_NO_SANITIZE("cfi-icall")
EglDmaBuf::EglDmaBuf() { … }
RTC_NO_SANITIZE("cfi-icall")
EglDmaBuf::~EglDmaBuf() { … }
RTC_NO_SANITIZE("cfi-icall")
bool EglDmaBuf::GetClientExtensions(EGLDisplay dpy, EGLint name) { … }
RTC_NO_SANITIZE("cfi-icall")
bool EglDmaBuf::ImageFromDmaBuf(const DesktopSize& size,
uint32_t format,
const std::vector<PlaneData>& plane_datas,
uint64_t modifier,
const DesktopVector& offset,
const DesktopSize& buffer_size,
uint8_t* data) { … }
RTC_NO_SANITIZE("cfi-icall")
std::vector<uint64_t> EglDmaBuf::QueryDmaBufModifiers(uint32_t format) { … }
absl::optional<std::string> EglDmaBuf::GetRenderNode() { … }
}