From: Yannick Fertre <yannick.fertre@st.com>
To: Alexandre TORGUE <alexandre.torgue@st.com>,
Thierry Reding <thierry.reding@gmail.com>,
David Airlie <airlied@linux.ie>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Benjamin Gaignard <benjamin.gaignard@st.com>,
Yannick Fertre <yannick.fertre@st.com>
Cc: devicetree@vger.kernel.org, kernel@stlinux.com,
Philippe Cornu <philippe.cornu@st.com>,
Fabien Dessenne <fabien.dessenne@st.com>,
dri-devel@lists.freedesktop.org,
Mickael Reulier <mickael.reulier@st.com>,
Vincent Abriou <vincent.abriou@st.com>,
Gabriel FERNANDEZ <gabriel.fernandez@st.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 2/9] drm/fb-cma-helper: Add drm_fb_cma_get_gem_addr()
Date: Fri, 14 Apr 2017 12:13:32 +0200 [thread overview]
Message-ID: <1492164819-10513-3-git-send-email-yannick.fertre@st.com> (raw)
In-Reply-To: <1492164819-10513-1-git-send-email-yannick.fertre@st.com>
Add function drm_fb_cma_get_gem_addr() which return the physical address
of framebuffer (1st pixel). This function will usually be called by plane
callback (atomic_update).
Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
---
drivers/gpu/drm/drm_fb_cma_helper.c | 27 +++++++++++++++++++++++++++
include/drm/drm_fb_cma_helper.h | 4 ++++
2 files changed, 31 insertions(+)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 50abd1f..d2b77b0 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -260,6 +260,33 @@ struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_obj);
/**
+ * drm_fb_cma_get_gem_addr() - Get physical address for framebuffer
+ * @fb: The framebuffer
+ * @state: Which state of drm plane
+ * @plane: Which plane
+ * Return the CMA GEM address for given framebuffer.
+ *
+ * This function will usually be called from the PLANE callback functions.
+ */
+dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,
+ struct drm_plane_state *state,
+ unsigned int plane)
+{
+ struct drm_fb_cma *fb_cma = to_fb_cma(fb);
+ dma_addr_t paddr;
+
+ if (plane >= 4)
+ return 0;
+
+ paddr = fb_cma->obj[plane]->paddr + fb->offsets[plane];
+ paddr += fb->format->cpp[plane] * (state->src_x >> 16);
+ paddr += fb->pitches[plane] * (state->src_y >> 16);
+
+ return paddr;
+}
+EXPORT_SYMBOL_GPL(drm_fb_cma_get_gem_addr);
+
+/**
* drm_fb_cma_prepare_fb() - Prepare CMA framebuffer
* @plane: Which plane
* @state: Plane state attach fence to
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index a5ecc0a..199a63f 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -41,6 +41,10 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
unsigned int plane);
+dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,
+ struct drm_plane_state *state,
+ unsigned int plane);
+
int drm_fb_cma_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-04-14 10:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-14 10:13 [PATCH v7 0/9] STM32 LCD-TFT display controller Yannick Fertre
2017-04-14 10:13 ` [PATCH v7 1/9] drm/cma: Update DEFINE_DRM_GEM_CMA_FOPS to add get_unmapped_area Yannick Fertre
[not found] ` <1492164819-10513-2-git-send-email-yannick.fertre-qxv4g6HH51o@public.gmane.org>
2017-04-14 12:49 ` Neil Armstrong
2017-04-14 10:13 ` Yannick Fertre [this message]
[not found] ` <1492164819-10513-3-git-send-email-yannick.fertre-qxv4g6HH51o@public.gmane.org>
2017-04-14 12:54 ` [PATCH v7 2/9] drm/fb-cma-helper: Add drm_fb_cma_get_gem_addr() Neil Armstrong
2017-04-14 10:13 ` [PATCH v7 3/9] dt-bindings: display: Add STM32 LTDC driver Yannick Fertre
2017-04-14 10:13 ` [PATCH v7 4/9] drm/stm: " Yannick Fertre
2017-04-14 12:59 ` Neil Armstrong
[not found] ` <1492164819-10513-5-git-send-email-yannick.fertre-qxv4g6HH51o@public.gmane.org>
2017-04-14 18:38 ` Eric Anholt
2017-04-14 10:13 ` [PATCH v7 5/9] MAINTAINERS: add maintainers for DRM STM driver Yannick Fertre
[not found] ` <1492164819-10513-6-git-send-email-yannick.fertre-qxv4g6HH51o@public.gmane.org>
2017-04-14 12:59 ` Neil Armstrong
2017-04-14 10:13 ` [PATCH v7 6/9] ARM: dts: stm32: Add ltdc support on stm32f429 MCU Yannick Fertre
2017-04-14 10:13 ` [PATCH v7 7/9] ARM: dts: stm32: Enable ltdc & simple panel on stm32f429-Eval board Yannick Fertre
2017-04-14 10:13 ` [PATCH v7 8/9] ARM: configs: stm32: Add DRM support in STM32 defconfig Yannick Fertre
2017-04-14 10:13 ` [PATCH v7 9/9] ARM: configs: stm32: Add simple panel " Yannick Fertre
2017-06-12 12:00 ` [PATCH v7 0/9] STM32 LCD-TFT display controller Alexandre Torgue
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=1492164819-10513-3-git-send-email-yannick.fertre@st.com \
--to=yannick.fertre@st.com \
--cc=airlied@linux.ie \
--cc=alexandre.torgue@st.com \
--cc=arnd@arndb.de \
--cc=benjamin.gaignard@st.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=fabien.dessenne@st.com \
--cc=gabriel.fernandez@st.com \
--cc=kernel@stlinux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mickael.reulier@st.com \
--cc=philippe.cornu@st.com \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=vincent.abriou@st.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).