From 3fccb5cc62a04524519faf53a4ab704c92c07f70 Mon Sep 17 00:00:00 2001 From: ZhuChenyanX Date: Wed, 16 Apr 2025 02:29:59 +0000 Subject: [PATCH] Switch codec gpu type by property Tracked-On: Signed-off-by: ZhuChenyanX --- cros_gralloc/cros_gralloc_driver.cc | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index 1ff88ab5..f5122241 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -997,11 +997,30 @@ int cros_gralloc_driver::select_kms_driver(uint64_t gpu_grp_type) int cros_gralloc_driver::select_video_driver(uint64_t gpu_grp_type) { - if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) { - return GPU_GRP_TYPE_INTEL_DGPU_IDX; - } - if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) { - return GPU_GRP_TYPE_INTEL_IGPU_IDX; + int use_dgpu; + char value[PROPERTY_VALUE_MAX] = {}; + + property_get("vendor.video.hw.dgpu", value, "1"); + use_dgpu = atoi(value); + if (use_dgpu) + ALOGE("-ZCY- MGM use dgpu."); + else + ALOGE("-ZCY- MGM use igpu."); + + if (use_dgpu) { + if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) { + return GPU_GRP_TYPE_INTEL_DGPU_IDX; + } + if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) { + return GPU_GRP_TYPE_INTEL_IGPU_IDX; + } + } else { + if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) { + return GPU_GRP_TYPE_INTEL_IGPU_IDX; + } + if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) { + return GPU_GRP_TYPE_INTEL_DGPU_IDX; + } } if (gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_BIT) { return GPU_GRP_TYPE_VIRTIO_GPU_BLOB_IDX;