Skip to contentSkip to conversation

drm/amdgpu/vg20:support new UVD FW version naming convention

PATCH Superseded James Zhu 6 participants 13 messages Jun 6, 2018 – Jun 14, 2018 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

James Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu/vg20:support new UVD FW version naming convention

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for firmware revision
[7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +15 -4
index bcf68f8..575aff1b 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
 	hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
 	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-	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);
+
+	if (adev->asic_type != CHIP_VEGA20) {
+		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);
+	} else {
+		unsigned int fw_rev;
+
+		fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+		DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family ID: %hu\n",
+			version_major, version_minor, fw_rev, family_id);
+	}
 
 	/*
 	 * Limit the number of UVD handles depending on microcode major
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1528311598-6666-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 06.06.2018 um 20:59 schrieb James Zhu:

Quoted 17 lines

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for firmware revision
[7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 19 +++++++++++++++----
  1 file changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index bcf68f8..575aff1b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 212

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -4
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
  	hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
  	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-	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);
+
+	if (adev->asic_type != CHIP_VEGA20) {

I think it would be better to use "< CHIP_VEGA20" here.

Apart from that looks good to me, but Leo should have the last word.

Thanks,
Christian.

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +6 -0
+		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);
+	} else {
+		unsigned int fw_rev;

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 228

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +7 -0
+
+		fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+		DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family ID: %hu\n",
+			version_major, version_minor, fw_rev, family_id);
+	}
 
  	/*
  	 * Limit the number of UVD handles depending on microcode major

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 5fb5ba32-9230-55b5-ba3b-6f0fed2aa71b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw
Quoted 13 lines · Christian König

Am 06.06.2018 um 20:59 schrieb James Zhu:

Quoted 12 lines

Vega20 UVD Firmware has a new version naming convention:
   [31, 30] for encode interface major
   [29, 24] for encode interface minor
   [15, 8] for firmware revision
   [7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 19 +++++++++++++++----

  1 file changed, 15 insertions(+), 4 deletions(-)
Quoted 15 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 211

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -4
index bcf68f8..575aff1b 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
         hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
       family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-    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);
+
+    if (adev->asic_type != CHIP_VEGA20) {

I think it would be better to use "< CHIP_VEGA20" here.

Agreed. hopefully the convention will be kept consistently.

Quoted 1 line

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 212

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
 Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

Now the major and minor become 1.1. if you keep looking the code after the changed part, the 1.1 will cause problem for number of handles, since that decides how big of bo size for FW runtime.

Regards,
Leo

Quoted 24 lines

Apart from that looks good to me, but Leo should have the last word.

Thanks,
Christian.

Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +13 -0
+        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);
+    } else {
+        unsigned int fw_rev;
+
+        fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+        version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+        version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+        DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family ID: 
 %hu\n",
+            version_major, version_minor, fw_rev, family_id);
+    }
         /*
Quoted 1 line

       * Limit the number of UVD handles depending on microcode major

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): f6bff7c9-3053-6806-6f37-80a3c9198fbe-5C7GfCeVMHo@public.gmane.org

#6 lore raw
Quoted 32 lines · Leo Liu
Quoted 13 lines · Christian König

Am 06.06.2018 um 20:59 schrieb James Zhu:

Quoted 12 lines

Vega20 UVD Firmware has a new version naming convention:
   [31, 30] for encode interface major
   [29, 24] for encode interface minor
   [15, 8] for firmware revision
   [7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 19 +++++++++++++++----

  1 file changed, 15 insertions(+), 4 deletions(-)
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index bcf68f8..575aff1b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device · line 212

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -4
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device 
 *adev)
         hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
       family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-    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);
+
+    if (adev->asic_type != CHIP_VEGA20) {

I think it would be better to use "< CHIP_VEGA20" here.

Quoted 6 lines

Agreed. hopefully the convention will be kept consistently.

Quoted 1 line
Quoted 1 line

Inside kernel log UVD firmware Version: 1.1.2 (denote

major.minor.revision)

Now the major and minor become 1.1. if you keep looking the code after the changed part, the 1.1 will cause problem for number of handles, since that decides how big of bo size for FW runtime.

So Can I say after CHIP_VEGA20, all asics are using AMDGPU_MAX_UVD_HANDLES?  James

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
@@ -209,7 +209,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)

...
-       if ((version_major > 0x01) ||
+       if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) || ((version_major == 0x01) && (version_minor >= 0x50))) adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;

Quoted 36 lines

Regards,
Leo

Quoted 26 lines

Apart from that looks good to me, but Leo should have the last word.

Thanks,
Christian.

Quoted 11 lines

+        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);
+    } else {
+        unsigned int fw_rev;
+
+        fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff; +        version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) &

Quoted 8 lines

0x3f;
+        version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3; +        DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family
ID: %hu\n",
+            version_major, version_minor, fw_rev, family_id); +    }
        /*
       * Limit the number of UVD handles depending on microcode major

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw
In reply to a message not in the archive
Quoted 29 lines · Christian König

Am 06.06.2018 um 20:59 schrieb James Zhu:

Quoted 17 lines

Vega20 UVD Firmware has a new version naming convention:
   [31, 30] for encode interface major
   [29, 24] for encode interface minor
   [15, 8] for firmware revision
   [7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 19 +++++++++++++++----

  1 file changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index bcf68f8..575aff1b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 211

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -4
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
         hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
       family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-    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);
+
+    if (adev->asic_type != CHIP_VEGA20) {

I think it would be better to use "< CHIP_VEGA20" here.

Quoted 4 lines

Apart from that looks good to me, but Leo should have the last word.

Thanks,
Christian.

Sure. James

Quoted 18 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +6 -0
+        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);
+    } else {
+        unsigned int fw_rev;

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 228

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +7 -0
+
+        fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+        version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+        version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+        DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family ID: 
 %hu\n",
+            version_major, version_minor, fw_rev, family_id);
+    }
         /*
        * Limit the number of UVD handles depending on microcode major
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#8 lore raw

PATCH v2 1/1 drm/amdgpu/vg20:support new UVD FW version naming convention

In reply to a message not in the archive

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for firmware revision
[7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +16 -5
index bcf68f8..08cd5c9 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
 	hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
 	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-	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);
+
+	if (adev->asic_type < CHIP_VEGA20) {
+		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);
+	} else {
+		unsigned int fw_rev;
+
+		fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+		DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family ID: %hu\n",
+			version_major, version_minor, fw_rev, family_id);
+	}
 
 	/*
 	 * Limit the number of UVD handles depending on microcode major
@@ -219,7 +230,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 	 * instances support is 1.80. So all subsequent versions should
 	 * also have the same support.
 	 */
