Commit 63642262 authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

Revert "ozone/drm: Render primary framebuffers as RGBA"

This reverts commit 48d1ecaf.

Reason for revert: This CL causes several problems documented at crbug.com/821944

Original change's description:
> ozone/drm: Render primary framebuffers as RGBA
> 
> In preparation for hardware plane underlay support in ChromeOS, we
> need to allow for RGBA primary framebuffers. When using an underlay,
> we cut out a transparent rectangle in the primary framebuffer to allow
> the underlay to show through, while still allowing for RGBA content on
> top of the underlay (for example, video controls or annotations).
> When not using an underlay, the primary framebuffer will be displayed
> as RGBX (opaque) to avoid unnecessary blending in the display
> controller.
> 
> Bug: 789288
> Change-Id: I2fc94e524e250ec9b7e11cd6801e1c8308046a10
> Reviewed-on: https://chromium-review.googlesource.com/801974
> Reviewed-by: Alex Sakhartchouk <alexst@chromium.org>
> Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
> Reviewed-by: David Reveman <reveman@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Reviewed-by: Antoine Labour <piman@chromium.org>
> Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
> Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#542877}

TBR=marcheu@chromium.org,reveman@chromium.org,sky@chromium.org,danakj@chromium.org,alexst@chromium.org,dcastagna@chromium.org,piman@chromium.org,hoegsberg@chromium.org

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

