Allow for resizing of Virtual Displays.
Modify SurfaceFlinger to use VirtualDisplaySurface in all cases when a virtual
display is used. Add functionality in VirtualDisplaySurface to resize the
buffers aquired in the QueueBufferOutput. Add transaction support in
SurfaceFlinger for resize. Add the modification of the size in DisplayDevice.
Change-Id: Iae7e3556dc06fd18d470adbbd76f7255f6e6dd6b
Tested: None
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 80cf643..6a034ec 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1258,6 +1258,9 @@
disp->setProjection(state.orientation,
state.viewport, state.frame);
}
+ if (state.width != draw[i].width || state.height != draw[i].height) {
+ disp->setDisplaySize(state.width, state.height);
+ }
}
}
}
@@ -1288,13 +1291,7 @@
bqProducer, bqConsumer, state.displayName);
dispSurface = vds;
- if (hwcDisplayId >= 0) {
- producer = vds;
- } else {
- // There won't be any interaction with HWC for this virtual display,
- // so the GLES driver can pass buffers directly to the sink.
- producer = state.surface;
- }
+ producer = vds;
}
} else {
ALOGE_IF(state.surface!=NULL,
@@ -1992,6 +1989,16 @@
flags |= eDisplayTransactionNeeded;
}
}
+ if (what & DisplayState::eDisplaySizeChanged) {
+ if (disp.width != s.width) {
+ disp.width = s.width;
+ flags |= eDisplayTransactionNeeded;
+ }
+ if (disp.height != s.height) {
+ disp.height = s.height;
+ flags |= eDisplayTransactionNeeded;
+ }
+ }
}
return flags;
}
@@ -2178,6 +2185,8 @@
d.orientation = DisplayState::eOrientationDefault;
d.frame.makeInvalid();
d.viewport.makeInvalid();
+ d.width = 0;
+ d.height = 0;
displays.add(d);
setTransactionState(state, displays, 0);
setPowerModeInternal(getDisplayDevice(d.token), HWC_POWER_MODE_NORMAL);
@@ -3206,11 +3215,11 @@
// ---------------------------------------------------------------------------
SurfaceFlinger::DisplayDeviceState::DisplayDeviceState()
- : type(DisplayDevice::DISPLAY_ID_INVALID) {
+ : type(DisplayDevice::DISPLAY_ID_INVALID), width(0), height(0) {
}
SurfaceFlinger::DisplayDeviceState::DisplayDeviceState(DisplayDevice::DisplayType type)
- : type(type), layerStack(DisplayDevice::NO_LAYER_STACK), orientation(0) {
+ : type(type), layerStack(DisplayDevice::NO_LAYER_STACK), orientation(0), width(0), height(0) {
viewport.makeInvalid();
frame.makeInvalid();
}