drm/amdgpu: Complete multimedia bandwidth interface
Subsystems (2)
PATCH 1/1 drm/amdgpu: Complete multimedia bandwidth interface
- Update SRIOV PF2VF header with latest revision
- Extend existing function in amdgpu_virt.c to read MM bandwidth config from PF2VF message
- Add SRIOV Sienna Cichlid codec array and update the bandwidth with PF2VF message
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 56 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 13 +++ drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 54 ++++++++-- drivers/gpu/drm/amd/amdgpu/nv.c | 110 +++++++++++++++++++- 4 files changed, 226 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +56 -0
@@ -432,6 +432,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)uint32_t checksum;uint32_t checkval; +uint32_t i; +uint32_t tmp; +if (adev->virt.fw_reserve.p_pf2vf ==NULL )return -EINVAL ;
@@ -472,6 +475,27 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) adev->virt.reg_access = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all; + adev->virt.decode_max_dimension_pixels =0 ; + adev->virt.decode_max_frame_pixels =0 ; + adev->virt.encode_max_dimension_pixels =0 ; + adev->virt.encode_max_frame_pixels =0 ; + adev->virt.is_mm_bw_enabled = false; +for (i =0 ; i <AMD_SRIOV_MSG_RESERVE_VCN_INST ; i++) { + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].decode_max_dimension_pixels; + adev->virt.decode_max_dimension_pixels =max (tmp, adev->virt.decode_max_dimension_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].decode_max_frame_pixels; + adev->virt.decode_max_frame_pixels =max (tmp, adev->virt.decode_max_frame_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].encode_max_dimension_pixels; + adev->virt.encode_max_dimension_pixels =max (tmp, adev->virt.encode_max_dimension_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].encode_max_frame_pixels; + adev->virt.encode_max_frame_pixels =max (tmp, adev->virt.encode_max_frame_pixels); + } +if ((adev->virt.decode_max_dimension_pixels >0 ) || (adev->virt.encode_max_dimension_pixels >0 )) + adev->virt.is_mm_bw_enabled = true; +break ;default :DRM_ERROR ("invalid pf2vf version\n" );
@@ -744,3 +768,35 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *adreturn mode; } + +void amdgpu_virt_update_sriov_video_codec (struct amdgpu_device *adev, +struct amdgpu_video_codec_info *encode,uint32_t encode_array_size, +struct amdgpu_video_codec_info *decode,uint32_t decode_array_size) +{ +uint32_t i; + +if (!adev->virt.is_mm_bw_enabled) +return ; + +if (encode) { +for (i =0 ; i < encode_array_size; i++) { + encode[i].max_width = adev->virt.encode_max_dimension_pixels; + encode[i].max_pixels_per_frame = adev->virt.encode_max_frame_pixels; +if (encode[i].max_width >0 ) + encode[i].max_height = encode[i].max_pixels_per_frame / encode[i].max_width; +else + encode[i].max_height =0 ; + } + } + +if (decode) { +for (i =0 ; i < decode_array_size; i++) { + decode[i].max_width = adev->virt.decode_max_dimension_pixels; + decode[i].max_pixels_per_frame = adev->virt.decode_max_frame_pixels; +if (decode[i].max_width >0 ) + decode[i].max_height = decode[i].max_pixels_per_frame / decode[i].max_width; +else + decode[i].max_height =0 ; + } + } +}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +13 -0
@@ -233,8 +233,17 @@ struct amdgpu_virt {/* vf2pf message */ struct delayed_work vf2pf_work;uint32_t vf2pf_update_interval_ms; + +/* multimedia bandwidth config */ +bool is_mm_bw_enabled; +uint32_t decode_max_dimension_pixels; +uint32_t decode_max_frame_pixels; +uint32_t encode_max_dimension_pixels; +uint32_t encode_max_frame_pixels; }; +struct amdgpu_video_codec_info ; +#define amdgpu_sriov_enabled (adev) \ ((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
@@ -307,4 +316,8 @@ int amdgpu_virt_enable_access_debugfs(struct amdgpu_device *adev);void amdgpu_virt_disable_access_debugfs (struct amdgpu_device *adev);enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode (struct amdgpu_device *adev); + +void amdgpu_virt_update_sriov_video_codec (struct amdgpu_device *adev, +struct amdgpu_video_codec_info *encode,uint32_t encode_array_size, +struct amdgpu_video_codec_info *decode,uint32_t decode_array_size);#endif
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +48 -6
80 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/nv.c +109 -1
129 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Better get open source team's RB as well
Thanks
------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Bokun Zhang
Sent: Thursday, May 13, 2021 1:20 PM
To: [email protected]
Cc: Zhang, Bokun <[email protected]>
Subject: [PATCH] drm/amdgpu: Complete multimedia bandwidth interface
- Update SRIOV PF2VF header with latest revision
- Extend existing function in amdgpu_virt.c to read MM bandwidth config from PF2VF message
- Add SRIOV Sienna Cichlid codec array and update the bandwidth with PF2VF message
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 56 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 13 +++ drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 54 ++++++++-- drivers/gpu/drm/amd/amdgpu/nv.c | 110 +++++++++++++++++++- 4 files changed, 226 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +27 -0
@@ -432,6 +432,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)uint32_t checksum;uint32_t checkval; +uint32_t i; +uint32_t tmp; +if (adev->virt.fw_reserve.p_pf2vf ==NULL )return -EINVAL ;
@@ -472,6 +475,27 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) adev->virt.reg_access = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all; + adev->virt.decode_max_dimension_pixels =0 ; + adev->virt.decode_max_frame_pixels =0 ; + adev->virt.encode_max_dimension_pixels =0 ; + adev->virt.encode_max_frame_pixels =0 ; + adev->virt.is_mm_bw_enabled = false; +for (i =0 ; i <AMD_SRIOV_MSG_RESERVE_VCN_INST ; i++) { + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].decode_max_dimension_pixels; + adev->virt.decode_max_dimension_pixels =max (tmp, +adev->virt.decode_max_dimension_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].decode_max_frame_pixels; + adev->virt.decode_max_frame_pixels =max (tmp, +adev->virt.decode_max_frame_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].encode_max_dimension_pixels; + adev->virt.encode_max_dimension_pixels =max (tmp, +adev->virt.encode_max_dimension_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].encode_max_frame_pixels; + adev->virt.encode_max_frame_pixels =max (tmp, adev->virt.encode_max_frame_pixels); + } +if ((adev->virt.decode_max_dimension_pixels >0 ) || (adev->virt.encode_max_dimension_pixels >0 )) + adev->virt.is_mm_bw_enabled = true; +
break;
default:
DRM_ERROR("invalid pf2vf version\n"); @@ -744,3 +768,35 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *ad
return mode;
}
+
+void amdgpu_virt_update_sriov_video_codec(struct amdgpu_device *adev,
+ struct amdgpu_video_codec_info *encode, uint32_t encode_array_size,
+ struct amdgpu_video_codec_info *decode, uint32_t decode_array_size)
+{
+ uint32_t i;
+
+ if (!adev->virt.is_mm_bw_enabled)
+ return;
+
+ if (encode) {
+ for (i = 0; i < encode_array_size; i++) {
+ encode[i].max_width = adev->virt.encode_max_dimension_pixels;
+ encode[i].max_pixels_per_frame = adev->virt.encode_max_frame_pixels;
+ if (encode[i].max_width > 0)
+ encode[i].max_height = encode[i].max_pixels_per_frame / encode[i].max_width;
+ else
+ encode[i].max_height = 0;
+ }
+ }
+
+ if (decode) {
+ for (i = 0; i < decode_array_size; i++) {
+ decode[i].max_width = adev->virt.decode_max_dimension_pixels;
+ decode[i].max_pixels_per_frame = adev->virt.decode_max_frame_pixels;
+ if (decode[i].max_width > 0)
+ decode[i].max_height = decode[i].max_pixels_per_frame / decode[i].max_width;
+ else
+ decode[i].max_height = 0;
+ }
+ }
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +13 -0
@@ -233,8 +233,17 @@ struct amdgpu_virt {/* vf2pf message */ struct delayed_work vf2pf_work;uint32_t vf2pf_update_interval_ms; + +/* multimedia bandwidth config */ +bool is_mm_bw_enabled; +uint32_t decode_max_dimension_pixels; +uint32_t decode_max_frame_pixels; +uint32_t encode_max_dimension_pixels; +uint32_t encode_max_frame_pixels; }; +struct amdgpu_video_codec_info ; +#define amdgpu_sriov_enabled (adev) \ ((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
@@ -307,4 +316,8 @@ int amdgpu_virt_enable_access_debugfs(struct amdgpu_device *adev); void amdgpu_virt_disable_access_debugfs(struct amdgpu_device *adev);enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode (struct amdgpu_device *adev); + +void amdgpu_virt_update_sriov_video_codec (struct amdgpu_device *adev, +struct amdgpu_video_codec_info *encode,uint32_t encode_array_size, +struct amdgpu_video_codec_info *decode,uint32_t decode_array_size);#endif
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +48 -6
80 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/nv.c +107 -2
124 lines not on this page · raw message
2.20.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cmonk.liu%40amd.com%7C3aed0168a5d5494f634208d915cfbae0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637564804209668228%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Wyx7GoLCeZ5eTQORk5Loiqv%2FY2bhKYvpHIzAPXf%2BZOY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
________________________________
From: amd-gfx <[email protected]> on behalf of Liu, Monk <[email protected]>
Sent: Thursday, May 13, 2021 7:50 AM
To: Zhang, Bokun <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Bokun <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Complete multimedia bandwidth interface
[AMD Official Use Only - Internal Distribution Only]
Better get open source team's RB as well
Thanks
------------------------------------------
Monk Liu | Cloud-GPU Core team
------------------------------------------
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Bokun Zhang
Sent: Thursday, May 13, 2021 1:20 PM
To: [email protected]
Cc: Zhang, Bokun <[email protected]>
Subject: [PATCH] drm/amdgpu: Complete multimedia bandwidth interface
- Update SRIOV PF2VF header with latest revision
- Extend existing function in amdgpu_virt.c to read MM bandwidth config from PF2VF message
- Add SRIOV Sienna Cichlid codec array and update the bandwidth with PF2VF message
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 56 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 13 +++ drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 54 ++++++++-- drivers/gpu/drm/amd/amdgpu/nv.c | 110 +++++++++++++++++++- 4 files changed, 226 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +27 -0
@@ -432,6 +432,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)uint32_t checksum;uint32_t checkval; +uint32_t i; +uint32_t tmp; +if (adev->virt.fw_reserve.p_pf2vf ==NULL )return -EINVAL ;
@@ -472,6 +475,27 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) adev->virt.reg_access = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all; + adev->virt.decode_max_dimension_pixels =0 ; + adev->virt.decode_max_frame_pixels =0 ; + adev->virt.encode_max_dimension_pixels =0 ; + adev->virt.encode_max_frame_pixels =0 ; + adev->virt.is_mm_bw_enabled = false; +for (i =0 ; i <AMD_SRIOV_MSG_RESERVE_VCN_INST ; i++) { + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].decode_max_dimension_pixels; + adev->virt.decode_max_dimension_pixels =max (tmp, +adev->virt.decode_max_dimension_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].decode_max_frame_pixels; + adev->virt.decode_max_frame_pixels =max (tmp, +adev->virt.decode_max_frame_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].encode_max_dimension_pixels; + adev->virt.encode_max_dimension_pixels =max (tmp, +adev->virt.encode_max_dimension_pixels); + + tmp = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->mm_bw_management[i].encode_max_frame_pixels; + adev->virt.encode_max_frame_pixels =max (tmp, adev->virt.encode_max_frame_pixels); + } +if ((adev->virt.decode_max_dimension_pixels >0 ) || (adev->virt.encode_max_dimension_pixels >0 )) + adev->virt.is_mm_bw_enabled = true; +
break;
default:
DRM_ERROR("invalid pf2vf version\n"); @@ -744,3 +768,35 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *ad
return mode; }
+
+void amdgpu_virt_update_sriov_video_codec(struct amdgpu_device *adev,
+ struct amdgpu_video_codec_info *encode, uint32_t encode_array_size,
+ struct amdgpu_video_codec_info *decode, uint32_t decode_array_size)
+{
+ uint32_t i;
+
+ if (!adev->virt.is_mm_bw_enabled)
+ return;
+
+ if (encode) {
+ for (i = 0; i < encode_array_size; i++) {
+ encode[i].max_width = adev->virt.encode_max_dimension_pixels; + encode[i].max_pixels_per_frame = adev->virt.encode_max_frame_pixels; + if (encode[i].max_width > 0)
+ encode[i].max_height = encode[i].max_pixels_per_frame / encode[i].max_width;
+ else
+ encode[i].max_height = 0;
+ }
+ }
+
+ if (decode) {
+ for (i = 0; i < decode_array_size; i++) {
+ decode[i].max_width = adev->virt.decode_max_dimension_pixels; + decode[i].max_pixels_per_frame = adev->virt.decode_max_frame_pixels; + if (decode[i].max_width > 0)
+ decode[i].max_height = decode[i].max_pixels_per_frame / decode[i].max_width;
+ else
+ decode[i].max_height = 0;
+ }
+ }
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +13 -0
@@ -233,8 +233,17 @@ struct amdgpu_virt {/* vf2pf message */ struct delayed_work vf2pf_work;uint32_t vf2pf_update_interval_ms; + +/* multimedia bandwidth config */ +bool is_mm_bw_enabled; +uint32_t decode_max_dimension_pixels; +uint32_t decode_max_frame_pixels; +uint32_t encode_max_dimension_pixels; +uint32_t encode_max_frame_pixels; }; +struct amdgpu_video_codec_info ; +#define amdgpu_sriov_enabled (adev) \ ((adev)->virt.caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV)
@@ -307,4 +316,8 @@ int amdgpu_virt_enable_access_debugfs(struct amdgpu_device *adev); void amdgpu_virt_disable_access_debugfs(struct amdgpu_device *adev);enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode (struct amdgpu_device *adev); + +void amdgpu_virt_update_sriov_video_codec (struct amdgpu_device *adev, +struct amdgpu_video_codec_info *encode,uint32_t encode_array_size, +struct amdgpu_video_codec_info *decode,uint32_t decode_array_size);#endif
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +48 -6
80 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/nv.c +107 -2
124 lines not on this page · raw message
2.20.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C9be40f22588749e14c8608d916055a9d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637565034521071448%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6raS%2BZy0ngarsgVcG4NBkmH5Ym0%2BuyD7GCXo4su4V30%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C9be40f22588749e14c8608d916055a9d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637565034521071448%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6raS%2BZy0ngarsgVcG4NBkmH5Ym0%2BuyD7GCXo4su4V30%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx