<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Monk,<o:p></o:p></p>
<p class="MsoNormal">     Yes, actually this patch is to disable decode ring, and also want to let gstreamer could continue running. As gstreamer will check both encode and decode capability, if any of this is missing, then it couldn’t run.<o:p></o:p></p>
<p class="MsoNormal">     As for navi12 sriov it disables decode ring, so adev->vcn.inst[i].ring_dec.sched.ready will be false, so add extra follow code here to report decode.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||<br>
+                               (adev->asic_type == CHIP_NAVI12 &&<br>
+                               amdgpu_sriov_vf(adev)))<br>
                                 ++num_rings;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best wishes<o:p></o:p></p>
<p class="MsoNormal">Emily Deng<o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Li, Xin (Justin)<br>
<b>Sent:</b> Thursday, May 27, 2021 3:18 PM<br>
<b>To:</b> Liu, Monk <Monk.Liu@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Min, Frank <Frank.Min@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi, friends.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My apologize for this patch. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve ported this patch from another branch to fix gstreamer’s lack of “vaapi264enc”, currently this ported patch did fix that issue. However, since this patch is ported from another branch, I might need to do some alternations and audits
 mainly in its commit messages. I will file another review right after my fixes.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you all for you time.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">BR,<o:p></o:p></p>
<p class="MsoNormal">Justin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Liu, Monk <<a href="mailto:Monk.Liu@amd.com">Monk.Liu@amd.com</a>><br>
<b>Date: </b>Thursday, May 27, 2021 at 07:57<br>
<b>To: </b>Li, Xin (Justin) <<a href="mailto:Xin2.Li@amd.com">Xin2.Li@amd.com</a>>,
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Cc: </b>Li, Xin (Justin) <<a href="mailto:Xin2.Li@amd.com">Xin2.Li@amd.com</a>>, Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>>, Min, Frank <<a href="mailto:Frank.Min@amd.com">Frank.Min@amd.com</a>>, Koenig,
 Christian <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>><br>
<b>Subject: </b>RE: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">[AMD Official Use Only]<br>
<br>
Looks it lack enough background for people to review:<br>
<br>
<br>
-                       if (adev->vcn.inst[i].ring_dec.sched.ready)<br>
+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||<br>
+                               (adev->asic_type == CHIP_NAVI12 &&<br>
+                               amdgpu_sriov_vf(adev)))<br>
                                 ++num_rings;<br>
<br>
[ml] why for SRIOV navi12 is forced to have those DEC rings ? since  SRIOV navi12 have no decode capability , any explain here ?<br>
<br>
<br>
-               if (amdgpu_is_tmz(adev))<br>
-                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;<br>
[ML] why this is removed ? is it related to your issue ?<br>
<br>
<br>
Thanks <br>
<br>
------------------------------------------<br>
Monk Liu | Cloud-GPU Core team<br>
------------------------------------------<br>
<br>
-----Original Message-----<br>
From: amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> On Behalf Of Li, Xin (Justin)<br>
Sent: Wednesday, May 26, 2021 6:13 PM<br>
To: <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
Cc: Li, Xin (Justin) <<a href="mailto:Xin2.Li@amd.com">Xin2.Li@amd.com</a>>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>>; Min, Frank <<a href="mailto:Frank.Min@amd.com">Frank.Min@amd.com</a>>; Koenig, Christian
 <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>><br>
Subject: [PATCH] drm/amdgpu: Fix Gstreamer api vaapih264enc missing<br>
<br>
since vcn decoding ring is not required, so just disable it.<br>
<br>
Cc: Alex.Deucher <<a href="mailto:alexander.deucher@amd.com">alexander.deucher@amd.com</a>><br>
Cc: Christian.Konig <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>><br>
Signed-off-by: Li.Xin.Justin <<a href="mailto:xin2.li@amd.com">xin2.li@amd.com</a>><br>
Signed-off-by: Frank.Min <<a href="mailto:Frank.Min@amd.com">Frank.Min@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  6 +++---<br>
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 25 ++++++++++++++-----------<br>
 2 files changed, 17 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
index 524e4fe5efe8..614e6b06e94e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c<br>
@@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,<br>
                         if (adev->uvd.harvest_config & (1 << i))<br>
                                 continue;<br>
 <br>
-                       if (adev->vcn.inst[i].ring_dec.sched.ready)<br>
+                       if (adev->vcn.inst[i].ring_dec.sched.ready ||<br>
+                               (adev->asic_type == CHIP_NAVI12 &&<br>
+                               amdgpu_sriov_vf(adev)))<br>
                                 ++num_rings;<br>
                 }<br>
                 ib_start_alignment = 16;<br>
@@ -770,8 +772,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)<br>
                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;<br>
                 if (amdgpu_mcbp || amdgpu_sriov_vf(adev))<br>
                         dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;<br>
-               if (amdgpu_is_tmz(adev))<br>
-                       dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;<br>
 <br>
                 vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;<br>
                 vm_size -= AMDGPU_VA_RESERVED_SIZE;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
index 8af567c546db..dc8a36766c4a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c<br>
@@ -220,17 +220,20 @@ static int vcn_v2_0_hw_init(void *handle)<br>
 {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
         struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;<br>
-       int i, r;<br>
+       int i, r = -1;<br>
 <br>
         adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,<br>
                                              ring->doorbell_index, 0);<br>
 <br>
-       if (amdgpu_sriov_vf(adev))<br>
+       if (amdgpu_sriov_vf(adev)) {<br>
                 vcn_v2_0_start_sriov(adev);<br>
-<br>
-       r = amdgpu_ring_test_helper(ring);<br>
-       if (r)<br>
-               goto done;<br>
+               if (adev->asic_type == CHIP_NAVI12)<br>
+                       ring->sched.ready = false;<br>
+       } else {<br>
+               r = amdgpu_ring_test_helper(ring);<br>
+               if (r)<br>
+                       goto done;<br>
+       }<br>
 <br>
         //Disable vcn decode for sriov<br>
         if (amdgpu_sriov_vf(adev))<br>
@@ -245,8 +248,11 @@ static int vcn_v2_0_hw_init(void *handle)<br>
 <br>
 done:<br>
         if (!r)<br>
-               DRM_INFO("VCN decode and encode initialized successfully(under %s).\n",<br>
-                       (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");<br>
+               DRM_INFO("VCN %s encode initialized successfully(under %s).\n",<br>
+                       (adev->asic_type == CHIP_NAVI12 &&<br>
+                               amdgpu_sriov_vf(adev))?"":"decode and",<br>
+                       (adev->pg_flags &<br>
+                               AMD_PG_SUPPORT_VCN_DPG)?"DPG Mode":"SPG Mode");<br>
 <br>
         return r;<br>
 }<br>
@@ -1721,9 +1727,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)<br>
         unsigned i;<br>
         int r;<br>
 <br>
-       if (amdgpu_sriov_vf(adev))<br>
-               return 0;<br>
-<br>
         WREG32(adev->vcn.inst[ring->me].external.scratch9, 0xCAFEDEAD);<br>
         r = amdgpu_ring_alloc(ring, 4);<br>
         if (r)<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CEmily.Deng%40amd.com%7Cd5443c0408834299dba308d920df8dcc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637576966819274495%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=URmI6iI7DC5tlOH2ujCKAQ70oxJQUWX6VcAhzjlkrWM%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cmonk.liu%40amd.com%7Cb86e27d9b55f429b352308d9202ee408%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637576208056272141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=cMllN28FN56voTpWwdnMmBB3CGXezs%2FaEwflSZD6qr4%3D&amp;reserved=0</a><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>