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

Side by Side Diff: ui/ozone/platform/drm/common/native_pixmap_manager_gbm.cc

Issue 1071273002: NotForReview: Implement zero/one-copy texture for ozone freon using Intel DRM Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: depends on https://codereview.chromium.org/1134993003/ Created 5 years, 5 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/common/native_pixmap_manager_gbm.h" 5 #include "ui/ozone/platform/drm/common/native_pixmap_manager_gbm.h"
6 6
7 #include "base/file_descriptor_posix.h" 7 #include "base/file_descriptor_posix.h"
8 #include "ui/ozone/platform/drm/gpu/vgem_pixmap.h" 8 #include "ui/ozone/platform/drm/gpu/vgem_pixmap.h"
9 9
10 #include "base/command_line.h"
11 #include "ui/ozone/platform/drm/gpu/intel_drm_pixmap.h"
12 #include "ui/ozone/public/ozone_switches.h"
13
10 namespace ui { 14 namespace ui {
11 15
12 namespace { 16 namespace {
13 17
14 NativePixmap::BufferUsage NativePixmapBufferUsageFromSurfaceFactoryOzone( 18 NativePixmap::BufferUsage NativePixmapBufferUsageFromSurfaceFactoryOzone(
15 SurfaceFactoryOzone::BufferUsage usage) { 19 SurfaceFactoryOzone::BufferUsage usage) {
16 switch (usage) { 20 switch (usage) {
17 case SurfaceFactoryOzone::MAP: 21 case SurfaceFactoryOzone::MAP:
18 return NativePixmap::MAP; 22 return NativePixmap::MAP;
19 case SurfaceFactoryOzone::PERSISTENT_MAP: 23 case SurfaceFactoryOzone::PERSISTENT_MAP:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 {SurfaceFactoryOzone::BGRA_8888, SurfaceFactoryOzone::MAP}); 57 {SurfaceFactoryOzone::BGRA_8888, SurfaceFactoryOzone::MAP});
54 } 58 }
55 return configurations; 59 return configurations;
56 } 60 }
57 61
58 scoped_refptr<NativePixmap> NativePixmapManagerGbm::CreateFromFileDescriptor( 62 scoped_refptr<NativePixmap> NativePixmapManagerGbm::CreateFromFileDescriptor(
59 base::FileDescriptor handle, 63 base::FileDescriptor handle,
60 gfx::Size size, 64 gfx::Size size,
61 SurfaceFactoryOzone::BufferFormat format, 65 SurfaceFactoryOzone::BufferFormat format,
62 SurfaceFactoryOzone::BufferUsage usage) { 66 SurfaceFactoryOzone::BufferUsage usage) {
67 bool enable_intel_drm = base::CommandLine::ForCurrentProcess()->HasSwitch(
68 switches::kOzoneUseIntelDrm);
69 if (enable_intel_drm && usage == SurfaceFactoryOzone::MAP) {
70 return IntelDrmPixmap::CreateFromHandle(
71 base::FileDescriptor(vgem_fd_.get(), false), handle, format, size);
72 }
73
63 scoped_refptr<VgemPixmap> pixmap(new VgemPixmap( 74 scoped_refptr<VgemPixmap> pixmap(new VgemPixmap(
64 handle, base::FileDescriptor(vgem_fd_.get(), false), size, format, 75 handle, base::FileDescriptor(vgem_fd_.get(), false), size, format,
65 NativePixmapBufferUsageFromSurfaceFactoryOzone(usage))); 76 NativePixmapBufferUsageFromSurfaceFactoryOzone(usage)));
66 if (!pixmap->Initialize()) 77 if (!pixmap->Initialize())
67 return nullptr; 78 return nullptr;
68 79
69 return pixmap; 80 return pixmap;
70 } 81 }
71 82
72 } // namespace ui 83 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698