linyaa-kiwi / android-ndk-rutabagas

Sandbox for Android NDK demos
3 stars 2 forks source link

Intel crashing with HEVC file #3

Open emilieroberts opened 5 years ago

emilieroberts commented 5 years ago

We are seeing a crash on vkBindImageMemory with HEVC files on intel only (not Qualcomm). For example using this linked file taken on an iPhone (also seen with HEVC files from Samsung phones).

ahb_desc = {AHardwareBuffer_Desc}

            width = {uint32_t} 3840

            height = {uint32_t} 2160

            layers = {uint32_t} 1

            format = {uint32_t} 842094169

            usage = {uint64_t} 8483

            stride = {uint32_t} 3840

            rfu0 = {uint32_t} 0

            rfu1 = {uint64_t} 0

ahb_format_props = {VkAndroidHardwareBufferFormatPropertiesANDROID}

            sType = {VkStructureType} VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID

            pNext = {void * | 0x0} NULL

            format = {VkFormat} VK_FORMAT_UNDEFINED

            externalFormat = {uint64_t} 0

            formatFeatures = {VkFormatFeatureFlags} 131072

            samplerYcbcrConversionComponents = {VkComponentMapping}

                            r = {VkComponentSwizzle} VK_COMPONENT_SWIZZLE_IDENTITY

                            g = {VkComponentSwizzle} VK_COMPONENT_SWIZZLE_IDENTITY

                            b = {VkComponentSwizzle} VK_COMPONENT_SWIZZLE_IDENTITY

                            a = {VkComponentSwizzle} VK_COMPONENT_SWIZZLE_IDENTITY

            suggestedYcbcrModel = {VkSamplerYcbcrModelConversion} VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601

            suggestedYcbcrRange = {VkSamplerYcbcrRange} VK_SAMPLER_YCBCR_RANGE_ITU_FULL

            suggestedXChromaOffset = {VkChromaLocation} VK_CHROMA_LOCATION_MIDPOINT

            suggestedYChromaOffset = {VkChromaLocation} VK_CHROMA_LOCATION_MIDPOINT
emilieroberts commented 5 years ago

logcat: rucrash.txt

linyaa-kiwi commented 5 years ago

Observations:

On today's Mesa master branch (https://gitlab.freedesktop.org/mesa/mesa/blob/c7e5d24d8f5281a85d9f6646e4d7601f947d6f7d), I found two bugs:

  1. vk_format_info.h:vk_format_from_android(AHARDWAREBUFFER_FORMAT_YV12) returns VK_FORMAT_UNDEFINED, when it should return VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM (that is, if I correctly understand YCbCr formats, which I certainly don't).
  2. When vk_format_from_android() fails, then anv_android.c:138 assigns externalFormat = 0, which is spec illegal. Instead, it should return failure.

I will file a bug against the Intel driver.