AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: James Zhu <James.Zhu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 3/3] drm/amd/amdgpu: Add Polaris version check
Date: Thu, 18 Jan 2018 10:49:53 -0500	[thread overview]
Message-ID: <1516290593-6955-3-git-send-email-James.Zhu@amd.com> (raw)
In-Reply-To: <1516290593-6955-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>

Add Polaris version check if firmware support UVD encode

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 319d4b3..e720c4f 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -37,8 +37,12 @@
 #include "gmc/gmc_8_1_d.h"
 #include "vi.h"
 
+/* Polaris10/11/12 firmware version */
+#define FW_1_130_16 ((1 << 24) | (130 << 16) | (16 << 8))
+
 static void uvd_v6_0_set_ring_funcs(struct amdgpu_device *adev);
 static void uvd_v6_0_set_enc_ring_funcs(struct amdgpu_device *adev);
+static void uvd_v6_0_unset_enc_ring_funcs(struct amdgpu_device *adev);
 
 static void uvd_v6_0_set_irq_funcs(struct amdgpu_device *adev);
 static int uvd_v6_0_start(struct amdgpu_device *adev);
@@ -402,6 +406,11 @@ static int uvd_v6_0_sw_init(void *handle)
 	if (r)
 		return r;
 
+	if (adev->uvd.fw_version < FW_1_130_16) {
+		uvd_v6_0_unset_enc_ring_funcs(adev);
+		adev->uvd.num_enc_rings = 0;
+	}
+
 	if (adev->uvd.num_enc_rings) {
 		struct drm_sched_rq *rq;
 
@@ -1640,6 +1649,18 @@ static void uvd_v6_0_set_enc_ring_funcs(struct amdgpu_device *adev)
 	DRM_INFO("UVD ENC is enabled in VM mode\n");
 }
 
+static void uvd_v6_0_unset_enc_ring_funcs(struct amdgpu_device *adev)
+{
+	int i;
+
+	for (i = 0; i < adev->uvd.num_enc_rings; ++i)
+		adev->uvd.ring_enc[i].funcs = NULL;
+
+	adev->uvd.irq.num_types = 1;
+
+	DRM_INFO("UVD ENC is disabled\n");
+}
+
 static const struct amdgpu_irq_src_funcs uvd_v6_0_irq_funcs = {
 	.set = uvd_v6_0_set_interrupt_state,
 	.process = uvd_v6_0_process_interrupt,
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-01-18 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 15:49 [PATCH 1/3] drm/amd/amdgpu: Move UVD TRAP after amdgpu_uvd_sw_init James Zhu
     [not found] ` <1516290593-6955-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-18 15:49   ` [PATCH 2/3] drm/amd/amdgpu: Replace uvd_v6_0_enc_support with uvd.num_enc_rings after uvd_v6_0_early_init James Zhu
2018-01-18 15:49   ` James Zhu [this message]
     [not found]     ` <1516290593-6955-3-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-22 13:57       ` [PATCH 3/3] drm/amd/amdgpu: Add Polaris version check Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516290593-6955-3-git-send-email-James.Zhu@amd.com \
    --to=james.zhu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox