dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean@poorly.run>
To: dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	airlied@gmail.com, mripard@kernel.org, robh@kernel.org,
	emil.velikov@collabora.com
Cc: Sean Paul <sean@poorly.run>
Subject: [PATCH 2/2] Revert "drm/panfrost: Use drm_gem_map_offset()"
Date: Wed,  7 Aug 2019 10:52:48 -0400	[thread overview]
Message-ID: <20190807145253.2037-3-sean@poorly.run> (raw)
In-Reply-To: <20190807145253.2037-1-sean@poorly.run>

From: Rob Herring <robh@kernel.org>

This reverts commit 583bbf46133c726bae277e8f4e32bfba2a528c7f.

Turns out we need mmap to work on imported BOs even if the current code
is buggy.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Paul <sean@poorly.run>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index b2e325e270b7..b187daa4da85 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -291,14 +291,26 @@ static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv)
 {
 	struct drm_panfrost_mmap_bo *args = data;
+	struct drm_gem_object *gem_obj;
+	int ret;
 
 	if (args->flags != 0) {
 		DRM_INFO("unknown mmap_bo flags: %d\n", args->flags);
 		return -EINVAL;
 	}
 
-	return drm_gem_map_offset(file_priv, dev, args->handle,
-				       &args->offset);
+	gem_obj = drm_gem_object_lookup(file_priv, args->handle);
+	if (!gem_obj) {
+		DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle);
+		return -ENOENT;
+	}
+
+	ret = drm_gem_create_mmap_offset(gem_obj);
+	if (ret == 0)
+		args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
+	drm_gem_object_put_unlocked(gem_obj);
+
+	return ret;
 }
 
 static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data,
-- 
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-08-07 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 14:52 [PATCH 0/2] drm/panfrost: Revert drm_gem_map_offset changes Sean Paul
2019-08-07 14:52 ` [PATCH 1/2] Revert "drm/gem: Rename drm_gem_dumb_map_offset() to drm_gem_map_offset()" Sean Paul
2019-08-07 21:01   ` Daniel Vetter
2019-08-07 22:33     ` Rob Herring
2019-08-07 14:52 ` Sean Paul [this message]
2019-08-07 15:59   ` [PATCH 2/2] Revert "drm/panfrost: Use drm_gem_map_offset()" Emil Velikov
2019-08-07 20:59     ` Daniel Vetter
2019-08-07 14:54 ` [PATCH 0/2] drm/panfrost: Revert drm_gem_map_offset changes Sean Paul
2019-08-07 16:00 ` Sean Paul

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=20190807145253.2037-3-sean@poorly.run \
    --to=sean@poorly.run \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.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