Commit b6f30c85 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Commit Bot

Relax NV12 format rejection for exo

# This is reland of crrev.com/c/1775190.
# It has to use floored value instead of rounding to match what kernel expects.

Applies the same restriction in other scenarios (web page/apps).

* Reject iff
 - the buffer is cropped hirozontally, and
 - the cropped bounds' horizontal coordinates (x and width) doesn't
   fall into even pixel boundary

Bug: 997821, b/141202973
Test: manually tested with netflix web/arc apps on eve. GtsYouTubeTestCases:com.google.android.youtube.gts.DecodePerformanceTest passed on octopus
Change-Id: I7ce9e41b55a1f3c87e55ed680e17f9842388db51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847676Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704153}
parent 89c981ea
...@@ -111,22 +111,14 @@ std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer( ...@@ -111,22 +111,14 @@ std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer(
// Using zero-copy for optimal performance. // Using zero-copy for optimal performance.
bool use_zero_copy = true; bool use_zero_copy = true;
#if defined(ARCH_CPU_X86_FAMILY)
// TODO(dcastagna): Re-enable NV12 format as HW overlay once b/113362843
// is addressed.
bool is_overlay_candidate = format != gfx::BufferFormat::YUV_420_BIPLANAR;
#else
bool is_overlay_candidate = true;
#endif
return std::make_unique<Buffer>( return std::make_unique<Buffer>(
std::move(gpu_memory_buffer), std::move(gpu_memory_buffer),
gpu::NativeBufferNeedsPlatformSpecificTextureTarget(format) gpu::NativeBufferNeedsPlatformSpecificTextureTarget(format)
? gpu::GetPlatformSpecificTextureTarget() ? gpu::GetPlatformSpecificTextureTarget()
: GL_TEXTURE_2D, : GL_TEXTURE_2D,
// COMMANDS_COMPLETED queries are required by native pixmaps. // COMMANDS_COMPLETED queries are required by native pixmaps.
GL_COMMANDS_COMPLETED_CHROMIUM, use_zero_copy, is_overlay_candidate, GL_COMMANDS_COMPLETED_CHROMIUM, use_zero_copy,
y_invert); /*is_overlay_candidate=*/true, y_invert);
} }
#endif // defined(USE_OZONE) #endif // defined(USE_OZONE)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/rect_conversions.h"
#include "ui/ozone/platform/drm/common/drm_overlay_candidates.h" #include "ui/ozone/platform/drm/common/drm_overlay_candidates.h"
#include "ui/ozone/public/overlay_surface_candidate.h" #include "ui/ozone/public/overlay_surface_candidate.h"
...@@ -125,6 +126,21 @@ bool DrmOverlayManager::CanHandleCandidate( ...@@ -125,6 +126,21 @@ bool DrmOverlayManager::CanHandleCandidate(
return false; return false;
} }
#if defined(ARCH_CPU_X86_FAMILY)
// TODO(dcastagna|oshima): Re-enable NV12 format as HW overlay once
// b/113362843 is addressed.
if (candidate.format == gfx::BufferFormat::YUV_420_BIPLANAR) {
// Reject buffer whose cropped horizontal coordinates doesn't fall on
// even pixel boundary.
int nearest_x = gfx::ToFlooredInt(candidate.buffer_size.width() *
candidate.crop_rect.x());
int nearest_width = gfx::ToFlooredInt(candidate.buffer_size.width() *
candidate.crop_rect.width());
if (nearest_x % 2 != 0 || nearest_width % 2 != 0)
return false;
}
#endif
return true; return true;
} }
......
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