Commit 40db5521 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

ui: s/XB30/AB30/ and support it for SCANOUT

This CL replaces the DRM specific XB30 with AB30 where
appropriate, and adds the necessary entries to support
AB30 with SCANOUT usage.

Test: forcing RGBA_1010102 as DisplaySnapshot::PrimaryFormat,
and allowing for only an opaque FB (ToT wants both opaque and
normal) the primary plane of the device is indeed XB30 as per
/sys/kernel/debug/dri/0/state).
and
 gl_unittests  --gtest_also_run_disabled_tests
and
 ozone_gl_unittests  --gtest_also_run_disabled_tests
AB30 test cases passing.

Bug: 949260
Change-Id: Ie1841763b059971460597eded768a9a9827914b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1960073Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732211}
parent acb04ed4
......@@ -79,7 +79,8 @@ GPU_EXPORT bool NativeBufferNeedsPlatformSpecificTextureTarget(
format == gfx::BufferFormat::RGBA_8888 ||
format == gfx::BufferFormat::BGRA_8888 ||
format == gfx::BufferFormat::RGBX_8888 ||
format == gfx::BufferFormat::BGRX_8888) {
format == gfx::BufferFormat::BGRX_8888 ||
format == gfx::BufferFormat::RGBA_1010102) {
return false;
}
#elif defined(OS_ANDROID)
......
......@@ -39,7 +39,7 @@ class GPU_GLES2_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> {
GpuMemoryBufferFormatSet gpu_memory_buffer_formats = {
gfx::BufferFormat::BGR_565, gfx::BufferFormat::RGBA_4444,
gfx::BufferFormat::RGBA_8888, gfx::BufferFormat::RGBX_8888,
gfx::BufferFormat::YVU_420,
gfx::BufferFormat::YVU_420, gfx::BufferFormat::RGBA_1010102,
};
// Use glBlitFramebuffer() and glRenderbufferStorageMultisample() with
// GL_EXT_framebuffer_multisample-style semantics (as opposed to
......
......@@ -7,6 +7,8 @@
#include "base/logging.h"
#include "build/build_config.h"
#include "gpu/ipc/common/gpu_memory_buffer_impl_shared_memory.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/buffer_usage_util.h"
#if defined(OS_MACOSX)
#include "gpu/ipc/common/gpu_memory_buffer_impl_io_surface.h"
......@@ -186,7 +188,8 @@ GpuMemoryBufferSupport::CreateGpuMemoryBufferImplFromHandle(
#endif
default:
// TODO(dcheng): Remove default case (https://crbug.com/676224).
NOTREACHED();
NOTREACHED() << gfx::BufferFormatToString(format) << ", "
<< gfx::BufferUsageToString(usage);
return nullptr;
}
}
......
......@@ -114,7 +114,9 @@ bool ClientNativePixmapDmaBuf::IsConfigurationSupported(
return format == gfx::BufferFormat::BGRX_8888 ||
format == gfx::BufferFormat::RGBX_8888 ||
format == gfx::BufferFormat::RGBA_8888 ||
format == gfx::BufferFormat::BGRA_8888;
format == gfx::BufferFormat::BGRA_8888 ||
format == gfx::BufferFormat::RGBA_1010102 ||
format == gfx::BufferFormat::BGRX_1010102;
case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
// TODO(crbug.com/954233): RG_88 is enabled only with
// --enable-native-gpu-memory-buffers . Otherwise it breaks some telemetry
......
......@@ -42,7 +42,7 @@ int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::BGRX_1010102:
return DRM_FORMAT_XRGB2101010;
case gfx::BufferFormat::RGBA_1010102:
return DRM_FORMAT_XBGR2101010;
return DRM_FORMAT_ABGR2101010;
case gfx::BufferFormat::RGBA_F16:
return DRM_FORMAT_INVALID;
case gfx::BufferFormat::YVU_420:
......@@ -71,7 +71,7 @@ gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) {
return gfx::BufferFormat::BGRX_8888;
case DRM_FORMAT_XRGB2101010:
return gfx::BufferFormat::BGRX_1010102;
case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_ABGR2101010:
return gfx::BufferFormat::RGBA_1010102;
case DRM_FORMAT_RGB565:
return gfx::BufferFormat::BGR_565;
......@@ -96,7 +96,7 @@ bool IsValidBufferFormat(uint32_t current_format) {
case DRM_FORMAT_ARGB8888:
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_ABGR2101010:
case DRM_FORMAT_RGB565:
case DRM_FORMAT_NV12:
case DRM_FORMAT_YVU420:
......
......@@ -29,7 +29,7 @@
#define DRM_FORMAT_ABGR8888 FOURCC('A', 'B', '2', '4')
#define DRM_FORMAT_XRGB8888 FOURCC('X', 'R', '2', '4')
#define DRM_FORMAT_XBGR8888 FOURCC('X', 'B', '2', '4')
#define DRM_FORMAT_XBGR2101010 FOURCC('X', 'B', '3', '0')
#define DRM_FORMAT_ABGR2101010 FOURCC('A', 'B', '3', '0')
#define DRM_FORMAT_XRGB2101010 FOURCC('X', 'R', '3', '0')
#define DRM_FORMAT_YVU420 FOURCC('Y', 'V', '1', '2')
#define DRM_FORMAT_NV12 FOURCC('N', 'V', '1', '2')
......@@ -70,7 +70,7 @@ EGLint FourCC(gfx::BufferFormat format) {
case gfx::BufferFormat::BGRX_8888:
return DRM_FORMAT_XRGB8888;
case gfx::BufferFormat::RGBA_1010102:
return DRM_FORMAT_XBGR2101010;
return DRM_FORMAT_ABGR2101010;
case gfx::BufferFormat::BGRX_1010102:
return DRM_FORMAT_XRGB2101010;
case gfx::BufferFormat::YVU_420:
......@@ -102,7 +102,7 @@ gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) {
return gfx::BufferFormat::BGRA_8888;
case DRM_FORMAT_XRGB8888:
return gfx::BufferFormat::BGRX_8888;
case DRM_FORMAT_XBGR2101010:
case DRM_FORMAT_ABGR2101010:
return gfx::BufferFormat::RGBA_1010102;
case DRM_FORMAT_RGB565:
return gfx::BufferFormat::BGR_565;
......
......@@ -151,18 +151,22 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
return;
case gfx::BufferFormat::RGBA_1010102:
case gfx::BufferFormat::RGBA_1010102: {
DCHECK_EQ(0, plane);
DCHECK_EQ(63, color[3] % 64) << "Alpha channel doesn't have enough "
"precision for the supplied value";
const uint8_t scaled_alpha = color[3] >> 6;
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
*reinterpret_cast<uint32_t*>(&data[y * stride + x * 4]) =
0x3 << 30 | // Alpha channel is unused
(scaled_alpha << 30) | // A
((color[2] << 2) | (color[2] >> 6)) << 20 | // B
((color[1] << 2) | (color[1] >> 6)) << 10 | // G
((color[0] << 2) | (color[0] >> 6)); // R
}
}
return;
}
case gfx::BufferFormat::BGRA_8888:
DCHECK_EQ(0, plane);
......
......@@ -93,9 +93,9 @@ using GLImageScanoutTypeDisabled = testing::Types<
GLImageNativePixmapTestDelegate<gfx::BufferUsage::SCANOUT,
gfx::BufferFormat::RGBA_1010102>>;
// This test is disabled since we need mesa support for XR30/XB30 that is not
// This test is disabled since we need mesa support for AB30 that is not
// available on many boards yet.
INSTANTIATE_TYPED_TEST_SUITE_P(DISABLED_GLImageNativePixmapScanoutRGBX,
INSTANTIATE_TYPED_TEST_SUITE_P(DISABLED_GLImageNativePixmapScanoutRGBA,
GLImageTest,
GLImageScanoutTypeDisabled);
......
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