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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 if (window) { | 337 if (window) { |
338 const OverlayPlane* primary = window->GetLastModesetBuffer(); | 338 const OverlayPlane* primary = window->GetLastModesetBuffer(); |
339 const DrmDevice* drm = controller->GetAllocationDrmDevice().get(); | 339 const DrmDevice* drm = controller->GetAllocationDrmDevice().get(); |
340 if (primary && primary->buffer->GetSize() == bounds.size() && | 340 if (primary && primary->buffer->GetSize() == bounds.size() && |
341 primary->buffer->GetDrmDevice() == drm) | 341 primary->buffer->GetDrmDevice() == drm) |
342 return *primary; | 342 return *primary; |
343 } | 343 } |
344 | 344 |
345 gfx::BufferFormat format = ui::DisplaySnapshot::PrimaryFormat(); | 345 gfx::BufferFormat format = ui::DisplaySnapshot::PrimaryFormat(); |
346 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); | 346 scoped_refptr<DrmDevice> drm = controller->GetAllocationDrmDevice(); |
| 347 uint32_t fourcc_format = ui::GetFourCCFormatForFramebuffer(format); |
347 scoped_refptr<ScanoutBuffer> buffer = | 348 scoped_refptr<ScanoutBuffer> buffer = |
348 buffer_generator_->Create(drm, format, bounds.size()); | 349 buffer_generator_->Create(drm, fourcc_format, bounds.size()); |
349 if (!buffer) { | 350 if (!buffer) { |
350 LOG(ERROR) << "Failed to create scanout buffer"; | 351 LOG(ERROR) << "Failed to create scanout buffer"; |
351 return OverlayPlane(nullptr, 0, gfx::OVERLAY_TRANSFORM_INVALID, gfx::Rect(), | 352 return OverlayPlane(nullptr, 0, gfx::OVERLAY_TRANSFORM_INVALID, gfx::Rect(), |
352 gfx::RectF()); | 353 gfx::RectF()); |
353 } | 354 } |
354 | 355 |
355 FillModesetBuffer(drm, controller, buffer.get()); | 356 FillModesetBuffer(drm, controller, buffer.get()); |
356 return OverlayPlane(buffer); | 357 return OverlayPlane(buffer); |
357 } | 358 } |
358 | 359 |
(...skipping 28 matching lines...) Expand all Loading... |
387 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { | 388 DrmWindow* ScreenManager::FindWindowAt(const gfx::Rect& bounds) const { |
388 for (auto pair : window_map_) { | 389 for (auto pair : window_map_) { |
389 if (pair.second->bounds() == bounds) | 390 if (pair.second->bounds() == bounds) |
390 return pair.second; | 391 return pair.second; |
391 } | 392 } |
392 | 393 |
393 return nullptr; | 394 return nullptr; |
394 } | 395 } |
395 | 396 |
396 } // namespace ui | 397 } // namespace ui |
OLD | NEW |