Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: ui/ozone/platform/dri/screen_manager.cc

Issue 479713002: [Ozone-GBM] Adding NativeWindowDelegate to IPC window changes to the GPU (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix name Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/screen_manager.cc
diff --git a/ui/ozone/platform/dri/screen_manager.cc b/ui/ozone/platform/dri/screen_manager.cc
index f583c8ccb0266ff0f5d4fd3ebc31018904c1023d..87364dc51712bed1e475c7c3d4ffa90ac8efb88f 100644
--- a/ui/ozone/platform/dri/screen_manager.cc
+++ b/ui/ozone/platform/dri/screen_manager.cc
@@ -16,6 +16,14 @@
namespace ui {
+namespace {
+
+gfx::Size GetModeSize(const drmModeModeInfo& mode) {
+ return gfx::Size(mode.hdisplay, mode.vdisplay);
+}
+
+} // namespace
+
ScreenManager::ScreenManager(
DriWrapper* dri, ScanoutBufferGenerator* buffer_generator)
: dri_(dri), buffer_generator_(buffer_generator), last_added_widget_(0) {
@@ -111,6 +119,22 @@ base::WeakPtr<HardwareDisplayController> ScreenManager::GetDisplayController(
return base::WeakPtr<HardwareDisplayController>();
}
+base::WeakPtr<HardwareDisplayController> ScreenManager::GetDisplayController(
+ const gfx::Rect& bounds) {
+ // TODO(dnicoara): Remove hack once TestScreen uses a simple Ozone display
+ // configuration reader and ScreenManager is called from there to create the
+ // one display needed by the content_shell target.
+ if (controllers_.empty())
+ ForceInitializationOfPrimaryDisplay();
+
+ HardwareDisplayControllerMap::iterator it =
+ FindActiveDisplayControllerByLocation(bounds);
+ if (it != controllers_.end())
+ return it->second->AsWeakPtr();
+
+ return base::WeakPtr<HardwareDisplayController>();
+}
+
ScreenManager::HardwareDisplayControllerMap::iterator
ScreenManager::FindDisplayController(uint32_t crtc) {
for (HardwareDisplayControllerMap::iterator it = controllers_.begin();
@@ -135,6 +159,22 @@ ScreenManager::FindDisplayControllerByOrigin(const gfx::Point& origin) {
return controllers_.end();
}
+ScreenManager::HardwareDisplayControllerMap::iterator
+ScreenManager::FindActiveDisplayControllerByLocation(const gfx::Rect& bounds) {
+ for (HardwareDisplayControllerMap::iterator it = controllers_.begin();
+ it != controllers_.end();
+ ++it) {
+ gfx::Rect controller_bounds(it->second->origin(),
+ GetModeSize(it->second->get_mode()));
+ // We don't perform a strict check since content_shell will have windows
+ // smaller than the display size.
+ if (controller_bounds.Contains(bounds))
+ return it;
+ }
+
+ return controllers_.end();
+}
+
void ScreenManager::ForceInitializationOfPrimaryDisplay() {
ScopedVector<HardwareDisplayControllerInfo> displays =
GetAvailableDisplayControllerInfos(dri_->get_fd());
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698