Skip to content

Commit

Permalink
exo: Adds a HDR demo wayland client
Browse files Browse the repository at this point in the history
This is intended to aid the development of the color manager protocol.

The demo program connects to the color manager API, swaps between and
HDR and non-HDR color space, and currently has two modes:

-   Gradient rendering mode (to demo color gamuts)
-   White-on-black box (to demo dynamic range)

BUG=b:192562912

TESTED=The program compiles but fails, and will work as we implement the
protocol. It works conviningly against an in-progress implementation.

Change-Id: I09f34095fff3cc4005239b3cd900f0f708c07ece
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3253903
Commit-Queue: Jim Shargo <jshargo@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/main@{#939422}
  • Loading branch information
Jim Shargo authored and Chromium LUCI CQ committed Nov 8, 2021
1 parent 264dae1 commit fd58d42
Show file tree
Hide file tree
Showing 6 changed files with 356 additions and 1 deletion.
20 changes: 20 additions & 0 deletions components/exo/wayland/BUILD.gn
Expand Up @@ -301,6 +301,7 @@ source_set("client_support") {

public_deps = [
"//components/exo/wayland/protocol:aura_shell_protocol",
"//components/exo/wayland/protocol:chrome_color_management_protocol",
"//components/exo/wayland/protocol:overlay_prioritizer_protocol",
"//components/exo/wayland/protocol:surface_augmenter_protocol",
"//skia",
Expand Down Expand Up @@ -720,6 +721,25 @@ if (ozone_platform_drm) {
deps += [ "//third_party/minigbm" ]
}

executable("wayland_hdr_client") {
sources = [ "clients/hdr.cc" ]

deps = [
":client_support",
"//base",
"//build/config/linux/libdrm",
"//components/exo/wayland/protocol:chrome_color_management_protocol",
"//skia",
"//third_party/wayland:wayland_client",
"//third_party/wayland-protocols:linux_dmabuf_protocol",
"//third_party/wayland-protocols:presentation_time_protocol",
"//ui/gfx/geometry",
]

configs += [ "//ui/gl:gl_config" ]
deps += [ "//third_party/minigbm" ]
}

executable("wayland_explicit_synchronization_client") {
sources = [ "clients/explicit_synchronization.cc" ]

Expand Down
7 changes: 6 additions & 1 deletion components/exo/wayland/clients/client_base.cc
Expand Up @@ -8,6 +8,7 @@
#include "components/exo/wayland/clients/client_base.h"

#include <aura-shell-client-protocol.h>
#include <chrome-color-management-client-protocol.h>
#include <fcntl.h>
#include <fullscreen-shell-unstable-v1-client-protocol.h>
#include <linux-dmabuf-unstable-v1-client-protocol.h>
Expand Down Expand Up @@ -158,6 +159,9 @@ void RegistryHandler(void* data,
} else if (strcmp(interface, "wl_subcompositor") == 0) {
globals->subcompositor.reset(static_cast<wl_subcompositor*>(
wl_registry_bind(registry, id, &wl_subcompositor_interface, 1)));
} else if (strcmp(interface, "zcr_color_manager_v1") == 0) {
globals->color_manager.reset(static_cast<zcr_color_manager_v1*>(
wl_registry_bind(registry, id, &zcr_color_manager_v1_interface, 1)));
} else if (strcmp(interface, "zwp_input_timestamps_manager_v1") == 0) {
globals->input_timestamps_manager.reset(
static_cast<zwp_input_timestamps_manager_v1*>(wl_registry_bind(
Expand Down Expand Up @@ -296,7 +300,8 @@ std::unique_ptr<ScopedVkRenderPass> CreateVkRenderPass(VkDevice vk_device) {
};
VkAttachmentReference attachment_reference[]{
{
.attachment = 0, .layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
.attachment = 0,
.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
},
};
VkSubpassDescription subpass_description[]{
Expand Down
1 change: 1 addition & 0 deletions components/exo/wayland/clients/client_base.h
Expand Up @@ -92,6 +92,7 @@ class ClientBase {
std::unique_ptr<zwp_linux_explicit_synchronization_v1>
linux_explicit_synchronization;
std::unique_ptr<zcr_vsync_feedback_v1> vsync_feedback;
std::unique_ptr<zcr_color_manager_v1> color_manager;
std::unique_ptr<zcr_stylus_v2> stylus;
};

Expand Down
8 changes: 8 additions & 0 deletions components/exo/wayland/clients/client_helper.cc
Expand Up @@ -4,6 +4,7 @@

#include "components/exo/wayland/clients/client_helper.h"

#include <chrome-color-management-client-protocol.h>
#include <input-timestamps-unstable-v1-client-protocol.h>
#include <linux-dmabuf-unstable-v1-client-protocol.h>
#include <linux-explicit-synchronization-unstable-v1-client-protocol.h>
Expand Down Expand Up @@ -55,6 +56,13 @@ DEFAULT_DELETER(struct wp_presentation_feedback,
DEFAULT_DELETER(zaura_shell, zaura_shell_destroy)
DEFAULT_DELETER(zaura_surface, zaura_surface_destroy)
DEFAULT_DELETER(zaura_output, zaura_output_destroy)
DEFAULT_DELETER(zcr_color_manager_v1, zcr_color_manager_v1_destroy)
DEFAULT_DELETER(zcr_color_management_output_v1,
zcr_color_management_output_v1_destroy)
DEFAULT_DELETER(zcr_color_management_surface_v1,
zcr_color_management_surface_v1_destroy)
DEFAULT_DELETER(zcr_color_space_creator_v1, zcr_color_space_creator_v1_destroy)
DEFAULT_DELETER(zcr_color_space_v1, zcr_color_space_v1_destroy)
DEFAULT_DELETER(zwp_linux_buffer_release_v1,
zwp_linux_buffer_release_v1_destroy)
DEFAULT_DELETER(zwp_fullscreen_shell_v1, zwp_fullscreen_shell_v1_destroy)
Expand Down
6 changes: 6 additions & 0 deletions components/exo/wayland/clients/client_helper.h
Expand Up @@ -7,6 +7,7 @@

#include <alpha-compositing-unstable-v1-client-protocol.h>
#include <aura-shell-client-protocol.h>
#include <chrome-color-management-client-protocol.h>
#include <cursor-shapes-unstable-v1-client-protocol.h>
#include <extended-drag-unstable-v1-client-protocol.h>
#include <fullscreen-shell-unstable-v1-client-protocol.h>
Expand Down Expand Up @@ -81,6 +82,11 @@ DEFAULT_DELETER_FDECL(struct wp_presentation_feedback)
DEFAULT_DELETER_FDECL(zaura_shell)
DEFAULT_DELETER_FDECL(zaura_surface)
DEFAULT_DELETER_FDECL(zaura_output)
DEFAULT_DELETER_FDECL(zcr_color_manager_v1)
DEFAULT_DELETER_FDECL(zcr_color_management_output_v1)
DEFAULT_DELETER_FDECL(zcr_color_management_surface_v1)
DEFAULT_DELETER_FDECL(zcr_color_space_creator_v1)
DEFAULT_DELETER_FDECL(zcr_color_space_v1)
DEFAULT_DELETER_FDECL(zwp_linux_buffer_release_v1)
DEFAULT_DELETER_FDECL(zwp_fullscreen_shell_v1)
DEFAULT_DELETER_FDECL(zwp_input_timestamps_manager_v1)
Expand Down

0 comments on commit fd58d42

Please sign in to comment.