cros_gralloc: AIDL fixes for pixelformats and getMetadata
- fix return values for getArmMetadata - add some understanding of new AIDL pixelformats Bug: b/388092228, b/397712115, b/377616165 Test: boot corsola with AIDL gralloc/stable c mapper Flag: EXEMPT desktop-only Change-Id: I66b2ec6af7227cfb4c92e9459aeeee00aaa14b8f
This commit is contained in:
parent
88b88bfa69
commit
1a29f8b3da
3 changed files with 22 additions and 8 deletions
|
|
@ -21,6 +21,12 @@
|
||||||
/* Define to match AIDL PixelFormat::R_8. */
|
/* Define to match AIDL PixelFormat::R_8. */
|
||||||
#define HAL_PIXEL_FORMAT_R8 0x38
|
#define HAL_PIXEL_FORMAT_R8 0x38
|
||||||
|
|
||||||
|
/* New formats from hardware/interfaces/graphics/common/aidl/android/hardware/graphics/common/PixelFormat.aidl */
|
||||||
|
#define HAL_PIXEL_FORMAT_R16_UINT 57
|
||||||
|
#define HAL_PIXEL_FORMAT_R16G16_UINT 58
|
||||||
|
#define HAL_PIXEL_FORMAT_RGBA_10101010 59
|
||||||
|
|
||||||
|
|
||||||
uint32_t cros_gralloc_convert_format(int format)
|
uint32_t cros_gralloc_convert_format(int format)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
@ -88,6 +94,14 @@ uint32_t cros_gralloc_convert_format(int format)
|
||||||
return DRM_FORMAT_DEPTH32;
|
return DRM_FORMAT_DEPTH32;
|
||||||
case HAL_PIXEL_FORMAT_DEPTH_32F_STENCIL_8:
|
case HAL_PIXEL_FORMAT_DEPTH_32F_STENCIL_8:
|
||||||
return DRM_FORMAT_DEPTH32_STENCIL8;
|
return DRM_FORMAT_DEPTH32_STENCIL8;
|
||||||
|
#if ANDROID_API_LEVEL >= 34
|
||||||
|
case HAL_PIXEL_FORMAT_R16_UINT:
|
||||||
|
return DRM_FORMAT_R16;
|
||||||
|
case HAL_PIXEL_FORMAT_R16G16_UINT:
|
||||||
|
return DRM_FORMAT_GR1616;
|
||||||
|
case HAL_PIXEL_FORMAT_RGBA_10101010:
|
||||||
|
return DRM_FORMAT_AXBXGXRX106106106106;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return DRM_FORMAT_NONE;
|
return DRM_FORMAT_NONE;
|
||||||
|
|
|
||||||
|
|
@ -305,9 +305,8 @@ int32_t CrosGrallocMapperV5::getArmMetadata(buffer_handle_t _Nonnull buffer,
|
||||||
mDriver->with_buffer(crosHandle, [&](cros_gralloc_buffer* crosBuffer) {
|
mDriver->with_buffer(crosHandle, [&](cros_gralloc_buffer* crosBuffer) {
|
||||||
uint32_t num_planes = crosBuffer->get_num_planes();
|
uint32_t num_planes = crosBuffer->get_num_planes();
|
||||||
|
|
||||||
if (outDataSize < sizeof(int64_t) * (1 + num_planes)) {
|
retValue = sizeof(int64_t) * (1 + num_planes);
|
||||||
retValue = sizeof(int64_t) * (1 + num_planes);
|
if (outDataSize >= retValue) {
|
||||||
} else {
|
|
||||||
int64_t plane_fds[DRV_MAX_PLANES + 1];
|
int64_t plane_fds[DRV_MAX_PLANES + 1];
|
||||||
|
|
||||||
plane_fds[0] = num_planes;
|
plane_fds[0] = num_planes;
|
||||||
|
|
@ -317,7 +316,7 @@ int32_t CrosGrallocMapperV5::getArmMetadata(buffer_handle_t _Nonnull buffer,
|
||||||
|
|
||||||
memcpy(outData, plane_fds, sizeof(uint64_t) * (1 + num_planes));
|
memcpy(outData, plane_fds, sizeof(uint64_t) * (1 + num_planes));
|
||||||
|
|
||||||
retValue = -AIMAPPER_ERROR_NONE;
|
retValue = sizeof(uint64_t) * (1 + num_planes);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
@ -327,11 +326,10 @@ int32_t CrosGrallocMapperV5::getArmMetadata(buffer_handle_t _Nonnull buffer,
|
||||||
uint32_t pf = crosBuffer->get_format();
|
uint32_t pf = crosBuffer->get_format();
|
||||||
int64_t fdt = static_cast<int64_t>(DataTypeFromDrmPixelFormat(pf));
|
int64_t fdt = static_cast<int64_t>(DataTypeFromDrmPixelFormat(pf));
|
||||||
|
|
||||||
if (outDataSize < sizeof(fdt)) {
|
retValue = sizeof(fdt);
|
||||||
retValue = sizeof(fdt);
|
if (outDataSize >= retValue) {
|
||||||
} else {
|
|
||||||
memcpy(outData, &fdt, sizeof(fdt));
|
memcpy(outData, &fdt, sizeof(fdt));
|
||||||
retValue = -AIMAPPER_ERROR_NONE;
|
retValue = sizeof(fdt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -165,10 +165,12 @@ static const struct planar_layout *layout_from_format(uint32_t format)
|
||||||
case DRM_FORMAT_XBGR8888:
|
case DRM_FORMAT_XBGR8888:
|
||||||
case DRM_FORMAT_XRGB2101010:
|
case DRM_FORMAT_XRGB2101010:
|
||||||
case DRM_FORMAT_XRGB8888:
|
case DRM_FORMAT_XRGB8888:
|
||||||
|
case DRM_FORMAT_GR1616:
|
||||||
return &packed_4bpp_layout;
|
return &packed_4bpp_layout;
|
||||||
|
|
||||||
case DRM_FORMAT_DEPTH32_STENCIL8:
|
case DRM_FORMAT_DEPTH32_STENCIL8:
|
||||||
case DRM_FORMAT_ABGR16161616F:
|
case DRM_FORMAT_ABGR16161616F:
|
||||||
|
case DRM_FORMAT_AXBXGXRX106106106106:
|
||||||
return &packed_8bpp_layout;
|
return &packed_8bpp_layout;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue