| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| 6 | 6 |
| 7 #include <xf86drmMode.h> | 7 #include <xf86drmMode.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 OverlayPlane ScreenManager::GetModesetBuffer( | 332 OverlayPlane ScreenManager::GetModesetBuffer( |
| 333 HardwareDisplayController* controller, | 333 HardwareDisplayController* controller, |
| 334 const gfx::Rect& bounds) { | 334 const gfx::Rect& bounds) { |
| 335 DrmWindow* window = FindWindowAt(bounds); | 335 DrmWindow* window = FindWindowAt(bounds); |
| 336 if (window) { | 336 if (window) { |
| 337 const OverlayPlane* primary = window->GetLastModesetBuffer(); | 337 const OverlayPlane* primary = window->GetLastModesetBuffer(); |
| 338 if (primary && primary->buffer->GetSize() == bounds.size()) | 338 const DrmDevice* drm = controller->GetAllocationDrmDevice().get(); |
| 339 if (primary && primary->buffer->GetSize() == bounds.size() && |
| 340 primary->buffer->GetDrmDevice() == drm) |
| 339 return *primary; | 341 return *primary; |
| 340 } | 342 } |
| 341 | 343 |
| 342 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); | 344 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); |
| 343 scoped_refptr<ScanoutBuffer> buffer = buffer_generator_->Create( | 345 scoped_refptr<ScanoutBuffer> buffer = buffer_generator_->Create( |
| 344 drm, gfx::BufferFormat::BGRA_8888, bounds.size()); | 346 drm, gfx::BufferFormat::BGRA_8888, bounds.size()); |
| 345 if (!buffer) { | 347 if (!buffer) { |
| 346 LOG(ERROR) << "Failed to create scanout buffer"; | 348 LOG(ERROR) << "Failed to create scanout buffer"; |
| 347 return OverlayPlane(nullptr, 0, gfx::OVERLAY_TRANSFORM_INVALID, gfx::Rect(), | 349 return OverlayPlane(nullptr, 0, gfx::OVERLAY_TRANSFORM_INVALID, gfx::Rect(), |
| 348 gfx::RectF()); | 350 gfx::RectF()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { | 385 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { |
| 384 for (auto pair : window_map_) { | 386 for (auto pair : window_map_) { |
| 385 if (pair.second->bounds() == bounds) | 387 if (pair.second->bounds() == bounds) |
| 386 return pair.second; | 388 return pair.second; |
| 387 } | 389 } |
| 388 | 390 |
| 389 return nullptr; | 391 return nullptr; |
| 390 } | 392 } |
| 391 | 393 |
| 392 } // namespace ui | 394 } // namespace ui |
| OLD | NEW |