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

Side by Side Diff: ui/ozone/platform/drm/client_native_pixmap_factory_gbm.cc

Issue 2768343002: Change namespace from ui to gfx for NativePixmap related code (Closed)
Patch Set: Addressed sadrul's remark Created 3 years, 9 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/client_native_pixmap_factory_gbm.h" 5 #include "ui/ozone/platform/drm/client_native_pixmap_factory_gbm.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "ui/gfx/client_native_pixmap_factory.h" 11 #include "ui/gfx/client_native_pixmap_factory.h"
12 #include "ui/gfx/native_pixmap_handle.h" 12 #include "ui/gfx/native_pixmap_handle.h"
13 #include "ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h" 13 #include "ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h"
14 14
15 namespace ui { 15 namespace ui {
16 16
17 namespace { 17 namespace {
18 18
19 class ClientNativePixmapGbm : public ClientNativePixmap { 19 class ClientNativePixmapGbm : public gfx::ClientNativePixmap {
20 public: 20 public:
21 ClientNativePixmapGbm() {} 21 ClientNativePixmapGbm() {}
22 ~ClientNativePixmapGbm() override {} 22 ~ClientNativePixmapGbm() override {}
23 23
24 bool Map() override { 24 bool Map() override {
25 NOTREACHED(); 25 NOTREACHED();
26 return false; 26 return false;
27 } 27 }
28 void Unmap() override { NOTREACHED(); } 28 void Unmap() override { NOTREACHED(); }
29 void* GetMemoryAddress(size_t plane) const override { 29 void* GetMemoryAddress(size_t plane) const override {
30 NOTREACHED(); 30 NOTREACHED();
31 return nullptr; 31 return nullptr;
32 } 32 }
33 int GetStride(size_t plane) const override { 33 int GetStride(size_t plane) const override {
34 NOTREACHED(); 34 NOTREACHED();
35 return 0; 35 return 0;
36 } 36 }
37 }; 37 };
38 38
39 } // namespace 39 } // namespace
40 40
41 class ClientNativePixmapFactoryGbm : public ClientNativePixmapFactory { 41 class ClientNativePixmapFactoryGbm : public gfx::ClientNativePixmapFactory {
42 public: 42 public:
43 ClientNativePixmapFactoryGbm() {} 43 ClientNativePixmapFactoryGbm() {}
44 ~ClientNativePixmapFactoryGbm() override {} 44 ~ClientNativePixmapFactoryGbm() override {}
45 45
46 // ClientNativePixmapFactory: 46 // ClientNativePixmapFactory:
47 bool IsConfigurationSupported(gfx::BufferFormat format, 47 bool IsConfigurationSupported(gfx::BufferFormat format,
48 gfx::BufferUsage usage) const override { 48 gfx::BufferUsage usage) const override {
49 switch (usage) { 49 switch (usage) {
50 case gfx::BufferUsage::GPU_READ: 50 case gfx::BufferUsage::GPU_READ:
51 return format == gfx::BufferFormat::BGR_565 || 51 return format == gfx::BufferFormat::BGR_565 ||
(...skipping 22 matching lines...) Expand all
74 #endif 74 #endif
75 format == gfx::BufferFormat::BGRA_8888; 75 format == gfx::BufferFormat::BGRA_8888;
76 #else 76 #else
77 return false; 77 return false;
78 #endif 78 #endif
79 } 79 }
80 } 80 }
81 NOTREACHED(); 81 NOTREACHED();
82 return false; 82 return false;
83 } 83 }
84 std::unique_ptr<ClientNativePixmap> ImportFromHandle( 84 std::unique_ptr<gfx::ClientNativePixmap> ImportFromHandle(
85 const gfx::NativePixmapHandle& handle, 85 const gfx::NativePixmapHandle& handle,
86 const gfx::Size& size, 86 const gfx::Size& size,
87 gfx::BufferUsage usage) override { 87 gfx::BufferUsage usage) override {
88 DCHECK(!handle.fds.empty()); 88 DCHECK(!handle.fds.empty());
89 switch (usage) { 89 switch (usage) {
90 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE: 90 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
91 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 91 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
92 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 92 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
93 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
94 return ClientNativePixmapDmaBuf::ImportFromDmabuf(handle, size); 94 return ClientNativePixmapDmaBuf::ImportFromDmabuf(handle, size);
95 #else 95 #else
96 NOTREACHED(); 96 NOTREACHED();
97 return nullptr; 97 return nullptr;
98 #endif 98 #endif
99 case gfx::BufferUsage::GPU_READ: 99 case gfx::BufferUsage::GPU_READ:
100 case gfx::BufferUsage::SCANOUT: 100 case gfx::BufferUsage::SCANOUT:
101 // Close all the fds. 101 // Close all the fds.
102 for (const auto& fd : handle.fds) 102 for (const auto& fd : handle.fds)
103 base::ScopedFD scoped_fd(fd.fd); 103 base::ScopedFD scoped_fd(fd.fd);
104 return base::WrapUnique(new ClientNativePixmapGbm); 104 return base::WrapUnique(new ClientNativePixmapGbm);
105 } 105 }
106 NOTREACHED(); 106 NOTREACHED();
107 return nullptr; 107 return nullptr;
108 } 108 }
109 109
110 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); 110 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm);
111 }; 111 };
112 112
113 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { 113 gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() {
114 return new ClientNativePixmapFactoryGbm(); 114 return new ClientNativePixmapFactoryGbm();
115 } 115 }
116 116
117 } // namespace ui 117 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/client_native_pixmap_factory_gbm.h ('k') | ui/ozone/platform/drm/common/client_native_pixmap_dmabuf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698