diff options
author | 2019-06-25 17:25:02 -0700 | |
---|---|---|
committer | 2019-08-27 10:23:56 -0700 | |
commit | 3bf71ab81e1ff56520ce3e8d8eb901e5b360e245 (patch) | |
tree | b87dd1df0f9a212ce7df964038a267293f6b43c8 /libs/gui/Surface.cpp | |
parent | 9b586699b2d9b379cbb8385ad55fe37ebb25fe1e (diff) |
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
(cherry picked from commit 0f6a41299aa367762dbbb49e51d6073c4ca4ba8f)
Diffstat (limited to 'libs/gui/Surface.cpp')
-rw-r--r-- | libs/gui/Surface.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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<sp<GraphicBuffer>>* out) return OK; } -status_t Surface::attachAndQueueBuffer(Surface* surface, sp<GraphicBuffer> buffer) { +status_t Surface::attachAndQueueBufferWithDataspace(Surface* surface, sp<GraphicBuffer> buffer, + Dataspace dataspace) { if (buffer == nullptr) { return BAD_VALUE; } @@ -1929,6 +1930,11 @@ status_t Surface::attachAndQueueBuffer(Surface* surface, sp<GraphicBuffer> 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<GraphicBuffer> buffe if (err != OK) { return err; } + err = surface->setBuffersDataSpace(tmpDataspace); + if (err != OK) { + return err; + } err = surface->disconnect(NATIVE_WINDOW_API_CPU); return err; } |