dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Wladimir J. van der Laan" <laanwj@gmail.com>
To: dri-devel@lists.freedesktop.org, etnaviv@lists.freedesktop.org
Cc: Chris Healy <cphealy@gmail.com>
Subject: [PATCH] drm/etnaviv: Set up initial PULSE_EATER register
Date: Wed, 14 Dec 2016 09:39:42 +0100	[thread overview]
Message-ID: <20161214083942.GA9328@amethyst.visucore.com> (raw)

Set up the PULSE_EATER register (0x0010C) in etnaviv_gpu_hw_init. This
ports three mostly undocumented model/revision-specific register
overrides from the Vivante kernel driver.

This is relevant as at least the "disable internal DFS" for revisions >
0x5420 has shown to have a huge impact on shader performance (sped up
memory read performance by 7.5x and write performance by 1.5x) on an
affected GPU.
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 1e0ec81..e1a9d64 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -548,6 +548,9 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
 		  VIVS_FE_COMMAND_CONTROL_PREFETCH(prefetch));
 }
 
+/* base value for VIVS_PM_PULSE_EATER register on models where it cannot be read */
+#define PULSE_EATER_BASE_VALUE (0x01590880)
+
 static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
 {
 	u16 prefetch;
@@ -588,6 +591,33 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
 		gpu_write(gpu, VIVS_MC_BUS_CONFIG, bus_config);
 	}
 
+	/* set up the pulse eater */
+	if (etnaviv_is_model_rev(gpu, GC4000, 0x5208) ||
+	    etnaviv_is_model_rev(gpu, GC4000, 0x5222)) {
+		/* undocumented workaround from vivante kernel driver */
+		u32 pulse_eater = PULSE_EATER_BASE_VALUE;
+		pulse_eater |= BIT(23);
+		gpu_write(gpu, VIVS_PM_PULSE_EATER, pulse_eater);
+	}
+
+	if (etnaviv_is_model_rev(gpu, GC1000, 0x5039) ||
+	    etnaviv_is_model_rev(gpu, GC1000, 0x5040)) {
+		/* undocumented workaround from vivante kernel driver */
+		u32 pulse_eater = PULSE_EATER_BASE_VALUE;
+		pulse_eater &= ~BIT(16);
+		pulse_eater |= BIT(17);
+		gpu_write(gpu, VIVS_PM_PULSE_EATER, pulse_eater);
+	}
+
+	if ((gpu->identity.revision > 0x5420) &&
+            (gpu->identity.features & chipFeatures_PIPE_3D))
+	{
+		/* disable internal DFS: this is extremely important to performance */
+		u32 pulse_eater = gpu_read(gpu, VIVS_PM_PULSE_EATER);
+		pulse_eater |= BIT(18);
+		gpu_write(gpu, VIVS_PM_PULSE_EATER, pulse_eater);
+	}
+
 	/* setup the MMU */
 	etnaviv_iommu_restore(gpu);
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-12-14  8:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14  8:39 Wladimir J. van der Laan [this message]
2016-12-15 11:30 ` [PATCH] drm/etnaviv: Set up initial PULSE_EATER register Lucas Stach

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=20161214083942.GA9328@amethyst.visucore.com \
    --to=laanwj@gmail.com \
    --cc=cphealy@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.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).