diff --git a/vav2/platforms/windows/vavcore/src/Decoder/MediaCodecSurfaceManager.cpp b/vav2/platforms/windows/vavcore/src/Decoder/MediaCodecSurfaceManager.cpp index 698213d..e3dcda2 100644 --- a/vav2/platforms/windows/vavcore/src/Decoder/MediaCodecSurfaceManager.cpp +++ b/vav2/platforms/windows/vavcore/src/Decoder/MediaCodecSurfaceManager.cpp @@ -339,20 +339,30 @@ bool MediaCodecSurfaceManager::CreateVulkanImage(void* vk_device, void* vk_insta // Detect device type for NV12/NV21 workaround bool is_nv21_device = (ahb_desc.format == 0x7FA00C06); // Qualcomm vendor format - // Also check CPU type using system property + // CRITICAL: Check GPU vendor, NOT manufacturer, because Samsung devices use Qualcomm GPUs! + // Use ro.hardware.vulkan to detect actual GPU vendor + char gpu_vendor[256] = {0}; + __system_property_get("ro.hardware.vulkan", gpu_vendor); + std::string gpu_vendor_str(gpu_vendor); + std::transform(gpu_vendor_str.begin(), gpu_vendor_str.end(), gpu_vendor_str.begin(), ::tolower); + + // Also check manufacturer as fallback char manufacturer[256] = {0}; __system_property_get("ro.product.manufacturer", manufacturer); std::string manufacturer_str(manufacturer); std::transform(manufacturer_str.begin(), manufacturer_str.end(), manufacturer_str.begin(), ::tolower); - bool is_qualcomm = (manufacturer_str.find("qualcomm") != std::string::npos) || - (manufacturer_str.find("qcom") != std::string::npos) || - (manufacturer_str.find("snapdragon") != std::string::npos); + // Check if Qualcomm GPU (Adreno) - this is what matters for Vulkan! + bool is_qualcomm_gpu = (gpu_vendor_str.find("adreno") != std::string::npos) || + (gpu_vendor_str.find("qcom") != std::string::npos) || + (manufacturer_str.find("qualcomm") != std::string::npos); bool is_samsung = (manufacturer_str.find("samsung") != std::string::npos); - LogInfo("Device manufacturer: " + manufacturer_str); - LogInfo(" is_qualcomm: " + std::string(is_qualcomm ? "true" : "false")); + LogInfo("Device info:"); + LogInfo(" Manufacturer: " + manufacturer_str); + LogInfo(" GPU vendor: " + gpu_vendor_str); + LogInfo(" is_qualcomm_gpu (Adreno): " + std::string(is_qualcomm_gpu ? "true" : "false")); LogInfo(" is_samsung: " + std::string(is_samsung ? "true" : "false")); VkSamplerYcbcrConversionCreateInfo ycbcrConversionCreateInfo = {}; @@ -362,17 +372,17 @@ bool MediaCodecSurfaceManager::CreateVulkanImage(void* vk_device, void* vk_insta // Use format properties from AHardwareBuffer VkFormat vulkan_format = ahb_format_props.format; if (vulkan_format == VK_FORMAT_UNDEFINED || vulkan_format == 0) { - // WORKAROUND: CPU-specific format detection - // Qualcomm Snapdragon → NV21 (CrCb) - // Samsung Exynos → NV12 (CbCr) - if (is_qualcomm || is_nv21_device) { - vulkan_format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR; // NV12 (will use BT.601) + // WORKAROUND: GPU-specific format detection + // Qualcomm Adreno GPU → NV21 (CrCb) requires component swizzle + // Other GPUs → NV12 (CbCr) standard format + if (is_qualcomm_gpu || is_nv21_device) { + vulkan_format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR; // NV12 format (will use BT.601) is_nv21_device = true; - LogInfo("Qualcomm device detected → Using NV12 format with BT.601 color matrix"); + LogInfo("Qualcomm Adreno GPU detected → Using NV12 format with BT.601 + component swizzle"); } else { - vulkan_format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR; // NV12 + vulkan_format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR; // NV12 format is_nv21_device = false; - LogInfo("Non-Qualcomm device → Using NV12 format with MediaCodec settings"); + LogInfo("Non-Qualcomm GPU → Using NV12 format with MediaCodec settings"); } }