+Peter On 2018-06-14 11:51 AM, Leo Liu wrote: > > > On 06/14/2018 11:29 AM, Alex Deucher wrote: >> The uvd version information was not set correctly for vega20. >> Rearrange the logic to set it correctly and fix the warnings >> as a result. >> >> Fixes: 7b3c773f405 (drm/amdgpu/vg20:support new UVD FW version naming >> convention) >> Signed-off-by: Alex Deucher <alexander.deucher at amd.com> >> --- >> >> I'm not sure if this is exactly how we want to expose the new >> firmware versioning >> to userspace, but it's better than random stack data. > The encode team like to have the origin number which they put to FW, > back to user space for chip beyond RV and Vega20. > >> >> Â drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 43 >> +++++++++++++++++++-------------- >> Â 1 file changed, 25 insertions(+), 18 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> index 630e273c16ce..dde0c4383014 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> @@ -127,7 +127,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) >> Â Â Â Â Â unsigned long bo_size; >> Â Â Â Â Â const char *fw_name; >> Â Â Â Â Â const struct common_firmware_header *hdr; >> -Â Â Â unsigned version_major, version_minor, family_id; >> +Â Â Â unsigned family_id; >> Â Â Â Â Â int i, j, r; >> Â Â Â Â Â Â INIT_DELAYED_WORK(&adev->uvd.inst->idle_work, >> amdgpu_uvd_idle_work_handler); >> @@ -210,10 +210,31 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) >> Â Â Â Â Â family_id = le32_to_cpu(hdr->ucode_version) & 0xff; >> Â Â Â Â Â Â if (adev->asic_type < CHIP_VEGA20) { >> +Â Â Â Â Â Â Â unsigned version_major, version_minor; >> + >> Â Â Â Â Â Â Â Â Â version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & >> 0xff; >> Â Â Â Â Â Â Â Â Â version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff; >> Â Â Â Â Â Â Â Â Â DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: >> %hu\n", >> Â Â Â Â Â Â Â Â Â Â Â Â Â version_major, version_minor, family_id); >> + >> +Â Â Â Â Â Â Â /* >> +Â Â Â Â Â Â Â Â * Limit the number of UVD handles depending on microcode major >> +Â Â Â Â Â Â Â Â * and minor versions. The firmware version which has 40 UVD >> +Â Â Â Â Â Â Â Â * instances support is 1.80. So all subsequent versions should >> +Â Â Â Â Â Â Â Â * also have the same support. >> +Â Â Â Â Â Â Â Â */ >> +Â Â Â Â Â Â Â if ((version_major > 0x01) || >> +Â Â Â Â Â Â Â Â Â Â Â ((version_major == 0x01) && (version_minor >= 0x50))) >> +Â Â Â Â Â Â Â Â Â Â Â adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES; >> + >> +Â Â Â Â Â Â Â adev->uvd.fw_version = ((version_major << 24) | >> (version_minor << 16) | >> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (family_id << 8)); >> + >> +Â Â Â Â Â Â Â if ((adev->asic_type == CHIP_POLARIS10 || >> +Â Â Â Â Â Â Â Â Â Â Â Â adev->asic_type == CHIP_POLARIS11) && >> +Â Â Â Â Â Â Â Â Â Â Â (adev->uvd.fw_version < FW_1_66_16)) >> +Â Â Â Â Â Â Â Â Â Â Â DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is >> too old.\n", >> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â version_major, version_minor); >> Â Â Â Â Â } else { >> Â Â Â Â Â Â Â Â Â unsigned int enc_major, enc_minor, dec_minor; >> Â @@ -222,26 +243,12 @@ int amdgpu_uvd_sw_init(struct amdgpu_device >> *adev) >> Â Â Â Â Â Â Â Â Â enc_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3; >> Â Â Â Â Â Â Â Â Â DRM_INFO("Found UVD firmware ENC: %hu.%hu DEC: .%hu Family >> ID: %hu\n", >> Â Â Â Â Â Â Â Â Â Â Â Â Â enc_major, enc_minor, dec_minor, family_id); >> -Â Â Â } >> Â -Â Â Â /* >> -Â Â Â Â * Limit the number of UVD handles depending on microcode major >> -Â Â Â Â * and minor versions. The firmware version which has 40 UVD >> -Â Â Â Â * instances support is 1.80. So all subsequent versions should >> -Â Â Â Â * also have the same support. >> -Â Â Â Â */ >> -Â Â Â if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) || >> -Â Â Â Â Â Â Â ((version_major == 0x01) && (version_minor >= 0x50))) >> Â Â Â Â Â Â Â Â Â adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES; >> Â -Â Â Â adev->uvd.fw_version = ((version_major << 24) | (version_minor >> << 16) | >> -Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (family_id << 8)); >> - >> -Â Â Â if ((adev->asic_type == CHIP_POLARIS10 || >> -Â Â Â Â Â Â Â Â adev->asic_type == CHIP_POLARIS11) && >> -Â Â Â Â Â Â Â (adev->uvd.fw_version < FW_1_66_16)) >> -Â Â Â Â Â Â Â DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too >> old.\n", >> -Â Â Â Â Â Â Â Â Â Â Â Â Â version_major, version_minor); >> +Â Â Â Â Â Â Â adev->uvd.fw_version = ((enc_major << 24) | (enc_minor << 16) | >> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (dec_minor << 8) | (family_id << 0)); > It should be: > > adev->uvd.fw_version = hdr->ucode_version; Hi Peter, Does user space need the whole ucode_version or just fields with enc/dec/familyID? James > > With that fixed the patch is: > > Reviewed-by: Leo Liu <leo.liu at amd.com> > > > Regards, > Leo > > >> +Â Â Â } >> Â Â Â Â Â Â bo_size = AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE >> Â Â Â Â Â Â Â Â Â Â Â +Â AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles; > > _______________________________________________ > amd-gfx mailing list > amd-gfx at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx