Commit b2800e0f authored by Dominik Laskowski's avatar Dominik Laskowski Committed by Commit Bot

exo: Send extra display information to ARC

This CL adds a remote-shell event to plumb more display information,
namely the size in pixels and the EDID blob.

Bug: b:77972358
Bug: b:112480270
Test: Print size and EDID in HWC.
Change-Id: Ie254184033ae9426300962c474c1e40b40fad6c8
Reviewed-on: https://chromium-review.googlesource.com/1238564Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Dominik Laskowski <domlaskowski@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594413}
parent 748b4c8f
...@@ -2678,12 +2678,37 @@ class WaylandRemoteShell : public ash::TabletModeObserver, ...@@ -2678,12 +2678,37 @@ class WaylandRemoteShell : public ash::TabletModeObserver,
->GetDisplayInfo(display.id()) ->GetDisplayInfo(display.id())
.device_scale_factor(); .device_scale_factor();
uint32_t display_id_hi = static_cast<uint32_t>(display.id() >> 32);
uint32_t display_id_lo = static_cast<uint32_t>(display.id());
zcr_remote_shell_v1_send_workspace( zcr_remote_shell_v1_send_workspace(
remote_shell_resource_, static_cast<uint32_t>(display.id() >> 32), remote_shell_resource_, display_id_hi, display_id_lo, bounds.x(),
static_cast<uint32_t>(display.id()), bounds.x(), bounds.y(), bounds.y(), bounds.width(), bounds.height(), insets.left(),
bounds.width(), bounds.height(), insets.left(), insets.top(), insets.top(), insets.right(), insets.bottom(),
insets.right(), insets.bottom(), DisplayTransform(display.rotation()), DisplayTransform(display.rotation()),
wl_fixed_from_double(device_scale_factor), display.IsInternal()); wl_fixed_from_double(device_scale_factor), display.IsInternal());
if (wl_resource_get_version(remote_shell_resource_) >= 19) {
gfx::Size size_in_pixel = display.GetSizeInPixel();
wl_array data;
wl_array_init(&data);
const auto& bytes =
WMHelper::GetInstance()->GetDisplayIdentificationData(display.id());
for (uint8_t byte : bytes) {
uint8_t* ptr =
static_cast<uint8_t*>(wl_array_add(&data, sizeof(uint8_t)));
DCHECK(ptr);
*ptr = byte;
}
zcr_remote_shell_v1_send_display_info(
remote_shell_resource_, display_id_hi, display_id_lo,
size_in_pixel.width(), size_in_pixel.height(), &data);
wl_array_release(&data);
}
} }
zcr_remote_shell_v1_send_configure(remote_shell_resource_, layout_mode_); zcr_remote_shell_v1_send_configure(remote_shell_resource_, layout_mode_);
...@@ -2965,7 +2990,7 @@ const struct zcr_remote_shell_v1_interface remote_shell_implementation = { ...@@ -2965,7 +2990,7 @@ const struct zcr_remote_shell_v1_interface remote_shell_implementation = {
remote_shell_get_notification_surface, remote_shell_get_notification_surface,
remote_shell_get_input_method_surface}; remote_shell_get_input_method_surface};
const uint32_t remote_shell_version = 18; const uint32_t remote_shell_version = 19;
void bind_remote_shell(wl_client* client, void bind_remote_shell(wl_client* client,
void* data, void* data,
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#include "ui/aura/client/drag_drop_delegate.h" #include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/client/focus_client.h" #include "ui/aura/client/focus_client.h"
#include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/display/manager/display_configurator.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
#include "ui/display/types/display_snapshot.h"
#include "ui/events/devices/input_device_manager.h" #include "ui/events/devices/input_device_manager.h"
#include "ui/wm/public/activation_client.h" #include "ui/wm/public/activation_client.h"
...@@ -153,6 +155,21 @@ const display::ManagedDisplayInfo& WMHelper::GetDisplayInfo( ...@@ -153,6 +155,21 @@ const display::ManagedDisplayInfo& WMHelper::GetDisplayInfo(
return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id);
} }
const std::vector<uint8_t>& WMHelper::GetDisplayIdentificationData(
int64_t display_id) const {
const auto& displays = ash::Shell::Get()
->window_tree_host_manager()
->display_configurator()
->cached_displays();
for (display::DisplaySnapshot* display : displays)
if (display->display_id() == display_id)
return display->edid();
static std::vector<uint8_t> no_data;
return no_data;
}
aura::Window* WMHelper::GetPrimaryDisplayContainer(int container_id) { aura::Window* WMHelper::GetPrimaryDisplayContainer(int container_id) {
return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(),
container_id); container_id);
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef COMPONENTS_EXO_WM_HELPER_H_ #ifndef COMPONENTS_EXO_WM_HELPER_H_
#define COMPONENTS_EXO_WM_HELPER_H_ #define COMPONENTS_EXO_WM_HELPER_H_
#include <vector>
#include "ash/display/window_tree_host_manager.h" #include "ash/display/window_tree_host_manager.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
...@@ -89,6 +91,9 @@ class WMHelper : public aura::client::DragDropDelegate { ...@@ -89,6 +91,9 @@ class WMHelper : public aura::client::DragDropDelegate {
void RemoveVSyncObserver(ui::CompositorVSyncManager::Observer* observer); void RemoveVSyncObserver(ui::CompositorVSyncManager::Observer* observer);
const display::ManagedDisplayInfo& GetDisplayInfo(int64_t display_id) const; const display::ManagedDisplayInfo& GetDisplayInfo(int64_t display_id) const;
const std::vector<uint8_t>& GetDisplayIdentificationData(
int64_t display_id) const;
aura::Window* GetPrimaryDisplayContainer(int container_id); aura::Window* GetPrimaryDisplayContainer(int container_id);
aura::Window* GetActiveWindow() const; aura::Window* GetActiveWindow() const;
aura::Window* GetFocusedWindow() const; aura::Window* GetFocusedWindow() const;
......
...@@ -302,8 +302,8 @@ struct zcr_remote_shell_v1_listener { ...@@ -302,8 +302,8 @@ struct zcr_remote_shell_v1_listener {
*/ */
void (*workspace)(void *data, void (*workspace)(void *data,
struct zcr_remote_shell_v1 *zcr_remote_shell_v1, struct zcr_remote_shell_v1 *zcr_remote_shell_v1,
uint32_t id_hi, uint32_t display_id_hi,
uint32_t id_lo, uint32_t display_id_lo,
int32_t x, int32_t x,
int32_t y, int32_t y,
int32_t width, int32_t width,
...@@ -335,6 +335,21 @@ struct zcr_remote_shell_v1_listener { ...@@ -335,6 +335,21 @@ struct zcr_remote_shell_v1_listener {
void (*default_device_scale_factor)(void *data, void (*default_device_scale_factor)(void *data,
struct zcr_remote_shell_v1 *zcr_remote_shell_v1, struct zcr_remote_shell_v1 *zcr_remote_shell_v1,
int32_t scale); int32_t scale);
/**
* extra display information
*
* Sends display size in pixels and display identification data,
* typically in EDID format. Preceded by a "workspace" event for
* the same display.
* @since 19
*/
void (*display_info)(void *data,
struct zcr_remote_shell_v1 *zcr_remote_shell_v1,
uint32_t display_id_hi,
uint32_t display_id_lo,
int32_t width,
int32_t height,
struct wl_array *identification_data);
}; };
/** /**
...@@ -373,6 +388,10 @@ zcr_remote_shell_v1_add_listener(struct zcr_remote_shell_v1 *zcr_remote_shell_v1 ...@@ -373,6 +388,10 @@ zcr_remote_shell_v1_add_listener(struct zcr_remote_shell_v1 *zcr_remote_shell_v1
* @ingroup iface_zcr_remote_shell_v1 * @ingroup iface_zcr_remote_shell_v1
*/ */
#define ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR_SINCE_VERSION 8 #define ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR_SINCE_VERSION 8
/**
* @ingroup iface_zcr_remote_shell_v1
*/
#define ZCR_REMOTE_SHELL_V1_DISPLAY_INFO_SINCE_VERSION 19
/** /**
* @ingroup iface_zcr_remote_shell_v1 * @ingroup iface_zcr_remote_shell_v1
......
...@@ -327,6 +327,7 @@ struct zcr_remote_shell_v1_interface { ...@@ -327,6 +327,7 @@ struct zcr_remote_shell_v1_interface {
#define ZCR_REMOTE_SHELL_V1_WORKSPACE 2 #define ZCR_REMOTE_SHELL_V1_WORKSPACE 2
#define ZCR_REMOTE_SHELL_V1_CONFIGURE 3 #define ZCR_REMOTE_SHELL_V1_CONFIGURE 3
#define ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR 4 #define ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR 4
#define ZCR_REMOTE_SHELL_V1_DISPLAY_INFO 5
/** /**
* @ingroup iface_zcr_remote_shell_v1 * @ingroup iface_zcr_remote_shell_v1
...@@ -348,6 +349,10 @@ struct zcr_remote_shell_v1_interface { ...@@ -348,6 +349,10 @@ struct zcr_remote_shell_v1_interface {
* @ingroup iface_zcr_remote_shell_v1 * @ingroup iface_zcr_remote_shell_v1
*/ */
#define ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR_SINCE_VERSION 8 #define ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR_SINCE_VERSION 8
/**
* @ingroup iface_zcr_remote_shell_v1
*/
#define ZCR_REMOTE_SHELL_V1_DISPLAY_INFO_SINCE_VERSION 19
/** /**
* @ingroup iface_zcr_remote_shell_v1 * @ingroup iface_zcr_remote_shell_v1
...@@ -395,9 +400,9 @@ zcr_remote_shell_v1_send_configuration_changed(struct wl_resource *resource_, in ...@@ -395,9 +400,9 @@ zcr_remote_shell_v1_send_configuration_changed(struct wl_resource *resource_, in
* @param is_internal 1 if screen is built-in * @param is_internal 1 if screen is built-in
*/ */
static inline void static inline void
zcr_remote_shell_v1_send_workspace(struct wl_resource *resource_, uint32_t id_hi, uint32_t id_lo, int32_t x, int32_t y, int32_t width, int32_t height, int32_t inset_left, int32_t inset_top, int32_t inset_right, int32_t inset_bottom, int32_t transform, wl_fixed_t scale_factor, uint32_t is_internal) zcr_remote_shell_v1_send_workspace(struct wl_resource *resource_, uint32_t display_id_hi, uint32_t display_id_lo, int32_t x, int32_t y, int32_t width, int32_t height, int32_t inset_left, int32_t inset_top, int32_t inset_right, int32_t inset_bottom, int32_t transform, wl_fixed_t scale_factor, uint32_t is_internal)
{ {
wl_resource_post_event(resource_, ZCR_REMOTE_SHELL_V1_WORKSPACE, id_hi, id_lo, x, y, width, height, inset_left, inset_top, inset_right, inset_bottom, transform, scale_factor, is_internal); wl_resource_post_event(resource_, ZCR_REMOTE_SHELL_V1_WORKSPACE, display_id_hi, display_id_lo, x, y, width, height, inset_left, inset_top, inset_right, inset_bottom, transform, scale_factor, is_internal);
} }
/** /**
...@@ -423,6 +428,17 @@ zcr_remote_shell_v1_send_default_device_scale_factor(struct wl_resource *resourc ...@@ -423,6 +428,17 @@ zcr_remote_shell_v1_send_default_device_scale_factor(struct wl_resource *resourc
wl_resource_post_event(resource_, ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR, scale); wl_resource_post_event(resource_, ZCR_REMOTE_SHELL_V1_DEFAULT_DEVICE_SCALE_FACTOR, scale);
} }
/**
* @ingroup iface_zcr_remote_shell_v1
* Sends an display_info event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zcr_remote_shell_v1_send_display_info(struct wl_resource *resource_, uint32_t display_id_hi, uint32_t display_id_lo, int32_t width, int32_t height, struct wl_array *identification_data)
{
wl_resource_post_event(resource_, ZCR_REMOTE_SHELL_V1_DISPLAY_INFO, display_id_hi, display_id_lo, width, height, identification_data);
}
#ifndef ZCR_REMOTE_SURFACE_V1_SYSTEMUI_VISIBILITY_STATE_ENUM #ifndef ZCR_REMOTE_SURFACE_V1_SYSTEMUI_VISIBILITY_STATE_ENUM
#define ZCR_REMOTE_SURFACE_V1_SYSTEMUI_VISIBILITY_STATE_ENUM #define ZCR_REMOTE_SURFACE_V1_SYSTEMUI_VISIBILITY_STATE_ENUM
/** /**
......
...@@ -71,12 +71,13 @@ static const struct wl_message zcr_remote_shell_v1_events[] = { ...@@ -71,12 +71,13 @@ static const struct wl_message zcr_remote_shell_v1_events[] = {
{ "workspace", "5uuiiiiiiiiifu", types + 0 }, { "workspace", "5uuiiiiiiiiifu", types + 0 },
{ "configure", "5u", types + 0 }, { "configure", "5u", types + 0 },
{ "default_device_scale_factor", "8i", types + 0 }, { "default_device_scale_factor", "8i", types + 0 },
{ "display_info", "19uuiia", types + 0 },
}; };
WL_EXPORT const struct wl_interface zcr_remote_shell_v1_interface = { WL_EXPORT const struct wl_interface zcr_remote_shell_v1_interface = {
"zcr_remote_shell_v1", 18, "zcr_remote_shell_v1", 19,
4, zcr_remote_shell_v1_requests, 4, zcr_remote_shell_v1_requests,
5, zcr_remote_shell_v1_events, 6, zcr_remote_shell_v1_events,
}; };
static const struct wl_message zcr_remote_surface_v1_requests[] = { static const struct wl_message zcr_remote_surface_v1_requests[] = {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
reset. reset.
</description> </description>
<interface name="zcr_remote_shell_v1" version="18"> <interface name="zcr_remote_shell_v1" version="19">
<description summary="remote_shell"> <description summary="remote_shell">
The global interface that allows clients to turn a wl_surface into a The global interface that allows clients to turn a wl_surface into a
"real window" which is remotely managed but can be stacked, activated "real window" which is remotely managed but can be stacked, activated
...@@ -151,8 +151,8 @@ ...@@ -151,8 +151,8 @@
Defines an area of the remote shell used for layout. Each series of Defines an area of the remote shell used for layout. Each series of
"workspace" events must be terminated by a "configure" event. "workspace" events must be terminated by a "configure" event.
</description> </description>
<arg name="id_hi" type="uint"/> <arg name="display_id_hi" type="uint"/>
<arg name="id_lo" type="uint"/> <arg name="display_id_lo" type="uint"/>
<arg name="x" type="int"/> <arg name="x" type="int"/>
<arg name="y" type="int"/> <arg name="y" type="int"/>
<arg name="width" type="int"/> <arg name="width" type="int"/>
...@@ -193,6 +193,20 @@ ...@@ -193,6 +193,20 @@
<arg name="id" type="new_id" interface="zcr_input_method_surface_v1"/> <arg name="id" type="new_id" interface="zcr_input_method_surface_v1"/>
<arg name="surface" type="object" interface="wl_surface"/> <arg name="surface" type="object" interface="wl_surface"/>
</request> </request>
<!-- Version 19 additions -->
<event name="display_info" since="19">
<description summary="extra display information">
Sends display size in pixels and display identification data, typically
in EDID format. Preceded by a "workspace" event for the same display.
</description>
<arg name="display_id_hi" type="uint"/>
<arg name="display_id_lo" type="uint"/>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
<arg name="identification_data" type="array"/>
</event>
</interface> </interface>
<interface name="zcr_remote_surface_v1" version="18"> <interface name="zcr_remote_surface_v1" version="18">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment