dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse@codeaurora.org>
To: Sharat Masetty <smasetty@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/msm: Use msm_gpu_state_bo for ringbuffer data
Date: Tue, 20 Nov 2018 08:52:47 -0700	[thread overview]
Message-ID: <20181120155247.GF31792@jcrouse-lnx.qualcomm.com> (raw)
In-Reply-To: <1542713851-14375-3-git-send-email-smasetty@codeaurora.org>

On Tue, Nov 20, 2018 at 05:07:30PM +0530, Sharat Masetty wrote:
> The ring substructure in msm_gpu_state is an extension of
> msm_gpu_state_bo, so this patch changes the ring structure
> to reuse the msm_gpu_state_bo as a base class, instead of
> redefining the required variables.
> 
> Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>

Looks okay.  There might be some code consolidation to be had here but perhaps
you've already addressed this in a future patch or we can do it as a rainy day
cleanup.

Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c | 20 +++++++++++---------
>  drivers/gpu/drm/msm/msm_gpu.h           |  4 +---
>  2 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 6ebe842..bbf8d3e 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -383,7 +383,7 @@ int adreno_gpu_state_get(struct msm_gpu *gpu, struct msm_gpu_state *state)
>  		int size = 0, j;
>  
>  		state->ring[i].fence = gpu->rb[i]->memptrs->fence;
> -		state->ring[i].iova = gpu->rb[i]->iova;
> +		state->ring[i].bo.iova = gpu->rb[i]->iova;
>  		state->ring[i].seqno = gpu->rb[i]->seqno;
>  		state->ring[i].rptr = get_rptr(adreno_gpu, gpu->rb[i]);
>  		state->ring[i].wptr = get_wptr(gpu->rb[i]);
> @@ -397,10 +397,12 @@ int adreno_gpu_state_get(struct msm_gpu *gpu, struct msm_gpu_state *state)
>  				size = j + 1;
>  
>  		if (size) {
> -			state->ring[i].data = kvmalloc(size << 2, GFP_KERNEL);
> -			if (state->ring[i].data) {
> -				memcpy(state->ring[i].data, gpu->rb[i]->start, size << 2);
> -				state->ring[i].data_size = size << 2;
> +			state->ring[i].bo.data =
> +				kvmalloc(size << 2, GFP_KERNEL);
> +			if (state->ring[i].bo.data) {
> +				memcpy(state->ring[i].bo.data,
> +						gpu->rb[i]->start, size << 2);
> +				state->ring[i].bo.size = size << 2;

Today I learned there that kvmemdup() does not exist and I was sad about it.

>  			}
>  		}
>  	}
> @@ -440,7 +442,7 @@ void adreno_gpu_state_destroy(struct msm_gpu_state *state)
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(state->ring); i++)
> -		kvfree(state->ring[i].data);
> +		kvfree(state->ring[i].bo.data);
>  
>  	for (i = 0; state->bos && i < state->nr_bos; i++)
>  		kvfree(state->bos[i].data);
> @@ -522,15 +524,15 @@ void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,
>  
>  	for (i = 0; i < gpu->nr_rings; i++) {
>  		drm_printf(p, "  - id: %d\n", i);
> -		drm_printf(p, "    iova: 0x%016llx\n", state->ring[i].iova);
> +		drm_printf(p, "    iova: 0x%016llx\n", state->ring[i].bo.iova);
>  		drm_printf(p, "    last-fence: %d\n", state->ring[i].seqno);
>  		drm_printf(p, "    retired-fence: %d\n", state->ring[i].fence);
>  		drm_printf(p, "    rptr: %d\n", state->ring[i].rptr);
>  		drm_printf(p, "    wptr: %d\n", state->ring[i].wptr);
>  		drm_printf(p, "    size: %d\n", MSM_GPU_RINGBUFFER_SZ);
>  
> -		adreno_show_object(p, state->ring[i].data,
> -			state->ring[i].data_size);
> +		adreno_show_object(p, state->ring[i].bo.data,
> +			state->ring[i].bo.size);
>  	}
>  
>  	if (state->bos) {
> diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
> index 7dc775f..a3a6371 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.h
> +++ b/drivers/gpu/drm/msm/msm_gpu.h
> @@ -198,13 +198,11 @@ struct msm_gpu_state {
>  	struct timeval time;
>  
>  	struct {
> -		u64 iova;
>  		u32 fence;
>  		u32 seqno;
>  		u32 rptr;
>  		u32 wptr;
> -		void *data;
> -		int data_size;
> +		struct msm_gpu_state_bo bo;
>  	} ring[MSM_GPU_MAX_RINGS];
>  
>  	int nr_registers;
> -- 
> 1.9.1
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-11-20 15:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 11:37 [PATCH 1/4] drm/msm: use kvmalloc for ring data in gpu crashstate Sharat Masetty
     [not found] ` <1542713851-14375-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-20 11:37   ` [PATCH 2/4] include/linux/ascii85: Update ascii85_encode() Sharat Masetty
     [not found]     ` <1542713851-14375-2-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-20 15:47       ` Jordan Crouse
2018-11-20 11:37   ` [PATCH 3/4] drm/msm: Use msm_gpu_state_bo for ringbuffer data Sharat Masetty
2018-11-20 15:52     ` Jordan Crouse [this message]
2018-11-20 15:42   ` [PATCH 1/4] drm/msm: use kvmalloc for ring data in gpu crashstate Jordan Crouse
2018-11-20 11:37 ` [PATCH 4/4] drm/msm: Optimize adreno_show_object() Sharat Masetty
     [not found]   ` <1542713851-14375-4-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-20 15:56     ` 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=20181120155247.GF31792@jcrouse-lnx.qualcomm.com \
    --to=jcrouse@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=smasetty@codeaurora.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