| 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 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
| 13 #include "ui/display/types/display_mode.h" |
| 13 #include "ui/gfx/geometry/point.h" | 14 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/ozone/platform/drm/common/drm_util.h" | 17 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 17 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 18 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
| 18 #include "ui/ozone/platform/drm/gpu/drm_console_buffer.h" | 19 #include "ui/ozone/platform/drm/gpu/drm_console_buffer.h" |
| 19 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 20 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
| 20 #include "ui/ozone/platform/drm/gpu/drm_window.h" | 21 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| 21 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" | 22 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
| 22 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 23 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 const gfx::Rect& bounds) { | 335 const gfx::Rect& bounds) { |
| 335 DrmWindow* window = FindWindowAt(bounds); | 336 DrmWindow* window = FindWindowAt(bounds); |
| 336 if (window) { | 337 if (window) { |
| 337 const OverlayPlane* primary = window->GetLastModesetBuffer(); | 338 const OverlayPlane* primary = window->GetLastModesetBuffer(); |
| 338 const DrmDevice* drm = controller->GetAllocationDrmDevice().get(); | 339 const DrmDevice* drm = controller->GetAllocationDrmDevice().get(); |
| 339 if (primary && primary->buffer->GetSize() == bounds.size() && | 340 if (primary && primary->buffer->GetSize() == bounds.size() && |
| 340 primary->buffer->GetDrmDevice() == drm) | 341 primary->buffer->GetDrmDevice() == drm) |
| 341 return *primary; | 342 return *primary; |
| 342 } | 343 } |
| 343 | 344 |
| 345 gfx::BufferFormat format = ui::DisplayMode::PrimaryFormat(); |
| 344 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); | 346 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); |
| 345 scoped_refptr<ScanoutBuffer> buffer = buffer_generator_->Create( | 347 scoped_refptr<ScanoutBuffer> buffer = |
| 346 drm, gfx::BufferFormat::BGRA_8888, bounds.size()); | 348 buffer_generator_->Create(drm, format, bounds.size()); |
| 347 if (!buffer) { | 349 if (!buffer) { |
| 348 LOG(ERROR) << "Failed to create scanout buffer"; | 350 LOG(ERROR) << "Failed to create scanout buffer"; |
| 349 return OverlayPlane(nullptr, 0, gfx::OVERLAY_TRANSFORM_INVALID, gfx::Rect(), | 351 return OverlayPlane(nullptr, 0, gfx::OVERLAY_TRANSFORM_INVALID, gfx::Rect(), |
| 350 gfx::RectF()); | 352 gfx::RectF()); |
| 351 } | 353 } |
| 352 | 354 |
| 353 FillModesetBuffer(drm, controller, buffer.get()); | 355 FillModesetBuffer(drm, controller, buffer.get()); |
| 354 return OverlayPlane(buffer); | 356 return OverlayPlane(buffer); |
| 355 } | 357 } |
| 356 | 358 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 385 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { | 387 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { |
| 386 for (auto pair : window_map_) { | 388 for (auto pair : window_map_) { |
| 387 if (pair.second->bounds() == bounds) | 389 if (pair.second->bounds() == bounds) |
| 388 return pair.second; | 390 return pair.second; |
| 389 } | 391 } |
| 390 | 392 |
| 391 return nullptr; | 393 return nullptr; |
| 392 } | 394 } |
| 393 | 395 |
| 394 } // namespace ui | 396 } // namespace ui |
| OLD | NEW |