/* HWC wants to use display hardware, but can defer to OpenGL. */
use_flags |= BO_USE_SCANOUT | BO_USE_TEXTURE;
if (usage & GRALLOC_USAGE_HW_FB)
- use_flags |= BO_USE_NONE;
+ use_flags |= BO_USE_COMPOSER_TARGET;
if (usage & GRALLOC_USAGE_EXTERNAL_DISP)
/*
* This flag potentially covers external display for the normal drivers (i915,
supported = mod->driver->is_supported(&descriptor);
if (!supported && (usage & GRALLOC_USAGE_HW_COMPOSER)) {
- descriptor.use_flags &= ~BO_USE_SCANOUT;
+ descriptor.use_flags &= ~(BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET);
supported = mod->driver->is_supported(&descriptor);
}
if (!supported && (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) &&
bool supported = mDriver->is_supported(&crosDescriptor);
if (!supported && (descriptor.usage & BufferUsage::COMPOSER_OVERLAY)) {
- crosDescriptor.use_flags &= ~BO_USE_SCANOUT;
+ crosDescriptor.use_flags &= ~(BO_USE_SCANOUT & BO_USE_CLIENT_TARGET);
supported = mDriver->is_supported(&crosDescriptor);
}
bool supported = mDriver->is_supported(&crosDescriptor);
if (!supported && (descriptor.usage & BufferUsage::COMPOSER_OVERLAY)) {
- crosDescriptor.use_flags &= ~BO_USE_SCANOUT;
+ crosDescriptor.use_flags &= ~(BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET);
supported = mDriver->is_supported(&crosDescriptor);
}
bool supported = mDriver->is_supported(&crosDescriptor);
if (!supported) {
- crosDescriptor.use_flags &= ~BO_USE_SCANOUT;
+ crosDescriptor.use_flags &= ~(BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET);
supported = mDriver->is_supported(&crosDescriptor);
}
usage &= ~static_cast<Underlying>(BufferUsage::COMPOSER_OVERLAY);
usages.push_back("BufferUsage::COMPOSER_OVERLAY");
}
+ if (usage & BufferUsage::COMPOSER_CLIENT_TARGET) {
+ usage &= ~static_cast<Underlying>(BufferUsage::COMPOSER_CLIENT_TARGET);
+ usages.push_back("BufferUsage::COMPOSER_CLIENT_TARGET");
+ }
if (usage & BufferUsage::CPU_READ_OFTEN) {
usage &= ~static_cast<Underlying>(BufferUsage::CPU_READ_OFTEN);
usages.push_back("BufferUsage::CPU_READ_OFTEN");
/* HWC wants to use display hardware, but can defer to OpenGL. */
bufferUsage |= BO_USE_SCANOUT | BO_USE_TEXTURE;
}
+ if (grallocUsage & BufferUsage::COMPOSER_CLIENT_TARGET) {
+ /* GPU composition target buffer */
+ bufferUsage |= BO_USE_COMPOSER_TARGET;
+ }
/* Map this flag to linear until real HW protection is available on Android. */
if (grallocUsage & BufferUsage::PROTECTED) {
bufferUsage |= BO_USE_LINEAR;
{ DRM_FORMAT_XBGR2101010, __DRI_IMAGE_FORMAT_XBGR2101010 },
{ DRM_FORMAT_ARGB2101010, __DRI_IMAGE_FORMAT_ARGB2101010 },
{ DRM_FORMAT_ABGR2101010, __DRI_IMAGE_FORMAT_ABGR2101010 },
+ { DRM_FORMAT_ARGB4444, __DRI_IMAGE_FORMAT_RGB565 },
+
};
static int drm_format_to_dri_format(uint32_t drm_format)
}
drv_add_combinations(drv, scanout_render_formats, ARRAY_SIZE(scanout_render_formats),
- &LINEAR_METADATA, BO_USE_RENDER_MASK | BO_USE_SCANOUT);
+ &LINEAR_METADATA, BO_USE_RENDER_MASK | BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET);
drv_add_combinations(drv, texture_only_formats, ARRAY_SIZE(texture_only_formats),
&LINEAR_METADATA, BO_USE_TEXTURE_MASK);
#define BO_USE_HW_VIDEO_ENCODER (1ull << 14)
#define BO_USE_TEST_ALLOC (1ull << 15)
#define BO_USE_RENDERSCRIPT (1ull << 16)
+#define BO_USE_COMPOSER_TARGET (1ull << 17)
/* Quirks for allocating a buffer. */
#define BO_QUIRK_NONE 0
* plane and as a cursor.
*/
drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &LINEAR_METADATA,
- BO_USE_CURSOR | BO_USE_SCANOUT);
+ BO_USE_CURSOR | BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET);
drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &LINEAR_METADATA,
- BO_USE_CURSOR | BO_USE_SCANOUT);
+ BO_USE_CURSOR | BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET);
return 0;
}