From: Jordan Crouse <jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Sharat Masetty <smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 02/13] drm/msm: Change msm_gpu_submit() API
Date: Mon, 1 Oct 2018 12:00:07 -0600 [thread overview]
Message-ID: <20181001180007.GA31641@jcrouse-lnx.qualcomm.com> (raw)
In-Reply-To: <1538397105-19581-3-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
On Mon, Oct 01, 2018 at 06:01:34PM +0530, Sharat Masetty wrote:
> When the scheduler comes into picture, the msm_gpu_submit() will be
> called from the scheduler worker thread. So save the necessary information
> into msm job structure for use at the actual GPU submission time. This
> also simplifies the msm_gpu_submit() API.
When I read this, I immediately thought you were changing the format of the
submit ioctl struct, but really you are just changing the parameters of the
functions - this isn't an API by definition because it isn't an interface
to anything else. Words like API get people all worked up - I would recommend
rewording this to be less scary / more accurate.
> Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
> ---
> drivers/gpu/drm/msm/msm_gem.h | 1 +
> drivers/gpu/drm/msm/msm_gem_submit.c | 8 +++++---
> drivers/gpu/drm/msm/msm_gpu.c | 8 ++++----
> drivers/gpu/drm/msm/msm_gpu.h | 3 +--
> 4 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
> index 287f974..289abe5 100644
> --- a/drivers/gpu/drm/msm/msm_gem.h
> +++ b/drivers/gpu/drm/msm/msm_gem.h
> @@ -137,6 +137,7 @@ enum msm_gem_lock {
> */
> struct msm_gem_submit {
> struct drm_device *dev;
> + struct msm_file_private *ctx;
> struct msm_gpu *gpu;
> struct list_head node; /* node in ring submit list */
> struct list_head bo_list;
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index 00e6347..14906b9 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -32,7 +32,7 @@
>
> static struct msm_gem_submit *submit_create(struct drm_device *dev,
> struct msm_gpu *gpu, struct msm_gpu_submitqueue *queue,
> - uint32_t nr_bos, uint32_t nr_cmds)
> + uint32_t nr_bos, uint32_t nr_cmds, struct msm_file_private *ctx)
submit_create() is a catch-22. If I saw all that code inline I would probably
want it to be a sub function too, but on the other hand we're steadily adding
new parameters to it and adding new lines of code that the calling function
doesn't need to translate.
> {
> struct msm_gem_submit *submit;
> uint64_t sz = sizeof(*submit) + ((u64)nr_bos * sizeof(submit->bos[0])) +
> @@ -47,6 +47,7 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev,
>
> submit->dev = dev;
> submit->gpu = gpu;
> + submit->ctx = ctx;
> submit->fence = NULL;
> submit->out_fence_id = -1;
> submit->pid = get_pid(task_pid(current));
> @@ -474,7 +475,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
> }
> }
>
> - submit = submit_create(dev, gpu, queue, args->nr_bos, args->nr_cmds);
> + submit = submit_create(dev, gpu, queue, args->nr_bos,
> + args->nr_cmds, ctx);
Like maybe we can compromise and pass in args directly to submit_create to help
offset the new parameters.
> if (!submit) {
> ret = -ENOMEM;
> goto out_unlock;
> @@ -560,7 +562,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>
> submit->nr_cmds = i;
>
> - msm_gpu_submit(gpu, submit, ctx);
> + msm_gpu_submit(submit);
> if (IS_ERR(submit->fence)) {
> ret = PTR_ERR(submit->fence);
> submit->fence = NULL;
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index eb67172..5f9cd85 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -602,9 +602,9 @@ void msm_gpu_retire(struct msm_gpu *gpu)
> }
>
> /* add bo's to gpu's ring, and kick gpu: */
> -struct dma_fence *msm_gpu_submit(struct msm_gpu *gpu,
> - struct msm_gem_submit *submit, struct msm_file_private *ctx)
> +struct dma_fence *msm_gpu_submit(struct msm_gem_submit *submit)
> {
> + struct msm_gpu *gpu = submit->gpu;
> struct drm_device *dev = gpu->dev;
> struct msm_drm_private *priv = dev->dev_private;
> struct msm_ringbuffer *ring = submit->ring;
> @@ -648,8 +648,8 @@ struct dma_fence *msm_gpu_submit(struct msm_gpu *gpu,
> msm_gem_move_to_active(&msm_obj->base, gpu, false, submit->fence);
> }
>
> - gpu->funcs->submit(gpu, submit, ctx);
> - priv->lastctx = ctx;
> + gpu->funcs->submit(gpu, submit, submit->ctx);
> + priv->lastctx = submit->ctx;
>
> hangcheck_timer_reset(gpu);
>
> diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
> index b562b25..dd55979 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.h
> +++ b/drivers/gpu/drm/msm/msm_gpu.h
> @@ -235,8 +235,7 @@ int msm_gpu_perfcntr_sample(struct msm_gpu *gpu, uint32_t *activetime,
> uint32_t *totaltime, uint32_t ncntrs, uint32_t *cntrs);
>
> void msm_gpu_retire(struct msm_gpu *gpu);
> -struct dma_fence *msm_gpu_submit(struct msm_gpu *gpu,
> - struct msm_gem_submit *submit, struct msm_file_private *ctx);
> +struct dma_fence *msm_gpu_submit(struct msm_gem_submit *submit);
>
> int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
> struct msm_gpu *gpu, const struct msm_gpu_funcs *funcs,
> --
> 1.9.1
>
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
next prev parent reply other threads:[~2018-10-01 18:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 12:31 [PATCH 00/13] drm/msm: Hook up the DRM gpu scheduler Sharat Masetty
[not found] ` <1538397105-19581-1-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-01 12:31 ` [PATCH 01/13] drm/msm: Track GPU fences with idr Sharat Masetty
[not found] ` <1538397105-19581-2-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-01 19:03 ` Jordan Crouse
[not found] ` <20181001190333.GE31641-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org>
2018-10-01 21:49 ` Rob Clark
2018-10-01 12:31 ` [PATCH 02/13] drm/msm: Change msm_gpu_submit() API Sharat Masetty
[not found] ` <1538397105-19581-3-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-01 18:00 ` Jordan Crouse [this message]
2018-10-01 12:31 ` [PATCH 03/13] drm/msm: Save the ring name in the ring structure Sharat Masetty
[not found] ` <1538397105-19581-4-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-01 18:01 ` Jordan Crouse
2018-10-01 12:31 ` [PATCH 04/13] drm/msm: Change the name of the fence to hw_fence Sharat Masetty
2018-10-01 12:31 ` [PATCH 05/13] drm/msm: rearrange submit buffer objects clean up Sharat Masetty
2018-10-01 12:31 ` [PATCH 06/13] drm/msm: Use kzalloc for submit struct allocation Sharat Masetty
[not found] ` <1538397105-19581-7-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-01 18:13 ` Jordan Crouse
2018-10-03 10:50 ` [Freedreno] " Sharat Masetty
2018-10-01 12:31 ` [PATCH 07/13] drm/msm: Fix leak in submitqueue create Sharat Masetty
2018-10-01 12:31 ` [PATCH 08/13] drm/scheduler: set sched->thread to NULL in failure Sharat Masetty
2018-10-01 12:31 ` [PATCH 09/13] drm/msm: Use the DRM common Scheduler Sharat Masetty
[not found] ` <1538397105-19581-10-git-send-email-smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-01 19:02 ` Jordan Crouse
2018-10-03 10:43 ` Sharat Masetty
2018-10-01 12:31 ` [PATCH 10/13] msm/drm: Remove unused code Sharat Masetty
2018-10-01 12:31 ` [PATCH 11/13] drm/scheduler: Add a timeout_start_notify function op Sharat Masetty
2018-10-01 12:31 ` [PATCH 12/13] jiffies: add utility function to calculate delta in ms Sharat Masetty
2018-10-01 12:31 ` [PATCH 13/13] drm/msm: Implement better timeout detection Sharat Masetty
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=20181001180007.GA31641@jcrouse-lnx.qualcomm.com \
--to=jcrouse-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=smasetty-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.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