Commit a436b4f1 authored by robert.bradford's avatar robert.bradford Committed by Commit bot

ozone: Directly provide size of active mode from HardwareDisplayController

This change adds a GetModeSize() method that returns the size of the
HDC's output as a convenience.

TEST=Boot chrome on link_freon (and attach an external display.)
BUG=None

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

Cr-Commit-Position: refs/heads/master@{#293161}
parent dd9554f3
...@@ -58,10 +58,8 @@ void DriSurface::ResizeCanvas(const gfx::Size& viewport_size) { ...@@ -58,10 +58,8 @@ void DriSurface::ResizeCanvas(const gfx::Size& viewport_size) {
// For the display buffers use the mode size since a |viewport_size| smaller // For the display buffers use the mode size since a |viewport_size| smaller
// than the display size will not scanout. // than the display size will not scanout.
gfx::Size mode_size(controller->get_mode().hdisplay,
controller->get_mode().vdisplay);
for (size_t i = 0; i < arraysize(buffers_); ++i) for (size_t i = 0; i < arraysize(buffers_); ++i)
buffers_[i] = AllocateBuffer(dri_, mode_size); buffers_[i] = AllocateBuffer(dri_, controller->GetModeSize());
} }
void DriSurface::PresentCanvas(const gfx::Rect& damage) { void DriSurface::PresentCanvas(const gfx::Rect& damage) {
......
...@@ -100,8 +100,7 @@ bool GbmSurface::Initialize() { ...@@ -100,8 +100,7 @@ bool GbmSurface::Initialize() {
// creation doesn't fail. // creation doesn't fail.
gfx::Size size(1, 1); gfx::Size size(1, 1);
if (window_delegate_->GetController()) { if (window_delegate_->GetController()) {
const drmModeModeInfo& mode = window_delegate_->GetController()->get_mode(); size = window_delegate_->GetController()->GetModeSize();
size.SetSize(mode.hdisplay, mode.vdisplay);
} }
// TODO(dnicoara) Check underlying system support for pixel format. // TODO(dnicoara) Check underlying system support for pixel format.
native_surface_ = native_surface_ =
......
...@@ -258,6 +258,10 @@ bool HardwareDisplayController::IsDisabled() const { ...@@ -258,6 +258,10 @@ bool HardwareDisplayController::IsDisabled() const {
return is_disabled_; return is_disabled_;
} }
gfx::Size HardwareDisplayController::GetModeSize() const {
return gfx::Size(mode_.hdisplay, mode_.vdisplay);
}
bool HardwareDisplayController::ModesetCrtc( bool HardwareDisplayController::ModesetCrtc(
const scoped_refptr<ScanoutBuffer>& buffer, const scoped_refptr<ScanoutBuffer>& buffer,
drmModeModeInfo mode, drmModeModeInfo mode,
......
...@@ -167,6 +167,7 @@ class HardwareDisplayController ...@@ -167,6 +167,7 @@ class HardwareDisplayController
bool HasCrtc(uint32_t crtc) const; bool HasCrtc(uint32_t crtc) const;
bool IsMirrored() const; bool IsMirrored() const;
bool IsDisabled() const; bool IsDisabled() const;
gfx::Size GetModeSize() const;
gfx::Point origin() const { return origin_; } gfx::Point origin() const { return origin_; }
void set_origin(const gfx::Point& origin) { origin_ = origin; } void set_origin(const gfx::Point& origin) { origin_ = origin; }
......
...@@ -16,14 +16,6 @@ ...@@ -16,14 +16,6 @@
namespace ui { namespace ui {
namespace {
gfx::Size GetModeSize(const drmModeModeInfo& mode) {
return gfx::Size(mode.hdisplay, mode.vdisplay);
}
} // namespace
ScreenManager::ScreenManager(DriWrapper* dri, ScreenManager::ScreenManager(DriWrapper* dri,
ScanoutBufferGenerator* buffer_generator) ScanoutBufferGenerator* buffer_generator)
: dri_(dri), buffer_generator_(buffer_generator) { : dri_(dri), buffer_generator_(buffer_generator) {
...@@ -46,7 +38,8 @@ bool ScreenManager::ConfigureDisplayController(uint32_t crtc, ...@@ -46,7 +38,8 @@ bool ScreenManager::ConfigureDisplayController(uint32_t crtc,
uint32_t connector, uint32_t connector,
const gfx::Point& origin, const gfx::Point& origin,
const drmModeModeInfo& mode) { const drmModeModeInfo& mode) {
gfx::Rect modeset_bounds(origin, GetModeSize(mode)); gfx::Rect modeset_bounds(
origin.x(), origin.y(), mode.hdisplay, mode.vdisplay);
HardwareDisplayControllers::iterator it = FindDisplayController(crtc); HardwareDisplayControllers::iterator it = FindDisplayController(crtc);
HardwareDisplayController* controller = NULL; HardwareDisplayController* controller = NULL;
if (it != controllers_.end()) { if (it != controllers_.end()) {
...@@ -143,8 +136,7 @@ ScreenManager::FindActiveDisplayControllerByLocation(const gfx::Rect& bounds) { ...@@ -143,8 +136,7 @@ ScreenManager::FindActiveDisplayControllerByLocation(const gfx::Rect& bounds) {
for (HardwareDisplayControllers::iterator it = controllers_.begin(); for (HardwareDisplayControllers::iterator it = controllers_.begin();
it != controllers_.end(); it != controllers_.end();
++it) { ++it) {
gfx::Rect controller_bounds((*it)->origin(), gfx::Rect controller_bounds((*it)->origin(), (*it)->GetModeSize());
GetModeSize((*it)->get_mode()));
// We don't perform a strict check since content_shell will have windows // We don't perform a strict check since content_shell will have windows
// smaller than the display size. // smaller than the display size.
if (controller_bounds.Contains(bounds) && !(*it)->IsDisabled()) if (controller_bounds.Contains(bounds) && !(*it)->IsDisabled())
......
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