summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
diff options
context:
space:
mode:
authorDominik Laskowski <domlaskowski@google.com>2018-05-24 15:50:06 -0700
committerDominik Laskowski <domlaskowski@google.com>2018-11-08 11:04:49 -0800
commit075d317063d815430d3a45acc7292e0681f73ee5 (patch)
treee692d15875e0143d9917ee843856b8bcdf125e2c /services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
parentb04f98a270fa393232068b7423be765e823ddf50 (diff)
downloadandroid_frameworks_native-075d317063d815430d3a45acc7292e0681f73ee5.tar.gz
android_frameworks_native-075d317063d815430d3a45acc7292e0681f73ee5.tar.bz2
android_frameworks_native-075d317063d815430d3a45acc7292e0681f73ee5.zip
SF: Generalize display management
This CL enables SF to manage an arbitrary number of physical displays. Previously, displays were identified by 32-bit IDs, where 0 is the internal display, 1 is the external display, [2, INT32_MAX] are HWC virtual displays, and -1 represents an invalid display or a non-HWC virtual display. If the HWC provides display identification data, SF now allocates 64-bit display IDs for physical and HWC virtual displays. The IDs are expressed using an option type, where the null value represents an invalid display or non-HWC virtual display. Without HWC support, SF falls back to legacy behavior with at most two physical displays. The dynamic display IDs are translated to the legacy constants at the SF/DMS boundary, as a stopgap until the framework is generalized. Bug: 74619554 Test: Connect 3 displays and create virtual displays on HWC 2.2 and 2.3 Test: libsurfaceflinger_unittest Test: SurfaceFlinger_test Change-Id: I0a4a57b6ab7de2dbcf719a4eb1a19a133694012e
Diffstat (limited to 'services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp')
-rw-r--r--services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
index e6d783434..f3f8d9d85 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
@@ -52,26 +52,25 @@ using ui::Dataspace;
*
*/
-FramebufferSurface::FramebufferSurface(HWComposer& hwc, int disp,
- const sp<IGraphicBufferConsumer>& consumer) :
- ConsumerBase(consumer),
- mDisplayType(disp),
- mCurrentBufferSlot(-1),
- mCurrentBuffer(),
- mCurrentFence(Fence::NO_FENCE),
- mHwc(hwc),
- mHasPendingRelease(false),
- mPreviousBufferSlot(BufferQueue::INVALID_BUFFER_SLOT),
- mPreviousBuffer()
-{
- ALOGV("Creating for display %d", disp);
+FramebufferSurface::FramebufferSurface(HWComposer& hwc, DisplayId displayId,
+ const sp<IGraphicBufferConsumer>& consumer)
+ : ConsumerBase(consumer),
+ mDisplayId(displayId),
+ mCurrentBufferSlot(-1),
+ mCurrentBuffer(),
+ mCurrentFence(Fence::NO_FENCE),
+ mHwc(hwc),
+ mHasPendingRelease(false),
+ mPreviousBufferSlot(BufferQueue::INVALID_BUFFER_SLOT),
+ mPreviousBuffer() {
+ ALOGV("Creating for display %" PRIu64, displayId);
mName = "FramebufferSurface";
mConsumer->setConsumerName(mName);
mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_FB |
GRALLOC_USAGE_HW_RENDER |
GRALLOC_USAGE_HW_COMPOSER);
- const auto& activeConfig = mHwc.getActiveConfig(disp);
+ const auto& activeConfig = mHwc.getActiveConfig(displayId);
mConsumer->setDefaultBufferSize(activeConfig->getWidth(),
activeConfig->getHeight());
mConsumer->setMaxAcquiredBufferCount(
@@ -142,8 +141,7 @@ status_t FramebufferSurface::nextBuffer(uint32_t& outSlot,
mHwcBufferCache.getHwcBuffer(mCurrentBufferSlot, mCurrentBuffer,
&outSlot, &outBuffer);
outDataspace = static_cast<Dataspace>(item.mDataSpace);
- status_t result =
- mHwc.setClientTarget(mDisplayType, outSlot, outFence, outBuffer, outDataspace);
+ status_t result = mHwc.setClientTarget(mDisplayId, outSlot, outFence, outBuffer, outDataspace);
if (result != NO_ERROR) {
ALOGE("error posting framebuffer: %d", result);
return result;
@@ -161,7 +159,7 @@ void FramebufferSurface::freeBufferLocked(int slotIndex) {
void FramebufferSurface::onFrameCommitted() {
if (mHasPendingRelease) {
- sp<Fence> fence = mHwc.getPresentFence(mDisplayType);
+ sp<Fence> fence = mHwc.getPresentFence(mDisplayId);
if (fence->isValid()) {
status_t result = addReleaseFence(mPreviousBufferSlot,
mPreviousBuffer, fence);