gdk: hdr => high depth

The term "hdr" is so overloaded, we shouldn't use them anywhere, except
from maybe describing all of this work in blog posts and other marketing
materials.

So do renames:
* hdr => high_depth
* request_hdr => prefers_high_depth

This more accurately describes what is going on.
This commit is contained in:
Benjamin Otte 2021-10-06 18:25:30 +02:00
parent afa004fb8b
commit dc6e831524
21 changed files with 64 additions and 61 deletions

View File

@ -34,7 +34,7 @@ gdk_broadway_cairo_context_dispose (GObject *object)
static void static void
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context, gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context); GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);

View File

@ -34,7 +34,7 @@ gdk_broadway_draw_context_dispose (GObject *object)
static void static void
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context, gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context); GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);

View File

@ -129,7 +129,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" }, { "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" }, { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE }, { "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "hdr", GDK_DEBUG_HDR, "Use HDR rendering if possible", TRUE }, { "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
}; };

View File

@ -50,7 +50,7 @@ typedef enum {
GDK_DEBUG_VULKAN_DISABLE = 1 << 21, GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22, GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23, GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
GDK_DEBUG_HDR = 1 << 24, GDK_DEBUG_HIGH_DEPTH = 1 << 24,
} GdkDebugFlags; } GdkDebugFlags;
extern guint _gdk_debug_flags; extern guint _gdk_debug_flags;

View File

@ -93,7 +93,7 @@ struct _GdkDisplayPrivate {
#ifdef HAVE_EGL #ifdef HAVE_EGL
EGLDisplay egl_display; EGLDisplay egl_display;
EGLConfig egl_config; EGLConfig egl_config;
EGLConfig egl_config_hdr; EGLConfig egl_config_high_depth;
#endif #endif
guint rgba : 1; guint rgba : 1;
@ -1439,11 +1439,11 @@ gdk_display_get_egl_config (GdkDisplay *self)
} }
gpointer gpointer
gdk_display_get_egl_config_hdr (GdkDisplay *self) gdk_display_get_egl_config_high_depth (GdkDisplay *self)
{ {
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self); GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
return priv->egl_config_hdr; return priv->egl_config_high_depth;
} }
static EGLDisplay static EGLDisplay
@ -1721,16 +1721,16 @@ gdk_display_init_egl (GdkDisplay *self,
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float"); epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
if (self->have_egl_no_config_context) if (self->have_egl_no_config_context)
priv->egl_config_hdr = gdk_display_create_egl_config (self, priv->egl_config_high_depth = gdk_display_create_egl_config (self,
GDK_EGL_CONFIG_HDR, GDK_EGL_CONFIG_HDR,
error); error);
if (priv->egl_config_hdr == NULL) if (priv->egl_config_high_depth == NULL)
priv->egl_config_hdr = priv->egl_config; priv->egl_config_high_depth = priv->egl_config;
GDK_DISPLAY_NOTE (self, OPENGL, { GDK_DISPLAY_NOTE (self, OPENGL, {
char *ext = describe_extensions (priv->egl_display); char *ext = describe_extensions (priv->egl_display);
char *sdr_cfg = describe_egl_config (priv->egl_display, priv->egl_config); char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
char *hdr_cfg = describe_egl_config (priv->egl_display, priv->egl_config_hdr); char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
g_message ("EGL API version %d.%d found\n" g_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n" " - Vendor: %s\n"
" - Version: %s\n" " - Version: %s\n"
@ -1738,15 +1738,15 @@ gdk_display_init_egl (GdkDisplay *self,
" - Extensions:\n" " - Extensions:\n"
"\t%s\n" "\t%s\n"
" - Selected fbconfig: %s\n" " - Selected fbconfig: %s\n"
" HDR fbconfig: %s", " high depth: %s",
major, minor, major, minor,
eglQueryString (priv->egl_display, EGL_VENDOR), eglQueryString (priv->egl_display, EGL_VENDOR),
eglQueryString (priv->egl_display, EGL_VERSION), eglQueryString (priv->egl_display, EGL_VERSION),
eglQueryString (priv->egl_display, EGL_CLIENT_APIS), eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
ext, sdr_cfg, ext, std_cfg,
priv->egl_config_hdr == priv->egl_config ? "none" : hdr_cfg); priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
g_free (hdr_cfg); g_free (hd_cfg);
g_free (sdr_cfg); g_free (std_cfg);
g_free (ext); g_free (ext);
}); });

View File

@ -226,7 +226,8 @@ gboolean gdk_display_init_egl (GdkDisplay *display
GError **error); GError **error);
gpointer gdk_display_get_egl_display (GdkDisplay *display); gpointer gdk_display_get_egl_display (GdkDisplay *display);
gpointer gdk_display_get_egl_config (GdkDisplay *display); gpointer gdk_display_get_egl_config (GdkDisplay *display);
gpointer gdk_display_get_egl_config_hdr (GdkDisplay *display); gpointer gdk_display_get_egl_config_high_depth
(GdkDisplay *display);
void gdk_display_set_rgba (GdkDisplay *display, void gdk_display_set_rgba (GdkDisplay *display,
gboolean rgba); gboolean rgba);

View File

@ -315,28 +315,30 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
} }
/* /*
* @request_hdr: %TRUE to request high dynamic range. * @prefers_high_depth: %TRUE to request a higher bit depth
* *
* If HDR is requested, GDK will see about providing a rendering target * If high depth is preferred, GDK will see about providing a rendering target
* that supports high dynamic range. Typically this means a target supporting * that supports higher bit depth than 8 bits per channel. Typically this means
* 16bit floating point pixels, but that is not guaranteed. * a target supporting 16bit floating point pixels, but that is not guaranteed.
* *
* This is only a request and if the GDK backend does not support HDR rendering * This is only a request and if the GDK backend does not support HDR rendering
* or does not consider it worthwhile, it may choose to not honor the request. * or does not consider it worthwhile, it may choose to not honor the request.
* It may also choose to provide HDR even if it was not requested. * It may also choose to provide high depth even if it was not requested.
* Typically the steps undertaken by a backend are: * Typically the steps undertaken by a backend are:
* 1. Check if HDR is supported by this drawing backend. * 1. Check if high depth is supported by this drawing backend.
* 2. Check if the compositor supports HDR. * 2. Check if the compositor supports high depth.
* 3. Check if the compositor prefers SDR. This is usually the case when the attached * 3. Check if the compositor prefers regular bit depth. This is usually the case
* monitors do not support HDR content or when the system is resource constrained. * when the attached monitors do not support high depth content or when the
* system is resource constrained.
* In either of those cases, the context will usually choose to not honor the request. * In either of those cases, the context will usually choose to not honor the request.
* *
* The rendering code must be able to deal with HDR and SDR content, no matter if HDR * The rendering code must be able to deal with content in any bit depth, no matter
* was requested. The request is only a hint and GDK is free to choose. * the preference. The prefers_high_depth argument is only a hint and GDK is free
* to choose.
*/ */
void void
gdk_draw_context_begin_frame_full (GdkDrawContext *context, gdk_draw_context_begin_frame_full (GdkDrawContext *context,
gboolean request_hdr, gboolean prefers_high_depth,
const cairo_region_t *region) const cairo_region_t *region)
{ {
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context); GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
@ -362,13 +364,13 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
return; return;
} }
if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HDR)) if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
request_hdr = TRUE; prefers_high_depth = TRUE;
priv->frame_region = cairo_region_copy (region); priv->frame_region = cairo_region_copy (region);
priv->surface->paint_context = g_object_ref (context); priv->surface->paint_context = g_object_ref (context);
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, request_hdr, priv->frame_region); GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
} }
#ifdef HAVE_SYSPROF #ifdef HAVE_SYSPROF

