From: Jordan Crouse <jcrouse@codeaurora.org>
To: freedreno@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org
Subject: [PATCH 6/9] drm/msm: Make the value of RB_CNTL (almost) generic
Date: Fri, 20 Oct 2017 11:07:00 -0600 [thread overview]
Message-ID: <1508519223-10631-7-git-send-email-jcrouse@codeaurora.org> (raw)
In-Reply-To: <1508519223-10631-1-git-send-email-jcrouse@codeaurora.org>
We use a global ringbuffer size and block size for all targets and
at least for 5XX preemption we need to know the value the RB_CNTL
in several locations so it makes sense to calculate it once and use
it everywhere.
The only monkey wrench is that we need to disable the RPTR shadow
for A430 targets but that only needs to be done once and doesn't
affect A5XX so we can or in the value at init time.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 12 +++++++-----
drivers/gpu/drm/msm/msm_gpu.h | 5 +++++
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 77eaa46..72f1132 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -21,7 +21,6 @@
#include "msm_gem.h"
#include "msm_mmu.h"
-#define RB_BLKSIZE 32
int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value)
{
@@ -96,11 +95,14 @@ int adreno_hw_init(struct msm_gpu *gpu)
ring->memptrs->rptr = 0;
}
- /* Setup REG_CP_RB_CNTL: */
+ /*
+ * Setup REG_CP_RB_CNTL. The same value is used across targets (with
+ * the excpetion of A430 that disables the RPTR shadow) - the cacluation
+ * for the ringbuffer size and block size is moved to msm_gpu.h for the
+ * pre-processor to deal with and the A430 variant is ORed in here
+ */
adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL,
- /* size is log2(quad-words): */
- AXXX_CP_RB_CNTL_BUFSZ(ilog2(MSM_GPU_RINGBUFFER_SZ / 8)) |
- AXXX_CP_RB_CNTL_BLKSZ(ilog2(RB_BLKSIZE / 8)) |
+ MSM_GPU_RB_CNTL_DEFAULT |
(adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0));
/* Setup ringbuffer address - use ringbuffer[0] for GPU init */
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 1be0317..e113d64 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -129,6 +129,11 @@ struct msm_gpu {
/* It turns out that all targets use the same ringbuffer size */
#define MSM_GPU_RINGBUFFER_SZ SZ_32K
+#define MSM_GPU_RINGBUFFER_BLKSIZE 32
+
+#define MSM_GPU_RB_CNTL_DEFAULT \
+ (AXXX_CP_RB_CNTL_BUFSZ(ilog2(MSM_GPU_RINGBUFFER_SZ / 8)) | \
+ AXXX_CP_RB_CNTL_BLKSZ(ilog2(MSM_GPU_RINGBUFFER_BLKSIZE / 8)))
static inline bool msm_gpu_active(struct msm_gpu *gpu)
{
--
1.9.1
next prev parent reply other threads:[~2017-10-20 17:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 17:06 [PATCH v2 0/9] drm/msm for 4.15 (resend) Jordan Crouse
2017-10-20 17:06 ` [PATCH 1/9] drm/msm: Add per-instance submit queues Jordan Crouse
2017-10-20 17:06 ` [PATCH 2/9] drm/msm: Move memptrs to msm_gpu Jordan Crouse
2017-10-20 17:06 ` [PATCH 4/9] drm/msm: Add a parameter query for the number of ringbuffers Jordan Crouse
[not found] ` <1508519223-10631-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-10-20 17:06 ` [PATCH 3/9] drm/msm: Support multiple ringbuffers Jordan Crouse
2017-10-20 17:06 ` [PATCH 5/9] drm/msm: Shadow current pointer in the ring until command is complete Jordan Crouse
2017-10-20 17:07 ` [PATCH 8/9] drm/msm: Removed unused struct_mutex_task Jordan Crouse
2017-10-20 17:07 ` [PATCH 9/9] drm/msm: dump a rd GPUADDR header for all buffers in the command Jordan Crouse
2017-10-20 17:07 ` Jordan Crouse [this message]
2017-10-20 17:07 ` [PATCH 7/9] drm/msm: Implement preemption for A5XX targets Jordan Crouse
-- strict thread matches above, loose matches on Subject: below --
2017-10-11 15:14 [PATCH v2 0/9] drm/msm for 4.15 Jordan Crouse
2017-10-11 15:14 ` [PATCH 6/9] drm/msm: Make the value of RB_CNTL (almost) generic Jordan Crouse
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=1508519223-10631-7-git-send-email-jcrouse@codeaurora.org \
--to=jcrouse@codeaurora.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).