2019-09-23 14:54:49 +03:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2019 Collabora, Ltd.
|
2019-04-18 21:45:48 +05:30
|
|
|
* Copyright © 2019 Harish Krupo
|
|
|
|
|
* Copyright © 2019 Intel Corporation
|
2021-09-09 14:22:43 -04:00
|
|
|
* Copyright 2021 Advanced Micro Devices, Inc.
|
2019-09-23 14:54:49 +03:00
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
|
* the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
|
* portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
|
* SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-07-23 15:23:23 +02:00
|
|
|
/*
|
|
|
|
|
* GL renderer best practices:
|
|
|
|
|
*
|
|
|
|
|
* 1. Texture units
|
|
|
|
|
* 1. Fixed allocation using the gl_tex_unit enumeration.
|
|
|
|
|
* 2. Any functions changing the active unit must restore it to 0 before
|
|
|
|
|
* return so that other functions can assume a default value.
|
2024-07-23 15:40:02 +02:00
|
|
|
*
|
|
|
|
|
* 1. Pixel storage modes
|
|
|
|
|
* 1. Any functions changing modes must restore them to their default values
|
|
|
|
|
* before return so that other functions can assume default values.
|
2024-07-23 15:23:23 +02:00
|
|
|
*/
|
|
|
|
|
|
2019-09-23 14:54:49 +03:00
|
|
|
#ifndef GL_RENDERER_INTERNAL_H
|
|
|
|
|
#define GL_RENDERER_INTERNAL_H
|
|
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
#include <stdbool.h>
|
2021-02-10 12:33:03 +02:00
|
|
|
#include <time.h>
|
2019-04-18 21:45:48 +05:30
|
|
|
|
|
|
|
|
#include <wayland-util.h>
|
2019-09-23 14:54:49 +03:00
|
|
|
#include <GLES2/gl2.h>
|
|
|
|
|
#include <GLES2/gl2ext.h>
|
2019-11-13 11:34:30 +00:00
|
|
|
#include "shared/weston-egl-ext.h" /* for PFN* stuff */
|
2024-11-11 14:30:46 +02:00
|
|
|
#include <libweston/helpers.h>
|
2019-04-18 21:45:48 +05:30
|
|
|
|
2024-07-23 13:13:49 +02:00
|
|
|
/* Max number of images per buffer. */
|
|
|
|
|
#define SHADER_INPUT_TEX_MAX 3
|
|
|
|
|
|
2024-10-10 15:37:47 +02:00
|
|
|
#define GET_PROC_ADDRESS(dest, proc) do { \
|
|
|
|
|
dest = (void *) eglGetProcAddress(proc); \
|
|
|
|
|
assert(dest); \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
2024-10-10 11:30:42 +02:00
|
|
|
#define EXT(string, flag) { string, ARRAY_LENGTH(string) - 1, (uint64_t) flag }
|
|
|
|
|
|
2024-10-10 11:56:29 +02:00
|
|
|
/* Keep in sync with egl-glue.c. */
|
|
|
|
|
enum egl_client_extension_flag {
|
|
|
|
|
EXTENSION_EXT_DEVICE_QUERY = 1ull << 0,
|
|
|
|
|
EXTENSION_EXT_PLATFORM_BASE = 1ull << 1,
|
|
|
|
|
EXTENSION_EXT_PLATFORM_WAYLAND = 1ull << 2,
|
|
|
|
|
EXTENSION_EXT_PLATFORM_X11 = 1ull << 3,
|
|
|
|
|
EXTENSION_KHR_PLATFORM_GBM = 1ull << 4,
|
|
|
|
|
EXTENSION_KHR_PLATFORM_WAYLAND = 1ull << 5,
|
|
|
|
|
EXTENSION_KHR_PLATFORM_X11 = 1ull << 6,
|
|
|
|
|
EXTENSION_MESA_PLATFORM_GBM = 1ull << 7,
|
|
|
|
|
EXTENSION_MESA_PLATFORM_SURFACELESS = 1ull << 8,
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-10 12:17:19 +02:00
|
|
|
/* Keep in sync with egl-glue.c. */
|
|
|
|
|
enum egl_device_extension_flag {
|
|
|
|
|
EXTENSION_EXT_DEVICE_DRM = 1ull << 0,
|
|
|
|
|
EXTENSION_EXT_DEVICE_DRM_RENDER_NODE = 1ull << 1,
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-10 12:55:50 +02:00
|
|
|
/* Keep in sync with egl-glue.c. */
|
|
|
|
|
enum egl_display_extension_flag {
|
|
|
|
|
EXTENSION_ANDROID_NATIVE_FENCE_SYNC = 1ull << 0,
|
|
|
|
|
EXTENSION_EXT_BUFFER_AGE = 1ull << 1,
|
|
|
|
|
EXTENSION_EXT_IMAGE_DMA_BUF_IMPORT = 1ull << 2,
|
|
|
|
|
EXTENSION_EXT_IMAGE_DMA_BUF_IMPORT_MODIFIERS = 1ull << 3,
|
|
|
|
|
EXTENSION_EXT_SWAP_BUFFERS_WITH_DAMAGE = 1ull << 4,
|
|
|
|
|
EXTENSION_IMG_CONTEXT_PRIORITY = 1ull << 5,
|
|
|
|
|
EXTENSION_KHR_FENCE_SYNC = 1ull << 6,
|
|
|
|
|
EXTENSION_KHR_NO_CONFIG_CONTEXT = 1ull << 7,
|
|
|
|
|
EXTENSION_KHR_PARTIAL_UPDATE = 1ull << 8,
|
|
|
|
|
EXTENSION_KHR_SURFACELESS_CONTEXT = 1ull << 9,
|
|
|
|
|
EXTENSION_KHR_SWAP_BUFFERS_WITH_DAMAGE = 1ull << 10,
|
|
|
|
|
EXTENSION_KHR_WAIT_SYNC = 1ull << 11,
|
|
|
|
|
EXTENSION_MESA_CONFIGLESS_CONTEXT = 1ull << 12,
|
|
|
|
|
EXTENSION_WL_BIND_WAYLAND_DISPLAY = 1ull << 13,
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-10 16:01:44 +02:00
|
|
|
enum gl_feature_flag {
|
|
|
|
|
/* GL renderer can create contexts without specifying an EGLConfig. */
|
|
|
|
|
FEATURE_NO_CONFIG_CONTEXT = 1ull << 0,
|
2024-10-10 16:29:09 +02:00
|
|
|
|
|
|
|
|
/* GL renderer can pass a list of damage rectangles at buffer swap in
|
|
|
|
|
* order to reduce recomposition costs. */
|
|
|
|
|
FEATURE_SWAP_BUFFERS_WITH_DAMAGE = 1ull << 1,
|
2024-10-10 16:01:44 +02:00
|
|
|
};
|
|
|
|
|
|
2023-02-15 14:38:32 +01:00
|
|
|
/* Keep the following in sync with vertex.glsl. */
|
|
|
|
|
enum gl_shader_texcoord_input {
|
|
|
|
|
SHADER_TEXCOORD_INPUT_ATTRIB = 0,
|
|
|
|
|
SHADER_TEXCOORD_INPUT_SURFACE,
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
enum gl_shader_texture_variant {
|
|
|
|
|
SHADER_VARIANT_NONE = 0,
|
|
|
|
|
/* Keep the following in sync with fragment.glsl. */
|
|
|
|
|
SHADER_VARIANT_RGBX,
|
|
|
|
|
SHADER_VARIANT_RGBA,
|
|
|
|
|
SHADER_VARIANT_Y_U_V,
|
|
|
|
|
SHADER_VARIANT_Y_UV,
|
|
|
|
|
SHADER_VARIANT_Y_XUXV,
|
|
|
|
|
SHADER_VARIANT_XYUV,
|
|
|
|
|
SHADER_VARIANT_SOLID,
|
|
|
|
|
SHADER_VARIANT_EXTERNAL,
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-22 16:17:28 +02:00
|
|
|
/* Keep the following in sync with fragment.glsl. */
|
|
|
|
|
enum gl_shader_color_curve {
|
|
|
|
|
SHADER_COLOR_CURVE_IDENTITY = 0,
|
|
|
|
|
SHADER_COLOR_CURVE_LUT_3x1D,
|
2024-03-18 11:14:04 -03:00
|
|
|
SHADER_COLOR_CURVE_LINPOW,
|
|
|
|
|
SHADER_COLOR_CURVE_POWLIN,
|
2021-03-22 16:17:28 +02:00
|
|
|
};
|
|
|
|
|
|
2021-09-09 14:22:43 -04:00
|
|
|
/* Keep the following in sync with fragment.glsl. */
|
|
|
|
|
enum gl_shader_color_mapping {
|
|
|
|
|
SHADER_COLOR_MAPPING_IDENTITY = 0,
|
|
|
|
|
SHADER_COLOR_MAPPING_3DLUT,
|
2022-06-25 15:48:49 -04:00
|
|
|
SHADER_COLOR_MAPPING_MATRIX,
|
2021-09-09 14:22:43 -04:00
|
|
|
};
|
|
|
|
|
|
2024-05-06 13:09:28 +02:00
|
|
|
enum gl_shader_attrib_loc {
|
|
|
|
|
SHADER_ATTRIB_LOC_POSITION = 0,
|
|
|
|
|
SHADER_ATTRIB_LOC_TEXCOORD,
|
2024-05-06 09:27:04 +02:00
|
|
|
SHADER_ATTRIB_LOC_BARYCENTRIC,
|
2024-05-06 13:09:28 +02:00
|
|
|
};
|
|
|
|
|
|
2024-07-23 13:13:49 +02:00
|
|
|
enum gl_tex_unit {
|
|
|
|
|
TEX_UNIT_IMAGES = 0,
|
|
|
|
|
TEX_UNIT_COLOR_PRE_CURVE = SHADER_INPUT_TEX_MAX,
|
|
|
|
|
TEX_UNIT_COLOR_MAPPING,
|
|
|
|
|
TEX_UNIT_COLOR_POST_CURVE,
|
|
|
|
|
TEX_UNIT_WIREFRAME,
|
|
|
|
|
TEX_UNIT_LAST,
|
|
|
|
|
};
|
|
|
|
|
static_assert(TEX_UNIT_LAST < 8, "OpenGL ES 2.0 requires at least 8 texture "
|
|
|
|
|
"units. Consider replacing this assert with a "
|
|
|
|
|
"GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS check at display creation "
|
|
|
|
|
"to require more.");
|
|
|
|
|
|
2024-10-10 11:30:42 +02:00
|
|
|
struct gl_extension_table {
|
|
|
|
|
const char *str;
|
|
|
|
|
size_t len;
|
|
|
|
|
uint64_t flag;
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
/** GL shader requirements key
|
|
|
|
|
*
|
|
|
|
|
* This structure is used as a binary blob key for building and searching
|
|
|
|
|
* shaders. Therefore it must not contain any bytes or bits the C compiler
|
|
|
|
|
* would be free to leave undefined e.g. after struct initialization,
|
|
|
|
|
* struct assignment, or member operations.
|
|
|
|
|
*
|
|
|
|
|
* Use 'pahole' from package 'dwarves' to inspect this structure.
|
|
|
|
|
*/
|
|
|
|
|
struct gl_shader_requirements
|
|
|
|
|
{
|
2023-02-15 14:38:32 +01:00
|
|
|
unsigned texcoord_input:1; /* enum gl_shader_texcoord_input */
|
|
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
unsigned variant:4; /* enum gl_shader_texture_variant */
|
2021-03-12 14:06:34 +02:00
|
|
|
bool input_is_premult:1;
|
2024-05-07 11:58:34 +02:00
|
|
|
bool tint:1;
|
2024-04-30 12:58:46 +02:00
|
|
|
bool wireframe:1;
|
2019-04-18 21:45:48 +05:30
|
|
|
|
2024-03-18 11:14:04 -03:00
|
|
|
unsigned color_pre_curve:2; /* enum gl_shader_color_curve */
|
2022-06-25 15:48:49 -04:00
|
|
|
unsigned color_mapping:2; /* enum gl_shader_color_mapping */
|
2024-03-18 11:14:04 -03:00
|
|
|
unsigned color_post_curve:2; /* enum gl_shader_color_curve */
|
renderer-gl: Support more shm RGB formats
Some applications, e.g. Chromium browser, may provide ABGR format buf.
Tested with gstreamer 1.22.8:
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=RGB' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=BGR' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=ARGB' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=xRGB' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=ABGR' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=xBGR' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=RGBA' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=RGBx' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=BGRA' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=BGRx' ! waylandsink
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2022-07-07 11:09:23 +08:00
|
|
|
unsigned color_channel_order:2; /* enum gl_channel_order */
|
|
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
/*
|
|
|
|
|
* The total size of all bitfields plus pad_bits_ must fill up exactly
|
|
|
|
|
* how many bytes the compiler allocates for them together.
|
|
|
|
|
*/
|
renderer-gl: Support more shm RGB formats
Some applications, e.g. Chromium browser, may provide ABGR format buf.
Tested with gstreamer 1.22.8:
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=RGB' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=BGR' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=ARGB' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=xRGB' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=ABGR' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=xBGR' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=RGBA' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=RGBx' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=BGRA' ! waylandsink
gst-launch-1.0 videotestsrc ! 'video/x-raw,format=BGRx' ! waylandsink
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2022-07-07 11:09:23 +08:00
|
|
|
unsigned pad_bits_:16;
|
2019-04-18 21:45:48 +05:30
|
|
|
};
|
|
|
|
|
static_assert(sizeof(struct gl_shader_requirements) ==
|
|
|
|
|
4 /* total bitfield size in bytes */,
|
|
|
|
|
"struct gl_shader_requirements must not contain implicit padding");
|
2019-09-23 14:54:49 +03:00
|
|
|
|
2021-03-18 17:42:06 +02:00
|
|
|
struct gl_shader;
|
2021-03-09 16:40:25 +02:00
|
|
|
struct weston_color_transform;
|
2023-09-22 09:56:07 +02:00
|
|
|
struct dmabuf_allocator;
|
2021-03-18 17:42:06 +02:00
|
|
|
|
|
|
|
|
struct gl_shader_config {
|
|
|
|
|
struct gl_shader_requirements req;
|
|
|
|
|
|
|
|
|
|
struct weston_matrix projection;
|
2023-02-15 14:38:32 +01:00
|
|
|
struct weston_matrix surface_to_buffer;
|
2021-03-18 17:42:06 +02:00
|
|
|
float view_alpha;
|
|
|
|
|
GLfloat unicolor[4];
|
2024-05-07 11:58:34 +02:00
|
|
|
GLfloat tint[4];
|
2021-03-18 17:42:06 +02:00
|
|
|
GLint input_tex_filter; /* GL_NEAREST or GL_LINEAR */
|
2024-07-23 12:37:31 +02:00
|
|
|
GLuint input_tex[SHADER_INPUT_TEX_MAX];
|
2024-05-06 09:27:04 +02:00
|
|
|
GLuint wireframe_tex;
|
2024-03-04 18:55:14 -03:00
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
GLuint tex;
|
|
|
|
|
GLfloat scale_offset[2];
|
|
|
|
|
} lut_3x1d;
|
2024-03-18 11:14:04 -03:00
|
|
|
struct {
|
|
|
|
|
GLfloat params[3][10];
|
|
|
|
|
GLboolean clamped_input;
|
|
|
|
|
} parametric;
|
2024-03-04 18:55:14 -03:00
|
|
|
} color_pre_curve;
|
|
|
|
|
|
2021-09-09 14:22:43 -04:00
|
|
|
union {
|
|
|
|
|
struct {
|
2024-03-04 18:55:14 -03:00
|
|
|
GLuint tex;
|
2021-09-09 14:22:43 -04:00
|
|
|
GLfloat scale_offset[2];
|
|
|
|
|
} lut3d;
|
2022-06-25 15:48:49 -04:00
|
|
|
GLfloat matrix[9];
|
2021-09-09 14:22:43 -04:00
|
|
|
} color_mapping;
|
2024-03-04 18:55:14 -03:00
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
GLuint tex;
|
|
|
|
|
GLfloat scale_offset[2];
|
|
|
|
|
} lut_3x1d;
|
2024-03-18 11:14:04 -03:00
|
|
|
struct {
|
|
|
|
|
GLfloat params[3][10];
|
|
|
|
|
GLboolean clamped_input;
|
|
|
|
|
} parametric;
|
2024-03-04 18:55:14 -03:00
|
|
|
} color_post_curve;
|
2019-09-23 14:54:49 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct gl_renderer {
|
|
|
|
|
struct weston_renderer base;
|
2021-02-09 17:31:11 +02:00
|
|
|
struct weston_compositor *compositor;
|
2022-05-17 15:15:47 +03:00
|
|
|
struct weston_log_scope *renderer_scope;
|
2021-02-09 17:31:11 +02:00
|
|
|
|
2024-05-07 15:14:28 +02:00
|
|
|
/* Debug modes. */
|
2024-05-06 19:17:24 +02:00
|
|
|
struct weston_binding *debug_mode_binding;
|
|
|
|
|
int debug_mode;
|
2024-05-07 15:45:55 +02:00
|
|
|
bool debug_clear;
|
2024-05-06 09:27:04 +02:00
|
|
|
bool wireframe_dirty;
|
|
|
|
|
GLuint wireframe_tex;
|
|
|
|
|
int wireframe_size;
|
2024-05-07 16:22:40 +02:00
|
|
|
int nbatches;
|
2019-09-23 14:54:49 +03:00
|
|
|
|
2019-09-30 14:57:25 +03:00
|
|
|
EGLenum platform;
|
2019-09-23 14:54:49 +03:00
|
|
|
EGLDisplay egl_display;
|
|
|
|
|
EGLContext egl_context;
|
|
|
|
|
EGLConfig egl_config;
|
|
|
|
|
|
|
|
|
|
uint32_t gl_version;
|
|
|
|
|
|
2023-09-13 10:44:31 +02:00
|
|
|
/* Vertex streams. */
|
|
|
|
|
struct wl_array position_stream;
|
2024-05-06 09:27:04 +02:00
|
|
|
struct wl_array barycentric_stream;
|
|
|
|
|
struct wl_array indices;
|
2019-09-23 14:54:49 +03:00
|
|
|
|
2021-01-18 18:10:58 -03:00
|
|
|
EGLDeviceEXT egl_device;
|
|
|
|
|
const char *drm_device;
|
|
|
|
|
|
2021-03-04 17:47:13 -03:00
|
|
|
struct weston_drm_format_array supported_formats;
|
|
|
|
|
|
2024-10-10 11:56:29 +02:00
|
|
|
uint64_t egl_client_extensions;
|
2024-10-10 12:17:19 +02:00
|
|
|
uint64_t egl_device_extensions;
|
2024-10-10 12:55:50 +02:00
|
|
|
uint64_t egl_display_extensions;
|
2024-10-10 11:56:29 +02:00
|
|
|
|
2024-10-10 14:20:36 +02:00
|
|
|
/* EGL_EXT_device_query */
|
|
|
|
|
PFNEGLQUERYDISPLAYATTRIBEXTPROC query_display_attrib;
|
|
|
|
|
PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
|
2019-12-20 14:39:38 +13:00
|
|
|
|
2024-10-10 14:20:36 +02:00
|
|
|
/* EGL_EXT_platform_base */
|
2019-12-20 14:39:38 +13:00
|
|
|
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
|
2019-09-23 14:54:49 +03:00
|
|
|
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
|
|
|
|
|
|
2024-10-10 14:20:36 +02:00
|
|
|
/* EGL_KHR_image_base */
|
|
|
|
|
PFNEGLCREATEIMAGEKHRPROC create_image;
|
|
|
|
|
PFNEGLDESTROYIMAGEKHRPROC destroy_image;
|
|
|
|
|
|
|
|
|
|
/* EGL_WL_bind_wayland_display */
|
2019-09-23 14:54:49 +03:00
|
|
|
PFNEGLBINDWAYLANDDISPLAYWL bind_display;
|
|
|
|
|
PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display;
|
|
|
|
|
PFNEGLQUERYWAYLANDBUFFERWL query_buffer;
|
|
|
|
|
|
2024-10-10 14:20:36 +02:00
|
|
|
/* EGL_KHR_partial_update */
|
2019-09-23 14:54:49 +03:00
|
|
|
PFNEGLSETDAMAGEREGIONKHRPROC set_damage_region;
|
|
|
|
|
|
2024-10-10 14:20:36 +02:00
|
|
|
/* EGL_KHR_swap_buffers_with_damage
|
|
|
|
|
* EGL_EXT_swap_buffers_with_damage */
|
|
|
|
|
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
|
|
|
|
|
|
|
|
|
|
/* EGL_EXT_image_dma_buf_import_modifiers */
|
|
|
|
|
PFNEGLQUERYDMABUFFORMATSEXTPROC query_dmabuf_formats;
|
|
|
|
|
PFNEGLQUERYDMABUFMODIFIERSEXTPROC query_dmabuf_modifiers;
|
|
|
|
|
|
|
|
|
|
/* EGL_KHR_fence_sync */
|
|
|
|
|
PFNEGLCREATESYNCKHRPROC create_sync;
|
|
|
|
|
PFNEGLDESTROYSYNCKHRPROC destroy_sync;
|
|
|
|
|
|
|
|
|
|
/* EGL_ANDROID_native_fence_sync */
|
|
|
|
|
PFNEGLDUPNATIVEFENCEFDANDROIDPROC dup_native_fence_fd;
|
|
|
|
|
|
|
|
|
|
/* EGL_KHR_wait_sync */
|
|
|
|
|
PFNEGLWAITSYNCKHRPROC wait_sync;
|
|
|
|
|
|
2024-10-10 16:01:44 +02:00
|
|
|
uint64_t features;
|
|
|
|
|
|
2024-10-10 14:20:36 +02:00
|
|
|
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC image_target_texture_2d;
|
|
|
|
|
PFNGLTEXIMAGE3DOESPROC tex_image_3d;
|
|
|
|
|
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC image_target_renderbuffer_storage;
|
|
|
|
|
|
|
|
|
|
bool has_egl_image_external;
|
|
|
|
|
|
2019-09-23 14:54:49 +03:00
|
|
|
struct wl_list dmabuf_images;
|
2019-11-27 14:11:05 +01:00
|
|
|
struct wl_list dmabuf_formats;
|
2019-09-23 14:54:49 +03:00
|
|
|
|
2021-10-20 20:52:11 -04:00
|
|
|
bool has_texture_type_2_10_10_10_rev;
|
2019-09-23 14:54:49 +03:00
|
|
|
bool has_gl_texture_rg;
|
2022-01-04 14:32:44 -05:00
|
|
|
bool has_texture_norm16;
|
2021-03-30 13:27:00 +02:00
|
|
|
bool has_texture_storage;
|
2022-08-02 16:20:06 +03:00
|
|
|
bool has_pack_reverse;
|
2021-03-30 13:27:00 +02:00
|
|
|
bool has_rgb8_rgba8;
|
2023-11-29 12:54:52 +01:00
|
|
|
|
2023-10-05 09:23:47 +02:00
|
|
|
bool has_pbo;
|
2023-11-29 12:54:52 +01:00
|
|
|
GLenum pbo_usage;
|
|
|
|
|
PFNGLMAPBUFFERRANGEEXTPROC map_buffer_range;
|
|
|
|
|
PFNGLUNMAPBUFFEROESPROC unmap_buffer;
|
2023-10-05 09:23:47 +02:00
|
|
|
|
|
|
|
|
struct wl_list pending_capture_list;
|
2019-09-23 14:54:49 +03:00
|
|
|
|
|
|
|
|
struct gl_shader *current_shader;
|
2021-01-28 14:12:48 +02:00
|
|
|
struct gl_shader *fallback_shader;
|
2019-09-23 14:54:49 +03:00
|
|
|
|
|
|
|
|
struct wl_signal destroy_signal;
|
|
|
|
|
|
2023-01-12 08:04:40 +01:00
|
|
|
bool has_disjoint_timer_query;
|
|
|
|
|
PFNGLGENQUERIESEXTPROC gen_queries;
|
|
|
|
|
PFNGLDELETEQUERIESEXTPROC delete_queries;
|
|
|
|
|
PFNGLBEGINQUERYEXTPROC begin_query;
|
|
|
|
|
PFNGLENDQUERYEXTPROC end_query;
|
|
|
|
|
#if !defined(NDEBUG)
|
|
|
|
|
PFNGLGETQUERYOBJECTIVEXTPROC get_query_object_iv;
|
|
|
|
|
#endif
|
|
|
|
|
PFNGLGETQUERYOBJECTUI64VEXTPROC get_query_object_ui64v;
|
|
|
|
|
|
2021-03-16 13:11:09 +02:00
|
|
|
bool gl_supports_color_transforms;
|
2019-04-18 21:45:48 +05:30
|
|
|
|
2021-02-10 12:33:03 +02:00
|
|
|
/** Shader program cache in most recently used order
|
2019-04-18 21:45:48 +05:30
|
|
|
*
|
2021-02-10 12:33:03 +02:00
|
|
|
* Uses struct gl_shader::link.
|
2019-04-18 21:45:48 +05:30
|
|
|
*/
|
|
|
|
|
struct wl_list shader_list;
|
2019-04-18 21:45:48 +05:30
|
|
|
struct weston_log_scope *shader_scope;
|
2023-09-22 09:56:07 +02:00
|
|
|
|
|
|
|
|
struct dmabuf_allocator *allocator;
|
2019-09-23 14:54:49 +03:00
|
|
|
};
|
|
|
|
|
|
2024-10-10 10:14:09 +02:00
|
|
|
static inline uint32_t
|
|
|
|
|
gl_version(uint16_t major, uint16_t minor)
|
|
|
|
|
{
|
|
|
|
|
return ((uint32_t)major << 16) | minor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
gl_version_major(uint32_t ver)
|
|
|
|
|
{
|
|
|
|
|
return ver >> 16;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
|
gl_version_minor(uint32_t ver)
|
|
|
|
|
{
|
|
|
|
|
return ver & 0xffff;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 11:30:42 +02:00
|
|
|
void
|
|
|
|
|
gl_extensions_add(const struct gl_extension_table *table,
|
|
|
|
|
const char *extensions,
|
|
|
|
|
uint64_t *flags_out);
|
|
|
|
|
|
2024-10-10 11:56:29 +02:00
|
|
|
static inline bool
|
|
|
|
|
egl_client_has(struct gl_renderer *gr,
|
|
|
|
|
enum egl_client_extension_flag flag)
|
|
|
|
|
{
|
|
|
|
|
return (bool) (gr->egl_client_extensions & ((uint64_t) flag));
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 12:17:19 +02:00
|
|
|
static inline bool
|
|
|
|
|
egl_device_has(struct gl_renderer *gr,
|
|
|
|
|
enum egl_device_extension_flag flag)
|
|
|
|
|
{
|
|
|
|
|
return (bool) (gr->egl_device_extensions & ((uint64_t) flag));
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 12:55:50 +02:00
|
|
|
static inline bool
|
|
|
|
|
egl_display_has(struct gl_renderer *gr,
|
|
|
|
|
enum egl_display_extension_flag flag)
|
|
|
|
|
{
|
|
|
|
|
return (bool) (gr->egl_display_extensions & ((uint64_t) flag));
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-10 16:01:44 +02:00
|
|
|
static inline bool
|
|
|
|
|
gl_features_has(struct gl_renderer *gr,
|
|
|
|
|
enum gl_feature_flag flag)
|
|
|
|
|
{
|
|
|
|
|
return (bool) (gr->features & ((uint64_t) flag));
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-23 14:54:49 +03:00
|
|
|
static inline struct gl_renderer *
|
|
|
|
|
get_renderer(struct weston_compositor *ec)
|
|
|
|
|
{
|
|
|
|
|
return (struct gl_renderer *)ec->renderer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gl_renderer_print_egl_error_state(void);
|
|
|
|
|
|
2019-12-20 14:55:39 +13:00
|
|
|
void
|
2022-05-17 14:55:27 +03:00
|
|
|
gl_renderer_log_extensions(struct gl_renderer *gr,
|
|
|
|
|
const char *name, const char *extensions);
|
2019-12-20 14:55:39 +13:00
|
|
|
|
2019-09-23 14:54:49 +03:00
|
|
|
void
|
|
|
|
|
log_egl_config_info(EGLDisplay egldpy, EGLConfig eglconfig);
|
|
|
|
|
|
2019-09-13 15:35:10 +03:00
|
|
|
EGLConfig
|
|
|
|
|
gl_renderer_get_egl_config(struct gl_renderer *gr,
|
2019-09-13 17:24:49 +03:00
|
|
|
EGLint egl_surface_type,
|
2023-01-26 17:33:05 +01:00
|
|
|
const struct pixel_format_info *const *formats,
|
|
|
|
|
unsigned formats_count);
|
2019-09-13 15:35:10 +03:00
|
|
|
|
2019-12-20 15:07:43 +13:00
|
|
|
int
|
|
|
|
|
gl_renderer_setup_egl_display(struct gl_renderer *gr, void *native_display);
|
|
|
|
|
|
2019-12-20 14:55:39 +13:00
|
|
|
int
|
2019-12-20 14:28:44 +13:00
|
|
|
gl_renderer_setup_egl_client_extensions(struct gl_renderer *gr);
|
|
|
|
|
|
2019-09-23 14:54:49 +03:00
|
|
|
int
|
|
|
|
|
gl_renderer_setup_egl_extensions(struct weston_compositor *ec);
|
|
|
|
|
|
2021-03-18 17:42:06 +02:00
|
|
|
GLenum
|
|
|
|
|
gl_shader_texture_variant_get_target(enum gl_shader_texture_variant v);
|
|
|
|
|
|
2021-03-12 14:06:34 +02:00
|
|
|
bool
|
|
|
|
|
gl_shader_texture_variant_can_be_premult(enum gl_shader_texture_variant v);
|
|
|
|
|
|
2020-11-24 14:27:28 +02:00
|
|
|
void
|
2021-02-10 13:15:29 +02:00
|
|
|
gl_shader_destroy(struct gl_renderer *gr, struct gl_shader *shader);
|
2019-04-18 21:45:48 +05:30
|
|
|
|
2021-03-22 12:55:51 +02:00
|
|
|
void
|
|
|
|
|
gl_renderer_shader_list_destroy(struct gl_renderer *gr);
|
|
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
struct gl_shader *
|
2021-03-18 13:02:25 +02:00
|
|
|
gl_renderer_create_fallback_shader(struct gl_renderer *gr);
|
2020-11-24 14:27:28 +02:00
|
|
|
|
2021-03-18 13:02:25 +02:00
|
|
|
void
|
|
|
|
|
gl_renderer_garbage_collect_programs(struct gl_renderer *gr);
|
|
|
|
|
|
|
|
|
|
bool
|
2021-03-18 17:42:06 +02:00
|
|
|
gl_renderer_use_program(struct gl_renderer *gr,
|
|
|
|
|
const struct gl_shader_config *sconf);
|
2020-11-24 14:27:28 +02:00
|
|
|
|
2019-04-18 21:45:48 +05:30
|
|
|
struct weston_log_scope *
|
2021-02-09 17:31:11 +02:00
|
|
|
gl_shader_scope_create(struct gl_renderer *gr);
|
2019-04-18 21:45:48 +05:30
|
|
|
|
2021-03-09 16:40:25 +02:00
|
|
|
bool
|
2022-02-20 18:07:36 +01:00
|
|
|
gl_shader_config_set_color_transform(struct gl_renderer *gr,
|
|
|
|
|
struct gl_shader_config *sconf,
|
2021-03-09 16:40:25 +02:00
|
|
|
struct weston_color_transform *xform);
|
|
|
|
|
|
2019-09-23 14:54:49 +03:00
|
|
|
#endif /* GL_RENDERER_INTERNAL_H */
|