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

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

Issue 1262043002: Implement DRM Native Pixmap using prime buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-master
Patch Set: remove drm header Created 4 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
« no previous file with comments | « ui/ozone/platform/drm/gbm.gypi ('k') | ui/ozone/platform/drm/host/drm_display_host_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gbm_surface_factory.h" 5 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return scanout_formats; 89 return scanout_formats;
90 } 90 }
91 91
92 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( 92 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
93 gfx::AcceleratedWidget widget, 93 gfx::AcceleratedWidget widget,
94 gfx::Size size, 94 gfx::Size size,
95 gfx::BufferFormat format, 95 gfx::BufferFormat format,
96 gfx::BufferUsage usage) { 96 gfx::BufferUsage usage) {
97 #if !defined(OS_CHROMEOS) 97 #if !defined(OS_CHROMEOS)
98 // Support for memory mapping accelerated buffers requires some 98 // Support for memory mapping accelerated buffers requires some
99 // CrOS-specific patches (using vgem). 99 // CrOS-specific patches (using dma-buf mmap API).
100 DCHECK(gfx::BufferUsage::SCANOUT == usage); 100 DCHECK(gfx::BufferUsage::SCANOUT == usage);
101 #endif 101 #endif
102 102
103 scoped_refptr<GbmBuffer> buffer = 103 scoped_refptr<GbmBuffer> buffer =
104 drm_thread_->CreateBuffer(widget, size, format, usage); 104 drm_thread_->CreateBuffer(widget, size, format, usage);
105 if (!buffer.get()) 105 if (!buffer.get())
106 return nullptr; 106 return nullptr;
107 107
108 return make_scoped_refptr(new GbmPixmap(this, buffer)); 108 return make_scoped_refptr(new GbmPixmap(this, buffer));
109 } 109 }
110 110
111 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( 111 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle(
112 gfx::Size size, 112 gfx::Size size,
113 gfx::BufferFormat format, 113 gfx::BufferFormat format,
114 const gfx::NativePixmapHandle& handle) { 114 const gfx::NativePixmapHandle& handle) {
115 scoped_refptr<GbmBuffer> buffer = drm_thread_->CreateBufferFromFD( 115 scoped_refptr<GbmBuffer> buffer = drm_thread_->CreateBufferFromFD(
116 size, format, base::ScopedFD(handle.fd.fd), handle.stride); 116 size, format, base::ScopedFD(handle.fd.fd), handle.stride);
117 if (!buffer) 117 if (!buffer)
118 return nullptr; 118 return nullptr;
119 119
120 return make_scoped_refptr(new GbmPixmap(this, buffer)); 120 return make_scoped_refptr(new GbmPixmap(this, buffer));
121 } 121 }
122 122
123 } // namespace ui 123 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gbm.gypi ('k') | ui/ozone/platform/drm/host/drm_display_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698