-	if ((version_major > 0x01) ||
+	if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) ||
 	    ((version_major == 0x01) && (version_minor >= 0x50)))
 		adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1528384768-11319-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org

#10 lore raw
Quoted 3 lines · James Zhu

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor

Is this major and minor for encode? The major and minor we current used in driver is for decode. Please double-check.

Regards,
Leo

Quoted 40 lines

[15, 8] for firmware revision
[7, 0] for hardware family id
Inside kernel log UVD firmware Version: 1.1.2 (denote major.minor.revision)

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 ++++++++++++++++-----
  1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +15 -4
index bcf68f8..08cd5c9 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
  	hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
  	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-	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);
+
+	if (adev->asic_type < CHIP_VEGA20) {
+		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);
+	} else {
+		unsigned int fw_rev;
+
+		fw_rev = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		version_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		version_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+		DRM_INFO("Found UVD firmware Version: %hu.%hu.%hu Family ID: %hu\n",
+			version_major, version_minor, fw_rev, family_id);
+	}
 
  	/*
  	 * Limit the number of UVD handles depending on microcode major

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 236

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -219,7 +230,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
  	 * instances support is 1.80. So all subsequent versions should
  	 * also have the same support.
  	 */
-	if ((version_major > 0x01) ||
+	if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) ||
  	    ((version_major == 0x01) && (version_minor >= 0x50)))
  		adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#11 lore raw

PATCH v3 1/1 drm/amdgpu/vg20:support new UVD FW version naming convention

In reply to a message not in the archive

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for decode interface minor
[7, 0] for hardware family id

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +13 -2
index bcf68f8..0ebc600 100644
@@ -210,8 +210,19 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
 	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);
+
+	if (adev->asic_type < CHIP_VEGA20) {
+		DRM_INFO("Found UVD firmware Version: %hu.%hu Family ID: %hu\n",
+			version_major, version_minor, family_id);
+	} else {
+		unsigned int enc_major, enc_minor, dec_minor;
+
+		dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		enc_major = (le32_to_cpu(hdr->ucode_version) >> 30) & 0x3;
+		DRM_INFO("Found UVD ENC FW: %hu.%hu DEC FW: .%hu Family ID: %hu\n",
+			enc_major, enc_minor, dec_minor, family_id);
+	}
 
 	/*
 	 * Limit the number of UVD handles depending on microcode major
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#12 lore raw

PATCH v4 1/1 drm/amdgpu/vg20:support new UVD FW version naming convention

In reply to a message not in the archive

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for decode interface minor
[7, 0] for hardware family id

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +16 -5
index bcf68f8..630e273 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
 	hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
 	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-	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);
+
+	if (adev->asic_type < CHIP_VEGA20) {
+		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);
+	} else {
+		unsigned int enc_major, enc_minor, dec_minor;
+
+		dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		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
@@ -219,7 +230,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 	 * instances support is 1.80. So all subsequent versions should
 	 * also have the same support.
 	 */
