diff mbox series

[v2,6/8] drm/etnaviv: split out starting of FE idle loop

Message ID 20190705171727.27501-6-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series [v2,1/8] drm/etnaviv: simplify unbind checks | expand

Commit Message

Lucas Stach July 5, 2019, 5:17 p.m. UTC
Move buffer setup and starting of the FE loop in the kernel ringbuffer
into a separate function. This is a preparation to start the FE later
in the submit process.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

Comments

Philipp Zabel July 29, 2019, 3:36 p.m. UTC | #1
On Fri, 2019-07-05 at 19:17 +0200, Lucas Stach wrote:
> Move buffer setup and starting of the FE loop in the kernel ringbuffer
> into a separate function. This is a preparation to start the FE later
> in the submit process.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index a53fecd17fa9..b46d8207f6e6 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -600,6 +600,20 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
>  	}
>  }
>  
> +static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu)
> +{
> +	u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer, &gpu->cmdbuf_mapping);
> +	u16 prefetch;
> +
> +	/* setup the MMU */
> +	etnaviv_iommu_restore(gpu, gpu->mmu);
> +
> +	/* Start command processor */
> +	prefetch = etnaviv_buffer_init(gpu);
> +
> +	etnaviv_gpu_start_fe(gpu, address, prefetch);
> +}
> +
>  static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
>  {
>  	/*
> @@ -633,8 +647,6 @@ static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
>  
>  static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
>  {
> -	u16 prefetch;
> -
>  	if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) ||
>  	     etnaviv_is_model_rev(gpu, GC320, 0x5220)) &&
>  	    gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) {
> @@ -680,15 +692,9 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
>  	/* setup the pulse eater */
>  	etnaviv_gpu_setup_pulse_eater(gpu);
>  
> -	/* setup the MMU */
> -	etnaviv_iommu_restore(gpu, gpu->mmu);
> -
> -	/* Start command processor */
> -	prefetch = etnaviv_buffer_init(gpu);
> -
>  	gpu_write(gpu, VIVS_HI_INTR_ENBL, ~0U);
> -	etnaviv_gpu_start_fe(gpu, etnaviv_cmdbuf_get_va(&gpu->buffer,
> -			     &gpu->cmdbuf_mapping), prefetch);
> +
> +	etnaviv_gpu_start_fe_idleloop(gpu);
>  }
>  
>  int etnaviv_gpu_init(struct etnaviv_gpu *gpu)

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index a53fecd17fa9..b46d8207f6e6 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -600,6 +600,20 @@  void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
 	}
 }
 
+static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu)
+{
+	u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer, &gpu->cmdbuf_mapping);
+	u16 prefetch;
+
+	/* setup the MMU */
+	etnaviv_iommu_restore(gpu, gpu->mmu);
+
+	/* Start command processor */
+	prefetch = etnaviv_buffer_init(gpu);
+
+	etnaviv_gpu_start_fe(gpu, address, prefetch);
+}
+
 static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
 {
 	/*
@@ -633,8 +647,6 @@  static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
 
 static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
 {
-	u16 prefetch;
-
 	if ((etnaviv_is_model_rev(gpu, GC320, 0x5007) ||
 	     etnaviv_is_model_rev(gpu, GC320, 0x5220)) &&
 	    gpu_read(gpu, VIVS_HI_CHIP_TIME) != 0x2062400) {
@@ -680,15 +692,9 @@  static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
 	/* setup the pulse eater */
 	etnaviv_gpu_setup_pulse_eater(gpu);
 
-	/* setup the MMU */
-	etnaviv_iommu_restore(gpu, gpu->mmu);
-
-	/* Start command processor */
-	prefetch = etnaviv_buffer_init(gpu);
-
 	gpu_write(gpu, VIVS_HI_INTR_ENBL, ~0U);
-	etnaviv_gpu_start_fe(gpu, etnaviv_cmdbuf_get_va(&gpu->buffer,
-			     &gpu->cmdbuf_mapping), prefetch);
+
+	etnaviv_gpu_start_fe_idleloop(gpu);
 }
 
 int etnaviv_gpu_init(struct etnaviv_gpu *gpu)