X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=cros_gralloc%2Fgralloc4%2FCrosGralloc4Mapper.cc;h=e11450acecb4a40e81f4761e0a0b93400a3c210c;hb=662a9fd2acd72fd73e72110924ea9f350429195d;hp=2a3f4c03ab2b94b6182639957942cb568866d32f;hpb=91cb5d7dc573964b035a3b27d0c64740f94fd2ec;p=android-x86%2Fexternal-minigbm.git diff --git a/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc b/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc index 2a3f4c0..e11450a 100644 --- a/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc +++ b/cros_gralloc/gralloc4/CrosGralloc4Mapper.cc @@ -13,7 +13,9 @@ #include #include +#include "cros_gralloc/cros_gralloc_helpers.h" #include "cros_gralloc/gralloc4/CrosGralloc4Utils.h" + #include "helpers.h" using aidl::android::hardware::graphics::common::BlendMode; @@ -85,7 +87,7 @@ Return CrosGralloc4Mapper::importBuffer(const hidl_handle& handle, importB native_handle_t* importedBufferHandle = native_handle_clone(bufferHandle); if (!importedBufferHandle) { - drv_log("Failed to importBuffer. Handle clone failed.\n"); + drv_log("Failed to importBuffer. Handle clone failed: %s.\n", strerror(errno)); hidlCb(Error::NO_RESOURCES, nullptr); return Void(); } @@ -399,7 +401,7 @@ Return CrosGralloc4Mapper::isSupported(const BufferDescriptorInfo& descrip 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); } @@ -467,12 +469,8 @@ Return CrosGralloc4Mapper::get(cros_gralloc_handle_t crosHandle, PixelFormat pixelFormat = static_cast(crosHandle->droid_format); status = android::gralloc4::encodePixelFormatRequested(pixelFormat, &encodedMetadata); } else if (metadataType == android::gralloc4::MetadataType_PixelFormatFourCC) { - uint32_t format = crosHandle->format; - // Map internal fourcc codes back to standard fourcc codes. - if (format == DRM_FORMAT_YVU420_ANDROID) { - format = DRM_FORMAT_YVU420; - } - status = android::gralloc4::encodePixelFormatFourCC(format, &encodedMetadata); + status = android::gralloc4::encodePixelFormatFourCC( + drv_get_standard_fourcc(crosHandle->format), &encodedMetadata); } else if (metadataType == android::gralloc4::MetadataType_PixelFormatModifier) { status = android::gralloc4::encodePixelFormatModifier(crosHandle->format_modifier, &encodedMetadata); @@ -502,8 +500,8 @@ Return CrosGralloc4Mapper::get(cros_gralloc_handle_t crosHandle, planeLayout.offsetInBytes = crosHandle->offsets[plane]; planeLayout.strideInBytes = crosHandle->strides[plane]; planeLayout.totalSizeInBytes = crosHandle->sizes[plane]; - planeLayout.widthInSamples = crosHandle->width; - planeLayout.heightInSamples = crosHandle->height; + planeLayout.widthInSamples = crosHandle->width / planeLayout.horizontalSubsampling; + planeLayout.heightInSamples = crosHandle->height / planeLayout.verticalSubsampling; } status = android::gralloc4::encodePlaneLayouts(planeLayouts, &encodedMetadata); @@ -602,7 +600,7 @@ int CrosGralloc4Mapper::getResolvedDrmFormat(PixelFormat pixelFormat, uint64_t b uint32_t resolvedDrmFormat = mDriver->get_resolved_drm_format(drmFormat, usage); if (resolvedDrmFormat == DRM_FORMAT_INVALID) { - std::string drmFormatString = getDrmFormatString(drmFormat); + std::string drmFormatString = get_drm_format_string(drmFormat); drv_log("Failed to getResolvedDrmFormat. Failed to resolve drm format %s\n", drmFormatString.c_str()); return -1; @@ -641,7 +639,8 @@ Return CrosGralloc4Mapper::getFromBufferDescriptorInfo( hidlCb(Error::BAD_VALUE, encodedMetadata); return Void(); } - status = android::gralloc4::encodePixelFormatFourCC(drmFormat, &encodedMetadata); + status = android::gralloc4::encodePixelFormatFourCC(drv_get_standard_fourcc(drmFormat), + &encodedMetadata); } else if (metadataType == android::gralloc4::MetadataType_Usage) { status = android::gralloc4::encodeUsage(descriptor.usage, &encodedMetadata); } else if (metadataType == android::gralloc4::MetadataType_ProtectedContent) {