#include <DisplayHardware/ExHWComposer.h>
#include <DisplayHardware/ExVirtualDisplaySurface.h>
#include <dlfcn.h>
+#if QTI_BSP
+#include <gralloc_priv.h>
+#endif
namespace android {
return false;
}
+bool DisplayUtils::canAllocateHwcDisplayIdForVDS(int usage) {
+ // on AOSP builds with QTI_BSP disabled, we should allocate hwc display id for virtual display
+ int flag_mask = 0xffffffff;
+
+#if QTI_BSP
+ // Reserve hardware acceleration for WFD use-case
+ flag_mask = GRALLOC_USAGE_PRIVATE_WFD;
+#endif
+
+ return (usage & flag_mask);
+}
+
}; // namespace android
sp<IGraphicBufferProducer> &producer, sp<IGraphicBufferProducer> bqProducer,
sp<IGraphicBufferConsumer> bqConsumer, String8 currentStateDisplayName,
bool currentStateIsSecure, int currentStateType);
+ bool canAllocateHwcDisplayIdForVDS(int usage);
DisplayUtils();
private:
static DisplayUtils* sDisplayUtils;
if (state.surface != NULL) {
int width = 0;
+ DisplayUtils* displayUtils = DisplayUtils::getInstance();
int status = state.surface->query(
NATIVE_WINDOW_WIDTH, &width);
ALOGE_IF(status != NO_ERROR,
if (MAX_VIRTUAL_DISPLAY_DIMENSION == 0 ||
(width <= MAX_VIRTUAL_DISPLAY_DIMENSION &&
height <= MAX_VIRTUAL_DISPLAY_DIMENSION)) {
- hwcDisplayId = allocateHwcDisplayId(state.type);
+ int usage = 0;
+ status = state.surface->query(
+ NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage);
+ ALOGW_IF(status != NO_ERROR,
+ "Unable to query usage (%d)", status);
+ if ( (status == NO_ERROR) &&
+ displayUtils->canAllocateHwcDisplayIdForVDS(usage)) {
+ hwcDisplayId = allocateHwcDisplayId(state.type);
+ }
}
- DisplayUtils::getInstance()->initVDSInstance(mHwc, hwcDisplayId,
- state.surface, dispSurface, producer, bqProducer, bqConsumer,
+ displayUtils->initVDSInstance(mHwc, hwcDisplayId, state.surface,
+ dispSurface, producer, bqProducer, bqConsumer,
state.displayName, state.isSecure, state.type);
}