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

Side by Side Diff: ui/ozone/platform/drm/gpu/mock_scanout_buffer.cc

Issue 2919533003: ozone/drm: Only reuse ScanoutBuffers with compatible modifiers (Closed)
Patch Set: ozone/drm: Only reuse ScanoutBuffers with compatible modifiers Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mock_scanout_buffer.h" 5 #include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h"
6 #include "ui/ozone/platform/drm/gpu/mock_drm_device.h"
7
8 namespace {
dnicoara 2017/06/15 14:24:43 nit: Nest anonymous namespace in the ui namespace.
9
10 uint32_t currentFramebufferId;
dnicoara 2017/06/15 14:24:43 Global declarations follow the "g_current_framebuf
11 }
6 12
7 namespace ui { 13 namespace ui {
8 14
9 MockScanoutBuffer::MockScanoutBuffer(const gfx::Size& size, uint32_t format) 15 MockScanoutBuffer::MockScanoutBuffer(const gfx::Size& size,
10 : size_(size), format_(format) {} 16 uint32_t format,
17 uint64_t modifier,
18 const scoped_refptr<DrmDevice>& drm)
19 : size_(size),
20 format_(format),
21 modifier_(modifier),
22 id(currentFramebufferId++),
23 drm_(drm) {}
11 24
12 MockScanoutBuffer::~MockScanoutBuffer() {} 25 MockScanoutBuffer::~MockScanoutBuffer() {}
13 26
14 uint32_t MockScanoutBuffer::GetFramebufferId() const { 27 uint32_t MockScanoutBuffer::GetFramebufferId() const {
15 return 1; 28 return id;
16 } 29 }
17 30
18 uint32_t MockScanoutBuffer::GetOpaqueFramebufferId() const { 31 uint32_t MockScanoutBuffer::GetOpaqueFramebufferId() const {
19 return 2; 32 return 2;
20 } 33 }
21 34
22 uint32_t MockScanoutBuffer::GetHandle() const { 35 uint32_t MockScanoutBuffer::GetHandle() const {
23 return 0; 36 return 0;
24 } 37 }
25 38
26 gfx::Size MockScanoutBuffer::GetSize() const { 39 gfx::Size MockScanoutBuffer::GetSize() const {
27 return size_; 40 return size_;
28 } 41 }
29 42
30 uint32_t MockScanoutBuffer::GetFramebufferPixelFormat() const { 43 uint32_t MockScanoutBuffer::GetFramebufferPixelFormat() const {
31 return format_; 44 return format_;
32 } 45 }
33 46
34 uint32_t MockScanoutBuffer::GetOpaqueFramebufferPixelFormat() const { 47 uint32_t MockScanoutBuffer::GetOpaqueFramebufferPixelFormat() const {
35 return format_; 48 return format_;
36 } 49 }
37 50
51 uint64_t MockScanoutBuffer::GetFormatModifier() const {
52 return modifier_;
53 }
54
38 const DrmDevice* MockScanoutBuffer::GetDrmDevice() const { 55 const DrmDevice* MockScanoutBuffer::GetDrmDevice() const {
39 return nullptr; 56 return drm_.get();
40 } 57 }
41 58
42 bool MockScanoutBuffer::RequiresGlFinish() const { 59 bool MockScanoutBuffer::RequiresGlFinish() const {
43 return false; 60 return false;
44 } 61 }
45 62
46 } // namespace ui 63 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698