View File

@ -41,7 +41,7 @@ struct _GdkDrawContextClass
GObjectClass parent_class; GObjectClass parent_class;
void (* begin_frame) (GdkDrawContext *context, void (* begin_frame) (GdkDrawContext *context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *update_area); cairo_region_t *update_area);
void (* end_frame) (GdkDrawContext *context, void (* end_frame) (GdkDrawContext *context,
cairo_region_t *painted); cairo_region_t *painted);
@ -51,7 +51,7 @@ struct _GdkDrawContextClass
void gdk_draw_context_surface_resized (GdkDrawContext *context); void gdk_draw_context_surface_resized (GdkDrawContext *context);
void gdk_draw_context_begin_frame_full (GdkDrawContext *context, void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
gboolean request_hdr, gboolean prefers_high_depth,
const cairo_region_t *region); const cairo_region_t *region);
G_END_DECLS G_END_DECLS

View File

@ -589,7 +589,7 @@ gdk_gl_context_real_make_current (GdkGLContext *context,
static void static void
gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context, gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkGLContext *context = GDK_GL_CONTEXT (draw_context); GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
@ -602,7 +602,7 @@ gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
#ifdef HAVE_EGL #ifdef HAVE_EGL
if (priv->egl_context) if (priv->egl_context)
gdk_surface_ensure_egl_surface (surface, request_hdr); gdk_surface_ensure_egl_surface (surface, prefers_high_depth);
#endif #endif
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context); damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);

View File

