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

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

Issue 2110213002: Revert of Add format modifier IDs for EGL_EXT_image_dma_buf_import extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (!buffer.get()) 107 if (!buffer.get())
108 return nullptr; 108 return nullptr;
109 109
110 return make_scoped_refptr(new GbmPixmap(this, buffer)); 110 return make_scoped_refptr(new GbmPixmap(this, buffer));
111 } 111 }
112 112
113 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( 113 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle(
114 gfx::Size size, 114 gfx::Size size,
115 gfx::BufferFormat format, 115 gfx::BufferFormat format,
116 const gfx::NativePixmapHandle& handle) { 116 const gfx::NativePixmapHandle& handle) {
117 size_t num_planes = gfx::NumberOfPlanesForBufferFormat(format); 117 size_t planes = gfx::NumberOfPlanesForBufferFormat(format);
118 if (handle.planes.size() != num_planes || 118 if (handle.strides_and_offsets.size() != planes ||
119 (handle.fds.size() != 1 && handle.fds.size() != num_planes)) { 119 (handle.fds.size() != 1 && handle.fds.size() != planes)) {
120 return nullptr; 120 return nullptr;
121 } 121 }
122 std::vector<base::ScopedFD> scoped_fds; 122 std::vector<base::ScopedFD> scoped_fds;
123 for (auto& fd : handle.fds) { 123 for (auto& fd : handle.fds) {
124 scoped_fds.emplace_back(fd.fd); 124 scoped_fds.emplace_back(fd.fd);
125 } 125 }
126 126
127 std::vector<gfx::NativePixmapPlane> planes; 127 std::vector<int> strides;
128 std::vector<int> offsets;
128 129
129 for (const auto& plane : handle.planes) { 130 for (const auto& stride_and_offset : handle.strides_and_offsets) {
130 planes.push_back(plane); 131 strides.push_back(stride_and_offset.first);
132 offsets.push_back(stride_and_offset.second);
131 } 133 }
132 134
133 scoped_refptr<GbmBuffer> buffer = drm_thread_->CreateBufferFromFds( 135 scoped_refptr<GbmBuffer> buffer = drm_thread_->CreateBufferFromFds(
134 size, format, std::move(scoped_fds), planes); 136 size, format, std::move(scoped_fds), strides, offsets);
135 if (!buffer) 137 if (!buffer)
136 return nullptr; 138 return nullptr;
137 return make_scoped_refptr(new GbmPixmap(this, buffer)); 139 return make_scoped_refptr(new GbmPixmap(this, buffer));
138 } 140 }
139 141
140 } // namespace ui 142 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer.cc ('k') | ui/ozone/platform/headless/headless_surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698