dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm: fix handling of cmdstream offset
@ 2018-10-15 17:33 Rob Clark
  2018-10-16 20:09 ` [Freedreno] " Kristian Høgsberg
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Clark @ 2018-10-15 17:33 UTC (permalink / raw)
  To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Rob Clark,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Userspace hasn't used submit cmds with submit_offset != 0 for a while,
but this starts cropping up again with cmdstream sub-buffer-allocation
in libdrm_freedreno.

Doesn't do much good to increment the buf ptr before assigning it.

Fixes: 78b8e5b847b4 drm/msm: dump a rd GPUADDR header for all buffers in the command
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 drivers/gpu/drm/msm/msm_rd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
index cca933458439..0c2c8d2c631f 100644
--- a/drivers/gpu/drm/msm/msm_rd.c
+++ b/drivers/gpu/drm/msm/msm_rd.c
@@ -316,10 +316,11 @@ static void snapshot_buf(struct msm_rd_state *rd,
 		uint64_t iova, uint32_t size)
 {
 	struct msm_gem_object *obj = submit->bos[idx].obj;
+	unsigned offset = 0;
 	const char *buf;
 
 	if (iova) {
-		buf += iova - submit->bos[idx].iova;
+		offset = iova - submit->bos[idx].iova;
 	} else {
 		iova = submit->bos[idx].iova;
 		size = obj->base.size;
@@ -340,6 +341,8 @@ static void snapshot_buf(struct msm_rd_state *rd,
 	if (IS_ERR(buf))
 		return;
 
+	buf += offset;
+
 	rd_write_section(rd, RD_BUFFER_CONTENTS, buf, size);
 
 	msm_gem_put_vaddr(&obj->base);
-- 
2.17.2

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Freedreno] [PATCH] drm/msm: fix handling of cmdstream offset
  2018-10-15 17:33 [PATCH] drm/msm: fix handling of cmdstream offset Rob Clark
@ 2018-10-16 20:09 ` Kristian Høgsberg
  0 siblings, 0 replies; 2+ messages in thread
From: Kristian Høgsberg @ 2018-10-16 20:09 UTC (permalink / raw)
  To: Clark, Rob; +Cc: linux-arm-msm, freedreno, dri-devel

On Mon, Oct 15, 2018 at 10:33 AM Rob Clark <robdclark@gmail.com> wrote:
>
> Userspace hasn't used submit cmds with submit_offset != 0 for a while,
> but this starts cropping up again with cmdstream sub-buffer-allocation
> in libdrm_freedreno.
>
> Doesn't do much good to increment the buf ptr before assigning it.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>

> Fixes: 78b8e5b847b4 drm/msm: dump a rd GPUADDR header for all buffers in the command
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
>  drivers/gpu/drm/msm/msm_rd.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
> index cca933458439..0c2c8d2c631f 100644
> --- a/drivers/gpu/drm/msm/msm_rd.c
> +++ b/drivers/gpu/drm/msm/msm_rd.c
> @@ -316,10 +316,11 @@ static void snapshot_buf(struct msm_rd_state *rd,
>                 uint64_t iova, uint32_t size)
>  {
>         struct msm_gem_object *obj = submit->bos[idx].obj;
> +       unsigned offset = 0;
>         const char *buf;
>
>         if (iova) {
> -               buf += iova - submit->bos[idx].iova;
> +               offset = iova - submit->bos[idx].iova;
>         } else {
>                 iova = submit->bos[idx].iova;
>                 size = obj->base.size;
> @@ -340,6 +341,8 @@ static void snapshot_buf(struct msm_rd_state *rd,
>         if (IS_ERR(buf))
>                 return;
>
> +       buf += offset;
> +
>         rd_write_section(rd, RD_BUFFER_CONTENTS, buf, size);
>
>         msm_gem_put_vaddr(&obj->base);
> --
> 2.17.2
>
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-16 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-15 17:33 [PATCH] drm/msm: fix handling of cmdstream offset Rob Clark
2018-10-16 20:09 ` [Freedreno] " Kristian Høgsberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox