Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1510603
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Gustavo Padovan <gustavo@padovan.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v6 1/6] drm/atomic: add drm_atomic_set_fence_for_plane() |
| Date | Thu, 27 Oct 2016 21:40:02 +0200 |
| Message-ID | <swYGS-66s-17@gated-at.bofh.it> (permalink) |
| References | <swYGR-66s-9@gated-at.bofh.it> |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XkeIipq0uRR9gwSEyoGhNso6g2TxXaNiXUWXdsSc6EA=; b=Xbgq+civUXjCXSJA990M8TXI1mP+vJg/AcB9nePtAfYmwX8Ib6wegKZlCgcSYCFoUq RwVV699yld3iS0aaugTn1dJe1Wmc8XoA80Lsb6hQ5pGhqBBKEzqTnr2HWlUmVp8qfldk amD928rHEZhsIecUd5bff+gwBcmf9P7HpRcWs6HvNsXohPEZuKTHM6/GIer+mDq+SSe5 Tb9akDIekWPzZ7fnNtyWtaXVrrU2S8g1KdVcNwcPuKuRodgqgkdoivco1SJImk4gHD01 EAocb6tFdd05ORpb+3WEKsyuPhoRNLfOsIjXS0d6AIc6GLqy3bn+c1eACHsVYkCvjDgW Iz1w== |
| X-Gm-Message-State | ABUngvcf4CsfN7A03MH/542ZrRBLHHS8TfcpPcY9hl1EhpeVSUsq8VOmY3d0MSY+Z8Bglg== |
| X-Received | by 10.129.95.8 with SMTP id t8mr8707607ywb.177.1477597048699; Thu, 27 Oct 2016 12:37:28 -0700 (PDT) |
| X-Mailer | git-send-email 2.5.5 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 82 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, Daniel Stone <daniels@collabora.com>, Daniel Vetter <daniel.vetter@ffwll.ch>, Rob Clark <robdclark@gmail.com>, Greg Hackmann <ghackmann@google.com>, John Harrison <John.C.Harrison@Intel.com>, laurent.pinchart@ideasonboard.com, seanpaul@google.com, marcheu@google.com, m.chehab@samsung.com, Sumit Semwal <sumit.semwal@linaro.org>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Brian Starkey <brian.starkey@arm.com>, Gustavo Padovan <gustavo.padovan@collabora.co.uk> |
| X-Original-Date | Thu, 27 Oct 2016 17:37:06 -0200 |
| X-Original-Message-ID | <1477597031-5139-2-git-send-email-gustavo@padovan.org> |
| X-Original-References | <1477597031-5139-1-git-send-email-gustavo@padovan.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1510603 |
Show key headers only | View raw
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
This new function should be used by drivers when setting a implicit
fence for the plane. It abstracts the fact that the user might have
chosen explicit fencing instead.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
drivers/gpu/drm/drm_atomic.c | 30 ++++++++++++++++++++++++++++++
include/drm/drm_atomic.h | 2 ++
include/drm/drm_plane.h | 2 +-
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index c32fb3c..5e73954 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1147,6 +1147,36 @@ drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
/**
+ * drm_atomic_set_fence_for_plane - set fence for plane
+ * @plane_state: atomic state object for the plane
+ * @fence: dma_fence to use for the plane
+ *
+ * Helper to setup the plane_state fence in case it is not set yet.
+ * By using this drivers doesn't need to worry if the user choose
+ * implicit or explicit fencing.
+ *
+ * This function will not set the fence to the state if it was set
+ * via explicit fencing interfaces on the atomic ioctl. It will
+ * all drope the reference to the fence as we not storing it
+ * anywhere.
+ *
+ * Otherwise, if plane_state->fence is not set this function we
+ * just set it with the received implict fence.
+ */
+void
+drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
+ struct dma_fence *fence)
+{
+ if (plane_state->fence) {
+ dma_fence_put(fence);
+ return;
+ }
+
+ plane_state->fence = fence;
+}
+EXPORT_SYMBOL(drm_atomic_set_fence_for_plane);
+
+/**
* drm_atomic_set_crtc_for_connector - set crtc for connector
* @conn_state: atomic state object for the connector
* @crtc: crtc to use for the connector
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index fc8af53..2d1e9c9 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -345,6 +345,8 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
struct drm_crtc *crtc);
void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
struct drm_framebuffer *fb);
+void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state,
+ struct dma_fence *fence);
int __must_check
drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
struct drm_crtc *crtc);
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index c5e8a0d..68f6d22 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -59,7 +59,7 @@ struct drm_plane_state {
struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
- struct dma_fence *fence;
+ struct dma_fence *fence; /* do not write directly, use drm_atomic_set_fence_for_plane() */
/* Signed dest location allows it to be partially off screen */
int32_t crtc_x, crtc_y;
--
2.5.5
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v6 1/6] drm/atomic: add drm_atomic_set_fence_for_plane() Gustavo Padovan <gustavo@padovan.org> - 2016-10-27 21:40 +0200 Re: [PATCH v6 1/6] drm/atomic: add drm_atomic_set_fence_for_plane() Daniel Vetter <daniel@ffwll.ch> - 2016-10-28 09:40 +0200 Re: [PATCH v6 1/6] drm/atomic: add drm_atomic_set_fence_for_plane() Daniel Vetter <daniel@ffwll.ch> - 2016-10-28 09:40 +0200
csiph-web