From 0f6a41299aa367762dbbb49e51d6073c4ca4ba8f Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Tue, 25 Jun 2019 17:25:02 -0700 Subject: Attach color space information when attach and queue buffer. Currently when calling attachAndQueueBuffer, the color space information is lost. This results in color shift if the color space doesn't match the color space of the surface. BUG: b/135002842, b/131928312 Test: boot. Manually verified on P19 Change-Id: I1d77c9994f50d9a2f5cfde96ca805f7142fddfab --- libs/gui/Surface.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'libs/gui/Surface.cpp') diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp index e6eb327c6f..9fe5de82d1 100644 --- a/libs/gui/Surface.cpp +++ b/libs/gui/Surface.cpp @@ -1920,7 +1920,8 @@ status_t Surface::getAndFlushRemovedBuffers(std::vector>* out) return OK; } -status_t Surface::attachAndQueueBuffer(Surface* surface, sp buffer) { +status_t Surface::attachAndQueueBufferWithDataspace(Surface* surface, sp buffer, + Dataspace dataspace) { if (buffer == nullptr) { return BAD_VALUE; } @@ -1929,6 +1930,11 @@ status_t Surface::attachAndQueueBuffer(Surface* surface, sp buffe if (err != OK) { return err; } + ui::Dataspace tmpDataspace = surface->getBuffersDataSpace(); + err = surface->setBuffersDataSpace(dataspace); + if (err != OK) { + return err; + } err = surface->attachBuffer(buffer->getNativeBuffer()); if (err != OK) { return err; @@ -1937,6 +1943,10 @@ status_t Surface::attachAndQueueBuffer(Surface* surface, sp buffe if (err != OK) { return err; } + err = surface->setBuffersDataSpace(tmpDataspace); + if (err != OK) { + return err; + } err = surface->disconnect(NATIVE_WINDOW_API_CPU); return err; } -- cgit v1.2.3-59-g8ed1b