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

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

Issue 1841683003: ui/ozone: Flush CPU caches when mapping/unmapping prime pixmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ran git cl format Created 4 years, 8 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 "ui/gfx/native_pixmap_handle_ozone.h" 10 #include "ui/gfx/native_pixmap_handle_ozone.h"
(...skipping 29 matching lines...) Expand all
40 gfx::BufferUsage usage) const override { 40 gfx::BufferUsage usage) const override {
41 switch (usage) { 41 switch (usage) {
42 case gfx::BufferUsage::GPU_READ: 42 case gfx::BufferUsage::GPU_READ:
43 case gfx::BufferUsage::SCANOUT: 43 case gfx::BufferUsage::SCANOUT:
44 return format == gfx::BufferFormat::RGBA_8888 || 44 return format == gfx::BufferFormat::RGBA_8888 ||
45 format == gfx::BufferFormat::RGBX_8888 || 45 format == gfx::BufferFormat::RGBX_8888 ||
46 format == gfx::BufferFormat::BGRA_8888 || 46 format == gfx::BufferFormat::BGRA_8888 ||
47 format == gfx::BufferFormat::BGRX_8888; 47 format == gfx::BufferFormat::BGRX_8888;
48 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 48 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
49 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: { 49 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: {
50 #if defined(OS_CHROMEOS)
50 return format == gfx::BufferFormat::BGRA_8888; 51 return format == gfx::BufferFormat::BGRA_8888;
52 #else
53 return false;
54 #endif
51 } 55 }
52 } 56 }
53 NOTREACHED(); 57 NOTREACHED();
54 return false; 58 return false;
55 } 59 }
56 scoped_ptr<ClientNativePixmap> ImportFromHandle( 60 scoped_ptr<ClientNativePixmap> ImportFromHandle(
57 const gfx::NativePixmapHandle& handle, 61 const gfx::NativePixmapHandle& handle,
58 const gfx::Size& size, 62 const gfx::Size& size,
59 gfx::BufferUsage usage) override { 63 gfx::BufferUsage usage) override {
60 base::ScopedFD scoped_fd(handle.fd.fd); 64 base::ScopedFD scoped_fd(handle.fd.fd);
61 65
62 switch (usage) { 66 switch (usage) {
63 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: 67 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
64 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: 68 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
65 return ClientNativePixmapDmaBuf::ImportFromDmabuf( 69 #if defined(OS_CHROMEOS)
66 scoped_fd.get(), size, handle.stride); 70 return ClientNativePixmapDmaBuf::ImportFromDmabuf(scoped_fd.release(),
71 size, handle.stride);
72 #else
73 NOTREACHED();
74 return nullptr;
75 #endif
67 case gfx::BufferUsage::GPU_READ: 76 case gfx::BufferUsage::GPU_READ:
68 case gfx::BufferUsage::SCANOUT: 77 case gfx::BufferUsage::SCANOUT:
69 return make_scoped_ptr<ClientNativePixmapGbm>( 78 return make_scoped_ptr<ClientNativePixmapGbm>(
70 new ClientNativePixmapGbm); 79 new ClientNativePixmapGbm);
71 } 80 }
72 NOTREACHED(); 81 NOTREACHED();
73 return nullptr; 82 return nullptr;
74 } 83 }
75 84
76 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm); 85 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactoryGbm);
77 }; 86 };
78 87
79 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() { 88 ClientNativePixmapFactory* CreateClientNativePixmapFactoryGbm() {
80 return new ClientNativePixmapFactoryGbm(); 89 return new ClientNativePixmapFactoryGbm();
81 } 90 }
82 91
83 } // namespace ui 92 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698