@ -71,7 +71,7 @@ struct _GdkSurfacePrivate
gpointer egl_native_window; gpointer egl_native_window;
#ifdef HAVE_EGL #ifdef HAVE_EGL
EGLSurface egl_surface; EGLSurface egl_surface;
gboolean egl_surface_hdr; gboolean egl_surface_high_depth;
#endif #endif
gpointer widget; gpointer widget;
@ -1109,16 +1109,16 @@ gdk_surface_get_egl_surface (GdkSurface *self)
void void
gdk_surface_ensure_egl_surface (GdkSurface *self, gdk_surface_ensure_egl_surface (GdkSurface *self,
gboolean hdr) gboolean high_depth)
{ {
GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self); GdkSurfacePrivate *priv = gdk_surface_get_instance_private (self);
GdkDisplay *display = gdk_surface_get_display (self); GdkDisplay *display = gdk_surface_get_display (self);
g_return_if_fail (priv->egl_native_window != NULL); g_return_if_fail (priv->egl_native_window != NULL);
if (priv->egl_surface_hdr != hdr && if (priv->egl_surface_high_depth != high_depth &&
priv->egl_surface != NULL && priv->egl_surface != NULL &&
gdk_display_get_egl_config_hdr (display) != gdk_display_get_egl_config (display)) gdk_display_get_egl_config_high_depth (display) != gdk_display_get_egl_config (display))
{ {
eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface); eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
priv->egl_surface = NULL; priv->egl_surface = NULL;
@ -1127,11 +1127,11 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
if (priv->egl_surface == NULL) if (priv->egl_surface == NULL)
{ {
priv->egl_surface = eglCreateWindowSurface (gdk_display_get_egl_display (display), priv->egl_surface = eglCreateWindowSurface (gdk_display_get_egl_display (display),
hdr ? gdk_display_get_egl_config_hdr (display) high_depth ? gdk_display_get_egl_config_high_depth (display)
: gdk_display_get_egl_config (display), : gdk_display_get_egl_config (display),
(EGLNativeWindowType) priv->egl_native_window, (EGLNativeWindowType) priv->egl_native_window,
NULL); NULL);
priv->egl_surface_hdr = hdr; priv->egl_surface_high_depth = high_depth;
} }
#endif #endif
} }

View File

@ -425,7 +425,7 @@ device_supports_incremental_present (VkPhysicalDevice device)
static void static void
gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context, gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context); GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);

View File

@ -82,7 +82,7 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
static void static void
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context, _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context; GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;

View File

@ -291,7 +291,7 @@ opaque_region_covers_surface (GdkMacosGLContext *self)
static void static void
gdk_macos_gl_context_begin_frame (GdkDrawContext *context, gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *painted) cairo_region_t *painted)
{ {
GdkMacosGLContext *self = (GdkMacosGLContext *)context; GdkMacosGLContext *self = (GdkMacosGLContext *)context;
@ -345,7 +345,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
[self->gl_context update]; [self->gl_context update];
} }
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, request_hdr, painted); GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, prefers_high_depth, painted);
if (!self->is_attached) if (!self->is_attached)
{ {

View File

@ -144,7 +144,7 @@ gdk_wayland_cairo_context_create_surface (GdkWaylandCairoContext *self)
static void static void
gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context, gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context); GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);

View File

@ -47,12 +47,12 @@ G_DEFINE_TYPE (GdkWaylandGLContext, gdk_wayland_gl_context, GDK_TYPE_GL_CONTEXT)
static void static void
gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context, gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context)); gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, request_hdr, region); GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, prefers_high_depth, region);
glDrawBuffers (1, (GLenum[1]) { GL_BACK }); glDrawBuffers (1, (GLenum[1]) { GL_BACK });
} }

View File

@ -53,7 +53,7 @@ create_cairo_surface_for_surface (GdkSurface *surface,
static void static void
gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context, gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context); GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);

View File

@ -471,12 +471,12 @@ gdk_win32_gl_context_egl_make_current (GdkGLContext *context,
static void static void
gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context, gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *update_area) cairo_region_t *update_area)
{ {
gdk_win32_surface_handle_queued_move_resize (draw_context); gdk_win32_surface_handle_queued_move_resize (draw_context);
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, request_hdr, update_area); GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
} }
static void static void

View File

@ -118,12 +118,12 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
static void static void
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context, gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *update_area) cairo_region_t *update_area)
{ {
gdk_win32_surface_handle_queued_move_resize (draw_context); gdk_win32_surface_handle_queued_move_resize (draw_context);
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, request_hdr, update_area); GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
} }
static int static int

View File

@ -68,12 +68,12 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context,
static void static void
gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context, gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *update_area) cairo_region_t *update_area)
{ {
gdk_win32_surface_handle_queued_move_resize (draw_context); gdk_win32_surface_handle_queued_move_resize (draw_context);
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, request_hdr, update_area); GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
} }
static void static void

View File

@ -55,7 +55,7 @@ create_cairo_surface_for_surface (GdkSurface *surface)
static void static void
gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context, gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context); GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context);

View File

@ -61,10 +61,10 @@ gdk_x11_display_get_egl_display (GdkDisplay *display)
static void static void
gdk_x11_gl_context_egl_begin_frame (GdkDrawContext *draw_context, gdk_x11_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
gboolean request_hdr, gboolean prefers_high_depth,
cairo_region_t *region) cairo_region_t *region)
{ {
GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, request_hdr, region); GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->begin_frame (draw_context, prefers_high_depth, region);
glDrawBuffers (1, (GLenum[1]) { GL_BACK }); glDrawBuffers (1, (GLenum[1]) { GL_BACK });
} }