Skip to content

Commit

Permalink
[Ozone] Adding display related IPC messages
Browse files Browse the repository at this point in the history
These messages allow requesting display updates and performing basic display
configuration.

BUG=377497
NOTRY=true

Review URL: https://codereview.chromium.org/378673002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282022 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dnicoara@chromium.org committed Jul 9, 2014
1 parent f8d8464 commit 6aad2d4
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ui/display/types/display_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ enum DisplayConnectionType {
DISPLAY_CONNECTION_TYPE_DVI = 1 << 4,
DISPLAY_CONNECTION_TYPE_DISPLAYPORT = 1 << 5,
DISPLAY_CONNECTION_TYPE_NETWORK = 1 << 6,

// Update this when adding a new type.
DISPLAY_CONNECTION_TYPE_LAST = DISPLAY_CONNECTION_TYPE_NETWORK
};

// Content protection methods applied on video output.
Expand Down
31 changes: 31 additions & 0 deletions ui/ozone/common/gpu/ozone_gpu_message_params.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"

namespace ui {

DisplayMode_Params::DisplayMode_Params()
: size(), is_interlaced(false), refresh_rate(0.0f) {}

DisplayMode_Params::~DisplayMode_Params() {}

DisplaySnapshot_Params::DisplaySnapshot_Params()
: display_id(0),
has_proper_display_id(false),
origin(),
physical_size(),
type(ui::DISPLAY_CONNECTION_TYPE_NONE),
is_aspect_preserving_scaling(false),
has_overscan(false),
display_name(),
modes(),
has_current_mode(false),
current_mode(),
has_native_mode(false),
native_mode() {}

DisplaySnapshot_Params::~DisplaySnapshot_Params() {}

} // namespace ui
49 changes: 49 additions & 0 deletions ui/ozone/common/gpu/ozone_gpu_message_params.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_OZONE_COMMON_GPU_OZONE_GPU_MESSAGE_PARAMS_H_
#define UI_OZONE_COMMON_GPU_OZONE_GPU_MESSAGE_PARAMS_H_

#include <string>
#include <vector>

#include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"

namespace ui {

struct DisplayMode_Params {
DisplayMode_Params();
~DisplayMode_Params();

gfx::Size size;
bool is_interlaced;
float refresh_rate;
};

struct DisplaySnapshot_Params {
DisplaySnapshot_Params();
~DisplaySnapshot_Params();

int64_t display_id;
bool has_proper_display_id;
gfx::Point origin;
gfx::Size physical_size;
DisplayConnectionType type;
bool is_aspect_preserving_scaling;
bool has_overscan;
std::string display_name;
std::vector<DisplayMode_Params> modes;
bool has_current_mode;
DisplayMode_Params current_mode;
bool has_native_mode;
DisplayMode_Params native_mode;
std::string string_representation;
};

} // namespace ui

#endif // UI_OZONE_COMMON_GPU_OZONE_GPU_MESSAGE_PARAMS_H_

54 changes: 54 additions & 0 deletions ui/ozone/common/gpu/ozone_gpu_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,47 @@
// Multiply-included message file, hence no include guard here, but see below
// for a much smaller-than-usual include guard section.

#include <vector>

#include "ipc/ipc_message_macros.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
#include "ui/ozone/ozone_export.h"

#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT OZONE_EXPORT

#define IPC_MESSAGE_START OzoneGpuMsgStart

IPC_ENUM_TRAITS_MAX_VALUE(ui::DisplayConnectionType,
ui::DISPLAY_CONNECTION_TYPE_LAST)

IPC_STRUCT_TRAITS_BEGIN(ui::DisplayMode_Params)
IPC_STRUCT_TRAITS_MEMBER(size)
IPC_STRUCT_TRAITS_MEMBER(is_interlaced)
IPC_STRUCT_TRAITS_MEMBER(refresh_rate)
IPC_STRUCT_TRAITS_END()

IPC_STRUCT_TRAITS_BEGIN(ui::DisplaySnapshot_Params)
IPC_STRUCT_TRAITS_MEMBER(display_id)
IPC_STRUCT_TRAITS_MEMBER(has_proper_display_id)
IPC_STRUCT_TRAITS_MEMBER(origin)
IPC_STRUCT_TRAITS_MEMBER(physical_size)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(is_aspect_preserving_scaling)
IPC_STRUCT_TRAITS_MEMBER(has_overscan)
IPC_STRUCT_TRAITS_MEMBER(display_name)
IPC_STRUCT_TRAITS_MEMBER(modes)
IPC_STRUCT_TRAITS_MEMBER(has_current_mode)
IPC_STRUCT_TRAITS_MEMBER(current_mode)
IPC_STRUCT_TRAITS_MEMBER(has_native_mode)
IPC_STRUCT_TRAITS_MEMBER(native_mode)
IPC_STRUCT_TRAITS_MEMBER(string_representation)
IPC_STRUCT_TRAITS_END()

//------------------------------------------------------------------------------
// GPU Messages
// These are messages from the browser to the GPU process.
Expand All @@ -29,3 +58,28 @@ IPC_MESSAGE_CONTROL3(OzoneGpuMsg_CursorSet,
IPC_MESSAGE_CONTROL2(OzoneGpuMsg_CursorMove,
gfx::AcceleratedWidget, gfx::Point)

#if defined(OS_CHROMEOS)
// Force the DPMS state of the display to on.
IPC_MESSAGE_CONTROL0(OzoneGpuMsg_ForceDPMSOn)

// Trigger a display reconfiguration. OzoneHostMsg_UpdateNativeDisplays will be
// sent as a response.
IPC_MESSAGE_CONTROL0(OzoneGpuMsg_RefreshNativeDisplays)

// Configure a display with the specified mode at the specified location.
IPC_MESSAGE_CONTROL3(OzoneGpuMsg_ConfigureNativeDisplay,
int64_t, // display ID
ui::DisplayMode_Params, // display mode
gfx::Point) // origin for the display

IPC_MESSAGE_CONTROL1(OzoneGpuMsg_DisableNativeDisplay,
int64_t) // display ID

//------------------------------------------------------------------------------
// Browser Messages
// These messages are from the GPU to the browser process.

// Updates the list of active displays.
IPC_MESSAGE_CONTROL1(OzoneHostMsg_UpdateNativeDisplays,
std::vector<ui::DisplaySnapshot_Params>)
#endif
3 changes: 3 additions & 0 deletions ui/ozone/ozone.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
'common/chromeos/touchscreen_device_manager_ozone.h',
'common/gpu/ozone_gpu_message_generator.cc',
'common/gpu/ozone_gpu_message_generator.h',
'common/gpu/ozone_gpu_message_params.cc',
'common/gpu/ozone_gpu_message_params.h',
'common/gpu/ozone_gpu_messages.h',
'ozone_platform.cc',
'ozone_platform.h',
'ozone_switches.cc',
Expand Down

0 comments on commit 6aad2d4

Please sign in to comment.