-	if ((version_major > 0x01) ||
+	if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) ||
 	    ((version_major == 0x01) && (version_minor >= 0x50)))
 		adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1528818414-6197-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#14 lore raw
Quoted 7 lines · James Zhu

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for decode interface minor
[7, 0] for hardware family id

Quoted 35 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 ++++++++++++++++-----
  1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +15 -4
index bcf68f8..630e273 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
  	hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
  	family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-	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);
+
+	if (adev->asic_type < CHIP_VEGA20) {
+		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);
+	} else {
+		unsigned int enc_major, enc_minor, dec_minor;
+
+		dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+		enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+		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

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_sw_init(struct amdgpu_device *adev) · line 236

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -219,7 +230,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
  	 * instances support is 1.80. So all subsequent versions should
  	 * also have the same support.
  	 */
-	if ((version_major > 0x01) ||
+	if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) ||
  	    ((version_major == 0x01) && (version_minor >= 0x50)))
  		adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#15 lore raw
In reply to a message not in the archive
Quoted 7 lines · James Zhu

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for decode interface minor
[7, 0] for hardware family id

This patch breaks adev->uvd.fw_version which is used elsewhere and causes build warnings. E.g.,

    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));

version_major and version_minor are undefined in some cases.

Alex

Quoted 46 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +16 -6
index bcf68f8..630e273 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
        hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
        family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-       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);
+
+       if (adev->asic_type < CHIP_VEGA20) {
+               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);
+       } else {
+               unsigned int enc_major, enc_minor, dec_minor;
+
+               dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+               enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+               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
@@ -219,7 +230,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
         * instances support is 1.80. So all subsequent versions should
         * also have the same support.
         */
-       if ((version_major > 0x01) ||
+       if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) ||
            ((version_major == 0x01) && (version_minor >= 0x50)))
                adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
 
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_PCM-W2KCnh7vJf2VyPx=zGNp2UJqThxS3OxO0dqZSbjw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#17 lore raw
Quoted 18 lines · Alex Deucher
Quoted 7 lines · James Zhu

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for decode interface minor
[7, 0] for hardware family id

This patch breaks adev->uvd.fw_version which is used elsewhere and causes build warnings. E.g.,

     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));
Quoted 3 lines

version_major and version_minor are undefined in some cases.

Alex

My email filter has wrong setting, Missed to capture this email in time. Thanks for correct with a new patch. James

Quoted 46 lines
Quoted 46 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 ++++++++++++++++-----
  1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +16 -6
index bcf68f8..630e273 100644
@@ -208,10 +208,21 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
 
         hdr = (const struct common_firmware_header *)adev->uvd.fw->data;
         family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-       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);
+
+       if (adev->asic_type < CHIP_VEGA20) {
+               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);
+       } else {
+               unsigned int enc_major, enc_minor, dec_minor;
+
+               dec_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+               enc_minor = (le32_to_cpu(hdr->ucode_version) >> 24) & 0x3f;
+               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
@@ -219,7 +230,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
          * instances support is 1.80. So all subsequent versions should
          * also have the same support.
          */
-       if ((version_major > 0x01) ||
+       if (adev->asic_type >= CHIP_VEGA20 || (version_major > 0x01) ||
             ((version_major == 0x01) && (version_minor >= 0x50)))
                 adev->uvd.max_handles = AMDGPU_MAX_UVD_HANDLES;
 
--

2.7.4

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#18 lore raw
In reply to a message not in the archive

Hi James,

Quoted 7 lines · James Zhu

Vega20 UVD Firmware has a new version naming convention:
[31, 30] for encode interface major
[29, 24] for encode interface minor
[15, 8] for decode interface minor
[7, 0] for hardware family id

This patch introduced the compiler warnings below.

Assuming adev->uvd.fw_version isn't used for anything with Vega20 and newer, the best solution might be to move the version_{major,minor} locals and all code using them into the (adev->asic_type < CHIP_VEGA20) block created by this patch.

drivers/gpu/drm//amd/amdgpu/amdgpu_uvd.c: In function ‘amdgpu_uvd_sw_init’:
drivers/gpu/drm//amd/amdgpu/amdgpu_uvd.c:237:65: warning: ‘version_minor’ may be used uninitialized in this function [-Wmaybe-uninitialized]
adev->uvd.fw_version = ((version_major << 24) | (version_minor << 16) |

                                                  ~~~~~~~~~~~~~~~^~~~~~
drivers/gpu/drm//amd/amdgpu/amdgpu_uvd.c:234:22: warning: ‘version_major’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      ((version_major == 0x01) && (version_minor >= 0x50)))
       ~~~~~~~~~~~~~~~^~~~~~~~
Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx