linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: dri-devel@lists.freedesktop.org
Cc: "Heiko Stübner" <heiko@sntech.de>,
	"Neil Armstrong" <narmstrong@baylibre.com>,
	"David Airlie" <airlied@linux.ie>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
	"Yannick Fertre" <yannick.fertre@st.com>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Xinwei Kong" <kong.kongxinwei@hisilicon.com>,
	"Xinliang Liu" <z.liuxinliang@hisilicon.com>,
	linux-rockchip@lists.infradead.org,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"James (Qian) Wang" <james.qian.wang@arm.com>,
	"CK Hu" <ck.hu@mediatek.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Alexandre Torgue" <alexandre.torgue@st.com>,
	"Chen Feng" <puck.chen@hisilicon.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	linux-mediatek@lists.infradead.org,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>, "Sean Paul" <sean@poorly.run>,
	linux-arm-kernel@lists.infradead.org,
	"Philippe Cornu" <philippe.cornu@st.com>,
	"Vincent Abriou" <vincent.abriou@st.com>,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Rongrong Zou" <zourongrong@gmail.com>
Subject: [PATCH 2/6] drm: Introduce DRM_MODE_DUMB_KERNEL_MAP flag
Date: Mon, 21 Oct 2019 16:45:46 -0500	[thread overview]
Message-ID: <20191021214550.1461-3-robh@kernel.org> (raw)
In-Reply-To: <20191021214550.1461-1-robh@kernel.org>

Introduce a new flag, DRM_MODE_DUMB_KERNEL_MAP, for struct
drm_mode_create_dumb. This flag is for internal kernel use to indicate
if dumb buffer allocation needs a kernel mapping. This is needed only for
CMA where creating a kernel mapping or not has to be decided at allocation
time because creating a mapping on demand (with vmap()) is not guaranteed
to work. Several drivers are using CMA, but not the CMA helpers because
they distinguish between kernel and userspace allocations to create a
kernel mapping or not.

Update the callers of drm_mode_dumb_create() to set
drm_mode_dumb_create.flags to appropriate defaults. Currently, flags can
be set to anything by userspace, but is unused within the kernel. Let's
force flags to zero (no kernel mapping) for userspace callers by default.
For in kernel clients, set DRM_MODE_DUMB_KERNEL_MAP by default. Drivers
can override this as needed.

Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Sean Paul <sean@poorly.run>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/gpu/drm/drm_client.c       | 1 +
 drivers/gpu/drm/drm_dumb_buffers.c | 5 ++++-
 include/uapi/drm/drm_mode.h        | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index d9a2e3695525..dbfc8061b392 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -264,6 +264,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
 	dumb_args.width = width;
 	dumb_args.height = height;
 	dumb_args.bpp = info->cpp[0] * 8;
+	dumb_args.flags = DRM_MODE_DUMB_KERNEL_MAP;
 	ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
 	if (ret)
 		goto err_delete;
diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
index d18a740fe0f1..74a13f14c173 100644
--- a/drivers/gpu/drm/drm_dumb_buffers.c
+++ b/drivers/gpu/drm/drm_dumb_buffers.c
@@ -97,7 +97,10 @@ int drm_mode_create_dumb(struct drm_device *dev,
 int drm_mode_create_dumb_ioctl(struct drm_device *dev,
 			       void *data, struct drm_file *file_priv)
 {
-	return drm_mode_create_dumb(dev, data, file_priv);
+	struct drm_mode_create_dumb *args = data;
+
+	args->flags = 0;
+	return drm_mode_create_dumb(dev, args, file_priv);
 }
 
 /**
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 735c8cfdaaa1..02712f46b94c 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -796,6 +796,8 @@ struct drm_mode_crtc_page_flip_target {
 	__u64 user_data;
 };
 
+#define DRM_MODE_DUMB_KERNEL_MAP	(1<<0)	/* For internal kernel use */
+
 /* create a dumb scanout buffer */
 struct drm_mode_create_dumb {
 	__u32 height;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-10-21 21:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 21:45 [PATCH 0/6] drm: Support CMA per allocation kernel mappings Rob Herring
2019-10-21 21:45 ` [PATCH 1/6] drm/kirin: Use DRM_GEM_CMA_VMAP_DRIVER_OPS Rob Herring
2019-10-21 21:45 ` Rob Herring [this message]
2019-10-22 11:14   ` [PATCH 2/6] drm: Introduce DRM_MODE_DUMB_KERNEL_MAP flag Laurent Pinchart
2019-10-22 12:42     ` Rob Herring
2019-10-23 14:28       ` Laurent Pinchart
2019-10-23 17:03         ` Rob Herring
2019-10-21 21:45 ` [PATCH 3/6] drm/cma-helper: Use the dma_*_attr API variant Rob Herring
2019-10-22  1:01   ` kbuild test robot
2019-10-22 11:18   ` Laurent Pinchart
2019-10-21 21:45 ` [PATCH 4/6] drm/cma-helper: Support DRM_MODE_DUMB_KERNEL_MAP flag Rob Herring
2019-10-22  6:13   ` james qian wang (Arm Technology China)
2019-10-22  7:50   ` Neil Armstrong
2019-10-22 11:30   ` Laurent Pinchart
2019-10-22 11:40     ` Geert Uytterhoeven
2019-10-22 19:52       ` Rob Herring
2019-10-22 20:02     ` Rob Herring
2019-10-23 14:27       ` Laurent Pinchart
2019-10-21 21:45 ` [PATCH 5/6] drm/mediatek: Convert to use CMA helpers Rob Herring
2019-10-22 17:07   ` Matthias Brugger
2019-10-23 17:42     ` Rob Herring
2019-10-23 21:06       ` CK Hu
2019-10-23 22:56         ` Rob Herring
2019-10-24  7:02           ` CK Hu
2019-12-17  1:12             ` Laurent Pinchart
2019-10-21 21:45 ` [PATCH 6/6] drm/rockchip: Convert to use generic fbdev emulation Rob Herring

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=20191021214550.1461-3-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@st.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=james.qian.wang@arm.com \
    --cc=khilman@baylibre.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mripard@kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=noralf@tronnes.org \
    --cc=p.zabel@pengutronix.de \
    --cc=philippe.cornu@st.com \
    --cc=puck.chen@hisilicon.com \
    --cc=sean@poorly.run \
    --cc=vincent.abriou@st.com \
    --cc=wens@csie.org \
    --cc=yannick.fertre@st.com \
    --cc=z.liuxinliang@hisilicon.com \
    --cc=zourongrong@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).