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

Unified Diff: components/exo/wayland/server.cc

Issue 2039813002: 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: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/exo/wayland/server.cc
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc
index 55e347a39b440639c4d2b78aa6cd1d2337b8f8e0..dda2db98877944489265c207f08756a3f8fc397a 100644
--- a/components/exo/wayland/server.cc
+++ b/components/exo/wayland/server.cc
@@ -514,20 +514,21 @@ void drm_create_prime_buffer(wl_client* client,
return;
}
- std::vector<int> strides{stride0, stride1, stride2};
- std::vector<int> offsets{offset0, offset1, offset2};
+ std::vector<gfx::GbmBufferPlane> planes;
+ planes.emplace_back(stride0, offset0, 0);
+ planes.emplace_back(stride1, offset1, 0);
+ planes.emplace_back(stride2, offset2, 0);
std::vector<base::ScopedFD> fds;
- int planes =
+ int num_planes =
gfx::NumberOfPlanesForBufferFormat(supported_format->buffer_format);
- strides.resize(planes);
- offsets.resize(planes);
+ planes.resize(num_planes);
fds.push_back(base::ScopedFD(name));
std::unique_ptr<Buffer> buffer =
GetUserDataAs<Display>(resource)->CreateLinuxDMABufBuffer(
- gfx::Size(width, height), supported_format->buffer_format, strides,
- offsets, std::move(fds));
+ gfx::Size(width, height), supported_format->buffer_format, planes,
+ std::move(fds));
if (!buffer) {
wl_resource_post_no_memory(resource);
return;
@@ -660,8 +661,7 @@ void linux_buffer_params_create(wl_client* client,
return;
}
- std::vector<int> strides;
- std::vector<int> offsets;
+ std::vector<gfx::GbmBufferPlane> planes;
std::vector<base::ScopedFD> fds;
for (uint32_t i = 0; i < num_planes; ++i) {
@@ -673,16 +673,15 @@ void linux_buffer_params_create(wl_client* client,
return;
}
LinuxBufferParams::Plane& plane = plane_it->second;
- strides.push_back(plane.stride);
- offsets.push_back(plane.offset);
+ planes.emplace_back(plane.stride, plane.offset, 0);
if (plane.fd.is_valid())
fds.push_back(std::move(plane.fd));
}
std::unique_ptr<Buffer> buffer =
linux_buffer_params->display->CreateLinuxDMABufBuffer(
- gfx::Size(width, height), supported_format->buffer_format, strides,
- offsets, std::move(fds));
+ gfx::Size(width, height), supported_format->buffer_format, planes,
+ std::move(fds));
if (!buffer) {
zwp_linux_buffer_params_v1_send_failed(resource);
return;

Powered by Google App Engine
This is Rietveld 408576698