hwc: vds: Display HAL changes for VDS based solution
1. Hard code the vsync for VDS during the first prepare call
with valid VDS display. We align the vsync period to that
of the primary display. Effectively, we produce at the at
the primary refresh rate and do not worry about the consumer.
2. Do not bail out on the first frame as it leads to showing empty
buffer. This leads to failures for some test cases such as those
run in CTS.
3. We need an FB layer handle check to cater for this usecase:
i. Video is playing in landscape on Primary
ii. Launch ScreenRecord app
In this scenario, the first VDS draw call will have HWC
composition and VDS does not involve GPU to get eglSwapBuffer
to get valid fb handle.
Change-Id: Idc7d989e244a83ad28ce730ecb12955bc249dc25
diff --git a/libhwcomposer/hwc_virtual.cpp b/libhwcomposer/hwc_virtual.cpp
index 6ae4e42..dab33fc 100644
--- a/libhwcomposer/hwc_virtual.cpp
+++ b/libhwcomposer/hwc_virtual.cpp
@@ -104,9 +104,14 @@
if(ctx->dpyAttr[dpy].connected == false) {
ctx->dpyAttr[dpy].connected = true;
+ // We set the vsync period to the primary refresh rate, leaving
+ // it up to the consumer to decide how fast to consume frames.
+ ctx->dpyAttr[dpy].vsync_period
+ = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period;
init(ctx);
- //First round, just setup and return so primary can free pipes
- return 0;
+ // XXX: for architectures with limited resources we would normally
+ // allow one padding round to free up resources but this breaks
+ // certain use cases.
}
ctx->dpyAttr[dpy].isConfiguring = false;
@@ -132,8 +137,7 @@
uint32_t last = list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
- if(fbLayer->handle && !isSecondaryConfiguring(ctx) &&
- !ctx->mMDPComp[dpy]->isGLESOnlyComp()) {
+ if(ctx->dpyAttr[dpy].connected) {
private_handle_t *ohnd = (private_handle_t *)list->outbuf;
int format = ohnd->format;
if (format == HAL_PIXEL_FORMAT_RGBA_8888)
@@ -157,7 +161,13 @@
ALOGE("%s: MDPComp draw failed", __FUNCTION__);
ret = -1;
}
- if (!ctx->mFBUpdate[dpy]->draw(ctx,
+ // We need an FB layer handle check to cater for this usecase:
+ // Video is playing in landscape on primary, then launch
+ // ScreenRecord app.
+ // In this scenario, the first VDS draw call will have HWC
+ // composition and VDS does nit involve GPU to get eglSwapBuffer
+ // to get valid fb handle.
+ if (fbLayer->handle && !ctx->mFBUpdate[dpy]->draw(ctx,
(private_handle_t *)fbLayer->handle)) {
ALOGE("%s: FBUpdate::draw fail!", __FUNCTION__);
ret = -1;