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

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

Issue 1381133002: ozone: Implement support for CreateGpuMemoryBufferFromHandle for OzoneNativePixmap backed GMBs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmb-factory-create-from-handle
Patch Set: rebase Created 5 years, 2 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 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 "third_party/khronos/EGL/egl.h" 10 #include "third_party/khronos/EGL/egl.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #endif 121 #endif
122 122
123 scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget); 123 scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget);
124 DCHECK(gbm); 124 DCHECK(gbm);
125 125
126 scoped_refptr<GbmBuffer> buffer = 126 scoped_refptr<GbmBuffer> buffer =
127 GbmBuffer::CreateBuffer(gbm, format, size, usage); 127 GbmBuffer::CreateBuffer(gbm, format, size, usage);
128 if (!buffer.get()) 128 if (!buffer.get())
129 return nullptr; 129 return nullptr;
130 130
131 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(buffer, this)); 131 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this));
132 if (!pixmap->Initialize()) 132 if (!pixmap->InitializeFromBuffer(buffer))
133 return nullptr; 133 return nullptr;
134 134
135 return pixmap; 135 return pixmap;
136 } 136 }
137 137
138 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle(
139 const gfx::NativePixmapHandle& handle) {
140 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this));
141 pixmap->Initialize(base::ScopedFD(handle.fd.fd), handle.stride);
142 return pixmap;
143 }
144
138 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( 145 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice(
139 gfx::AcceleratedWidget widget) { 146 gfx::AcceleratedWidget widget) {
140 return static_cast<GbmDevice*>( 147 return static_cast<GbmDevice*>(
141 drm_device_manager_->GetDrmDevice(widget).get()); 148 drm_device_manager_->GetDrmDevice(widget).get());
142 } 149 }
143 150
144 } // namespace ui 151 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_surface_factory.h ('k') | ui/ozone/public/surface_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698