Bug: 789288
Change-Id: I3005e3cb37a1385c5a1cd72bad76d1ffbad1cc63
Reviewed-on: https://chromium-review.googlesource.com/965721Reviewed-by: default avatarNicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543627}
parent 977ed840
...@@ -94,9 +94,6 @@ const gpu::SurfaceHandle kFakeSurfaceHandle = ...@@ -94,9 +94,6 @@ const gpu::SurfaceHandle kFakeSurfaceHandle =
const gpu::SurfaceHandle kFakeSurfaceHandle = 1; const gpu::SurfaceHandle kFakeSurfaceHandle = 1;
#endif #endif
const unsigned int kBufferQueueInternalformat = GL_RGBA;
const gfx::BufferFormat kBufferQueueFormat = gfx::BufferFormat::RGBA_8888;
class MockBufferQueue : public BufferQueue { class MockBufferQueue : public BufferQueue {
public: public:
MockBufferQueue(gpu::gles2::GLES2Interface* gl, MockBufferQueue(gpu::gles2::GLES2Interface* gl,
...@@ -105,8 +102,8 @@ class MockBufferQueue : public BufferQueue { ...@@ -105,8 +102,8 @@ class MockBufferQueue : public BufferQueue {
unsigned int internalformat) unsigned int internalformat)
: BufferQueue(gl, : BufferQueue(gl,
target, target,
kBufferQueueInternalformat, internalformat,
kBufferQueueFormat, display::DisplaySnapshot::PrimaryFormat(),
nullptr, nullptr,
gpu_memory_buffer_manager, gpu_memory_buffer_manager,
kFakeSurfaceHandle) {} kFakeSurfaceHandle) {}
...@@ -126,8 +123,7 @@ class BufferQueueTest : public ::testing::Test { ...@@ -126,8 +123,7 @@ class BufferQueueTest : public ::testing::Test {
gpu_memory_buffer_manager_.reset(new StubGpuMemoryBufferManager); gpu_memory_buffer_manager_.reset(new StubGpuMemoryBufferManager);
mock_output_surface_ = new MockBufferQueue(context_provider_->ContextGL(), mock_output_surface_ = new MockBufferQueue(context_provider_->ContextGL(),
gpu_memory_buffer_manager_.get(), gpu_memory_buffer_manager_.get(),
GL_TEXTURE_2D, GL_TEXTURE_2D, GL_RGB);
kBufferQueueInternalformat);
output_surface_.reset(mock_output_surface_); output_surface_.reset(mock_output_surface_);
output_surface_->Initialize(); output_surface_->Initialize();
} }
...@@ -267,7 +263,7 @@ std::unique_ptr<BufferQueue> CreateBufferQueue( ...@@ -267,7 +263,7 @@ std::unique_ptr<BufferQueue> CreateBufferQueue(
gpu::gles2::GLES2Interface* gl, gpu::gles2::GLES2Interface* gl,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
std::unique_ptr<BufferQueue> buffer_queue(new BufferQueue( std::unique_ptr<BufferQueue> buffer_queue(new BufferQueue(
gl, target, kBufferQueueInternalformat, kBufferQueueFormat, nullptr, gl, target, GL_RGB, display::DisplaySnapshot::PrimaryFormat(), nullptr,
gpu_memory_buffer_manager, kFakeSurfaceHandle)); gpu_memory_buffer_manager, kFakeSurfaceHandle));
buffer_queue->Initialize(); buffer_queue->Initialize();
return buffer_queue; return buffer_queue;
...@@ -306,8 +302,7 @@ TEST(BufferQueueStandaloneTest, FboBinding) { ...@@ -306,8 +302,7 @@ TEST(BufferQueueStandaloneTest, FboBinding) {
EXPECT_CALL(*context, bindTexture(target, Ne(0U))); EXPECT_CALL(*context, bindTexture(target, Ne(0U)));
EXPECT_CALL(*context, destroyImageCHROMIUM(1)); EXPECT_CALL(*context, destroyImageCHROMIUM(1));
Expectation image = Expectation image =
EXPECT_CALL(*context, EXPECT_CALL(*context, createImageCHROMIUM(_, 0, 0, GL_RGB))
createImageCHROMIUM(_, 0, 0, kBufferQueueInternalformat))
.WillOnce(Return(1)); .WillOnce(Return(1));
Expectation fb = Expectation fb =
EXPECT_CALL(*context, bindFramebuffer(GL_FRAMEBUFFER, Ne(0U))); EXPECT_CALL(*context, bindFramebuffer(GL_FRAMEBUFFER, Ne(0U)));
...@@ -337,9 +332,8 @@ TEST(BufferQueueStandaloneTest, CheckBoundFramebuffer) { ...@@ -337,9 +332,8 @@ TEST(BufferQueueStandaloneTest, CheckBoundFramebuffer) {
context_provider->ContextSupport())); context_provider->ContextSupport()));
output_surface.reset(new BufferQueue( output_surface.reset(new BufferQueue(
context_provider->ContextGL(), GL_TEXTURE_2D, context_provider->ContextGL(), GL_TEXTURE_2D, GL_RGB,
kBufferQueueInternalformat, kBufferQueueFormat, display::DisplaySnapshot::PrimaryFormat(), gl_helper.get(),
gl_helper.get(),
gpu_memory_buffer_manager.get(), kFakeSurfaceHandle)); gpu_memory_buffer_manager.get(), kFakeSurfaceHandle));
output_surface->Initialize(); output_surface->Initialize();
output_surface->Reshape(screen_size, 1.0f, gfx::ColorSpace(), false); output_surface->Reshape(screen_size, 1.0f, gfx::ColorSpace(), false);
...@@ -628,8 +622,7 @@ TEST_F(BufferQueueMockedContextTest, RecreateBuffers) { ...@@ -628,8 +622,7 @@ TEST_F(BufferQueueMockedContextTest, RecreateBuffers) {
// Expect all 4 images to be destroyed, 3 of the existing textures to be // Expect all 4 images to be destroyed, 3 of the existing textures to be
// copied from and 3 new images to be created. // copied from and 3 new images to be created.
EXPECT_CALL(*context_, createImageCHROMIUM(_, screen_size.width(), EXPECT_CALL(*context_, createImageCHROMIUM(_, screen_size.width(),
screen_size.height(), screen_size.height(), GL_RGB))
kBufferQueueInternalformat))
.Times(3); .Times(3);
Expectation copy1 = EXPECT_CALL(*mock_output_surface_, Expectation copy1 = EXPECT_CALL(*mock_output_surface_,
CopyBufferDamage(_, displayed->texture, _, _)) CopyBufferDamage(_, displayed->texture, _, _))
......
...@@ -516,12 +516,11 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( ...@@ -516,12 +516,11 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
disable_overlay_ca_layers), disable_overlay_ca_layers),
GetGpuMemoryBufferManager()); GetGpuMemoryBufferManager());
#else #else
DCHECK(capabilities.texture_format_bgra8888);
auto gpu_output_surface = auto gpu_output_surface =
std::make_unique<GpuSurfacelessBrowserCompositorOutputSurface>( std::make_unique<GpuSurfacelessBrowserCompositorOutputSurface>(
context_provider, data->surface_handle, vsync_callback, context_provider, data->surface_handle, vsync_callback,
CreateOverlayCandidateValidator(compositor->widget()), CreateOverlayCandidateValidator(compositor->widget()),
GL_TEXTURE_2D, GL_BGRA_EXT, GL_TEXTURE_2D, GL_RGB,
display::DisplaySnapshot::PrimaryFormat(), display::DisplaySnapshot::PrimaryFormat(),
GetGpuMemoryBufferManager()); GetGpuMemoryBufferManager());
gpu_vsync_control = gpu_output_surface.get(); gpu_vsync_control = gpu_output_surface.get();
......
...@@ -143,7 +143,7 @@ std::string DisplaySnapshot::ToString() const { ...@@ -143,7 +143,7 @@ std::string DisplaySnapshot::ToString() const {
// static // static
gfx::BufferFormat DisplaySnapshot::PrimaryFormat() { gfx::BufferFormat DisplaySnapshot::PrimaryFormat() {
return gfx::BufferFormat::BGRA_8888; return gfx::BufferFormat::BGRX_8888;
} }
} // namespace display } // namespace display
...@@ -63,9 +63,7 @@ class ClientNativePixmapFactoryDmabuf : public ClientNativePixmapFactory { ...@@ -63,9 +63,7 @@ class ClientNativePixmapFactoryDmabuf : public ClientNativePixmapFactory {
format == gfx::BufferFormat::YVU_420; format == gfx::BufferFormat::YVU_420;
case gfx::BufferUsage::SCANOUT: case gfx::BufferUsage::SCANOUT:
return format == gfx::BufferFormat::BGRX_8888 || return format == gfx::BufferFormat::BGRX_8888 ||
format == gfx::BufferFormat::RGBX_8888 || format == gfx::BufferFormat::RGBX_8888;
format == gfx::BufferFormat::RGBA_8888 ||
format == gfx::BufferFormat::BGRA_8888;
case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE: case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
return return
#if defined(ARCH_CPU_X86_FAMILY) #if defined(ARCH_CPU_X86_FAMILY)
......
...@@ -114,7 +114,7 @@ bool SurfacelessSkiaRenderer::BufferWrapper::Initialize( ...@@ -114,7 +114,7 @@ bool SurfacelessSkiaRenderer::BufferWrapper::Initialize(
->GetSurfaceFactoryOzone() ->GetSurfaceFactoryOzone()
->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); ->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT);
scoped_refptr<gl::GLImageNativePixmap> image( scoped_refptr<gl::GLImageNativePixmap> image(
new gl::GLImageNativePixmap(size, GL_BGRA_EXT)); new gl::GLImageNativePixmap(size, GL_RGB));
if (!image->Initialize(pixmap.get(), format)) { if (!image->Initialize(pixmap.get(), format)) {
LOG(ERROR) << "Failed to create GLImage"; LOG(ERROR) << "Failed to create GLImage";
return false; return false;
......
...@@ -136,7 +136,7 @@ bool GbmSurface::CreatePixmaps() { ...@@ -136,7 +136,7 @@ bool GbmSurface::CreatePixmaps() {
if (!pixmap) if (!pixmap)
return false; return false;
scoped_refptr<gl::GLImageNativePixmap> image = scoped_refptr<gl::GLImageNativePixmap> image =
new gl::GLImageNativePixmap(GetSize(), GL_BGRA_EXT); new gl::GLImageNativePixmap(GetSize(), GL_RGB);
if (!image->Initialize(pixmap.get(), if (!image->Initialize(pixmap.get(),
display::DisplaySnapshot::PrimaryFormat())) display::DisplaySnapshot::PrimaryFormat()))
return false; return false;
......
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