Commit 2d01bfe4 authored by Ricardo Quesada's avatar Ricardo Quesada Committed by Commit Bot

Revert "exo: Set the gfx::NativePixmapHandle modifier"

This reverts commit 55c54eed.

Reason for revert: Introduced flickering and weird artifacts in ARC P and ARCVM.

http://b/162704898
https://crbug.com/1112017


Original change's description:
> exo: Set the gfx::NativePixmapHandle modifier
> 
> This will forward the modifier all the way to the eventual EGLImage or
> gbm bo import such that GLES or KMS will properly understand the
> buffer layout.
> 
> BUG=b:145579089, b:79682290
> TEST=wayland_rects_client --use-drm=msm and verify modifiers get passed
> 
> Change-Id: Ia422c3713f1a9384aa737c3d1cccb1dd76709e18
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314984
> Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
> Reviewed-by: Fritz Koenig <frkoenig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#793405}

TBR=frkoenig@chromium.org,lpique@chromium.org,dcastagna@chromium.org,hoegsberg@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: b:145579089
Bug: b:79682290
Change-Id: I15f20a639d9fe532cf03022f566dfa539100eeb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2335817Reviewed-by: default avatarRicardo Quesada <ricardoq@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794540}
parent 52defab7
...@@ -51,7 +51,6 @@ struct LinuxBufferParams { ...@@ -51,7 +51,6 @@ struct LinuxBufferParams {
base::ScopedFD fd; base::ScopedFD fd;
uint32_t stride; uint32_t stride;
uint32_t offset; uint32_t offset;
uint64_t modifier;
}; };
explicit LinuxBufferParams(Display* display) : display(display) {} explicit LinuxBufferParams(Display* display) : display(display) {}
...@@ -75,8 +74,7 @@ void linux_buffer_params_add(wl_client* client, ...@@ -75,8 +74,7 @@ void linux_buffer_params_add(wl_client* client,
LinuxBufferParams* linux_buffer_params = LinuxBufferParams* linux_buffer_params =
GetUserDataAs<LinuxBufferParams>(resource); GetUserDataAs<LinuxBufferParams>(resource);
const uint64_t modifier = (static_cast<uint64_t>(modifier_hi) << 32) | modifier_lo; LinuxBufferParams::Plane plane{base::ScopedFD(fd), stride, offset};
LinuxBufferParams::Plane plane{base::ScopedFD(fd), stride, offset, modifier};
const auto& inserted = linux_buffer_params->planes.insert( const auto& inserted = linux_buffer_params->planes.insert(
std::pair<uint32_t, LinuxBufferParams::Plane>(plane_idx, std::pair<uint32_t, LinuxBufferParams::Plane>(plane_idx,
...@@ -108,16 +106,8 @@ bool ValidateLinuxBufferParams(wl_resource* resource, ...@@ -108,16 +106,8 @@ bool ValidateLinuxBufferParams(wl_resource* resource,
LinuxBufferParams* linux_buffer_params = LinuxBufferParams* linux_buffer_params =
GetUserDataAs<LinuxBufferParams>(resource); GetUserDataAs<LinuxBufferParams>(resource);
size_t num_planes = gfx::NumberOfPlanesForLinearBufferFormat(format);
size_t num_planes = linux_buffer_params->planes.size();
if (num_planes == 0) {
wl_resource_post_error(resource,
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE,
"no planes given");
return false;
}
// Validate that we have planes 0..num_planes-1
for (uint32_t i = 0; i < num_planes; ++i) { for (uint32_t i = 0; i < num_planes; ++i) {
auto plane_it = linux_buffer_params->planes.find(i); auto plane_it = linux_buffer_params->planes.find(i);
if (plane_it == linux_buffer_params->planes.end()) { if (plane_it == linux_buffer_params->planes.end()) {
...@@ -128,24 +118,7 @@ bool ValidateLinuxBufferParams(wl_resource* resource, ...@@ -128,24 +118,7 @@ bool ValidateLinuxBufferParams(wl_resource* resource,
} }
} }
// All planes must have the same modifier. if (linux_buffer_params->planes.size() != num_planes) {
uint64_t modifier = linux_buffer_params->planes[0].modifier;
for (uint32_t i = 0; i < num_planes; ++i) {
if (linux_buffer_params->planes[i].modifier != modifier) {
wl_resource_post_error(resource,
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT,
"all planes must have same modifier");
return false;
}
}
// For linear layouts we know how many planes to expect, so check
// that. Otherwise, we have to trust that the client gave us the
// right number and fail later when importing the EGLImage if that's
// wrong.
if (modifier == DRM_FORMAT_MOD_LINEAR &&
linux_buffer_params->planes.size() !=
gfx::NumberOfPlanesForLinearBufferFormat(format)) {
wl_resource_post_error(resource, ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_IDX, wl_resource_post_error(resource, ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_IDX,
"plane idx out of bounds"); "plane idx out of bounds");
return false; return false;
...@@ -180,12 +153,14 @@ wl_resource* create_buffer(wl_client* client, ...@@ -180,12 +153,14 @@ wl_resource* create_buffer(wl_client* client,
LinuxBufferParams* linux_buffer_params = LinuxBufferParams* linux_buffer_params =
GetUserDataAs<LinuxBufferParams>(resource); GetUserDataAs<LinuxBufferParams>(resource);
gfx::NativePixmapHandle handle; size_t num_planes =
gfx::NumberOfPlanesForLinearBufferFormat(supported_format->buffer_format);
handle.modifier = linux_buffer_params->planes[0].modifier; gfx::NativePixmapHandle handle;
for (uint32_t i = 0; i < linux_buffer_params->planes.size(); ++i) { for (uint32_t i = 0; i < num_planes; ++i) {
auto& plane = linux_buffer_params->planes[i]; auto plane_it = linux_buffer_params->planes.find(i);
LinuxBufferParams::Plane& plane = plane_it->second;
handle.planes.emplace_back(plane.stride, plane.offset, 0, handle.planes.emplace_back(plane.stride, plane.offset, 0,
std::move(plane.fd)); std::move(plane.fd));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment