diff mbox series

drm/etnaviv: always allocate 4K for kernel ringbuffers

Message ID 20241025151417.2475966-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/etnaviv: always allocate 4K for kernel ringbuffers | expand

Commit Message

Lucas Stach Oct. 25, 2024, 3:14 p.m. UTC
Since the kernel ringbuffers are allocated from a larger suballocated
area, same as the user commandbufs, they don't need to be CPU page
sized. Allocate 4KB for the kernel ring buffers, as we never use more
than that.

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

Comments

Christian Gmeiner Oct. 26, 2024, 7:06 a.m. UTC | #1
Am Fr., 25. Okt. 2024 um 17:14 Uhr schrieb Lucas Stach <l.stach@pengutronix.de>:
>
> Since the kernel ringbuffers are allocated from a larger suballocated
> area, same as the user commandbufs, they don't need to be CPU page
> sized. Allocate 4KB for the kernel ring buffers, as we never use more
> than that.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 7c7f97793ddd..7b39786871b3 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -848,8 +848,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>                 priv->shm_gfp_mask |= GFP_DMA32;
>
>         /* Create buffer: */
> -       ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer,
> -                                 PAGE_SIZE);
> +       ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer, SZ_4K);
>         if (ret) {
>                 dev_err(gpu->dev, "could not create command buffer\n");
>                 goto fail;
> --
> 2.39.5
>
Sui Jingfeng Oct. 27, 2024, 3:59 a.m. UTC | #2
Hi,


On 10/25/24 23:14, Lucas Stach wrote:
> Since the kernel ringbuffers are allocated from a larger suballocated
> area, same as the user commandbufs, they don't need to be CPU page
> sized. Allocate 4KB for the kernel ring buffers, as we never use more
> than that.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>

Tested-by: Sui Jingfeng <sui.jingfeng@linux.dev>


Tested with on a 16 KiB system, it works fine as before.

I notices that most test samples of glmark2 consumes only one page,
only a few of them consumes more than one page command buffer, can
up to 20 KiB.

> ---
>   drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 7c7f97793ddd..7b39786871b3 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -848,8 +848,7 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
>   		priv->shm_gfp_mask |= GFP_DMA32;
>   
>   	/* Create buffer: */
> -	ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer,
> -				  PAGE_SIZE);
> +	ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer, SZ_4K);
>   	if (ret) {
>   		dev_err(gpu->dev, "could not create command buffer\n");
>   		goto fail;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 7c7f97793ddd..7b39786871b3 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -848,8 +848,7 @@  int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
 		priv->shm_gfp_mask |= GFP_DMA32;
 
 	/* Create buffer: */
-	ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer,
-				  PAGE_SIZE);
+	ret = etnaviv_cmdbuf_init(priv->cmdbuf_suballoc, &gpu->buffer, SZ_4K);
 	if (ret) {
 		dev_err(gpu->dev, "could not create command buffer\n");
 		goto fail;