sf: vds: Avoid HWC for certain scenarios
Reserve HWC for VDS for WFD use case. During WFD usecase, sink usage will contain GRALLOC_USAGE_PRIVATE_WFD flag. When HWC is avoided, all virtual displays are composed using GLES. This means that GLES composes directly into the sink buffer and signals the consumer. Furthermore, it is expected that any color conversion will be handled on the consumer side. CRs-Fixed: 908380 Change-Id: I93ff54c79ece788b6caf3f4172835d8ac1362f62
This commit is contained in:
parent
81c57b3149
commit
f8ea9b5796
@ -44,6 +44,9 @@
|
|||||||
#include <DisplayHardware/ExHWComposer.h>
|
#include <DisplayHardware/ExHWComposer.h>
|
||||||
#include <DisplayHardware/ExVirtualDisplaySurface.h>
|
#include <DisplayHardware/ExVirtualDisplaySurface.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#if QTI_BSP
|
||||||
|
#include <gralloc_priv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
@ -157,5 +160,17 @@ bool DisplayUtils::createV4L2BasedVirtualDisplay(HWComposer* hwc, int32_t &hwcDi
|
|||||||
return false;
|
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
|
}; // namespace android
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ class DisplayUtils {
|
|||||||
sp<IGraphicBufferProducer> &producer, sp<IGraphicBufferProducer> bqProducer,
|
sp<IGraphicBufferProducer> &producer, sp<IGraphicBufferProducer> bqProducer,
|
||||||
sp<IGraphicBufferConsumer> bqConsumer, String8 currentStateDisplayName,
|
sp<IGraphicBufferConsumer> bqConsumer, String8 currentStateDisplayName,
|
||||||
bool currentStateIsSecure, int currentStateType);
|
bool currentStateIsSecure, int currentStateType);
|
||||||
|
bool canAllocateHwcDisplayIdForVDS(int usage);
|
||||||
DisplayUtils();
|
DisplayUtils();
|
||||||
private:
|
private:
|
||||||
static DisplayUtils* sDisplayUtils;
|
static DisplayUtils* sDisplayUtils;
|
||||||
|
@ -1430,6 +1430,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
|
|||||||
if (state.surface != NULL) {
|
if (state.surface != NULL) {
|
||||||
|
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
DisplayUtils* displayUtils = DisplayUtils::getInstance();
|
||||||
int status = state.surface->query(
|
int status = state.surface->query(
|
||||||
NATIVE_WINDOW_WIDTH, &width);
|
NATIVE_WINDOW_WIDTH, &width);
|
||||||
ALOGE_IF(status != NO_ERROR,
|
ALOGE_IF(status != NO_ERROR,
|
||||||
@ -1442,11 +1443,19 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags)
|
|||||||
if (MAX_VIRTUAL_DISPLAY_DIMENSION == 0 ||
|
if (MAX_VIRTUAL_DISPLAY_DIMENSION == 0 ||
|
||||||
(width <= MAX_VIRTUAL_DISPLAY_DIMENSION &&
|
(width <= MAX_VIRTUAL_DISPLAY_DIMENSION &&
|
||||||
height <= MAX_VIRTUAL_DISPLAY_DIMENSION)) {
|
height <= MAX_VIRTUAL_DISPLAY_DIMENSION)) {
|
||||||
|
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);
|
hwcDisplayId = allocateHwcDisplayId(state.type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DisplayUtils::getInstance()->initVDSInstance(mHwc, hwcDisplayId,
|
displayUtils->initVDSInstance(mHwc, hwcDisplayId, state.surface,
|
||||||
state.surface, dispSurface, producer, bqProducer, bqConsumer,
|
dispSurface, producer, bqProducer, bqConsumer,
|
||||||
state.displayName, state.isSecure, state.type);
|
state.displayName, state.isSecure, state.type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user