From: Matt Roper <matthew.d.roper@intel.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCHv4 10/13] drm: Add drm_crtc_init_with_planes()
Date: Thu, 27 Mar 2014 17:44:35 -0700 [thread overview]
Message-ID: <1395967478-30549-11-git-send-email-matthew.d.roper@intel.com> (raw)
In-Reply-To: <1395967478-30549-1-git-send-email-matthew.d.roper@intel.com>
Add a new drm_crtc_init_with_planes() to allow drivers to provide
specific primary and cursor planes at CRTC initialization. The existing
drm_crtc_init() interface remains to avoid driver churn in existing
drivers; it will initialize the CRTC with a plane helper-created primary
plane and no cursor plane.
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/drm_crtc.c | 44 +++++++++++++++++++++++++++++++++++++++++---
include/drm/drm_crtc.h | 11 +++++++++++
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 24226de..a983311 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -37,6 +37,7 @@
#include <drm/drm_crtc.h>
#include <drm/drm_edid.h>
#include <drm/drm_fourcc.h>
+#include <drm/drm_plane_helper.h>
#include "drm_crtc_internal.h"
@@ -692,9 +693,12 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
EXPORT_SYMBOL(drm_framebuffer_remove);
/**
- * drm_crtc_init - Initialise a new CRTC object
+ * drm_crtc_init_with_planes - Initialise a new CRTC object with
+ * specified primary and cursor planes.
* @dev: DRM device
* @crtc: CRTC object to init
+ * @primary: Primary plane for CRTC
+ * @cursor: Cursor plane for CRTC
* @funcs: callbacks for the new CRTC
*
* Inits a new object created as base part of a driver crtc object.
@@ -702,8 +706,10 @@ EXPORT_SYMBOL(drm_framebuffer_remove);
* Returns:
* Zero on success, error code on failure.
*/
-int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
- const struct drm_crtc_funcs *funcs)
+int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
+ struct drm_plane *primary,
+ struct drm_plane *cursor,
+ const struct drm_crtc_funcs *funcs)
{
int ret;
@@ -724,11 +730,41 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
dev->mode_config.num_crtc++;
+ crtc->primary = primary;
+ if (primary)
+ primary->possible_crtcs = 1 << drm_crtc_index(crtc);
+
+ crtc->cursor = cursor;
+ if (cursor)
+ cursor->possible_crtcs = 1 << drm_crtc_index(crtc);
+
out:
drm_modeset_unlock_all(dev);
return ret;
}
+EXPORT_SYMBOL(drm_crtc_init_with_planes);
+
+/**
+ * drm_crtc_init - Legacy CRTC initialization function
+ * @dev: DRM device
+ * @crtc: CRTC object to init
+ * @funcs: callbacks for the new CRTC
+ *
+ * Initialize a CRTC object with a default helper-provided primary plane and no
+ * cursor plane.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
+ const struct drm_crtc_funcs *funcs)
+{
+ struct drm_plane *primary;
+
+ primary = drm_primary_helper_create_plane(dev, NULL, 0);
+ return drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs);
+}
EXPORT_SYMBOL(drm_crtc_init);
/**
@@ -2248,6 +2284,8 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
ret = crtc->funcs->set_config(set);
if (ret == 0) {
+ crtc->primary->crtc = crtc;
+
/* crtc->fb must be updated by ->set_config, enforces this. */
WARN_ON(fb != crtc->fb);
}
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 78cf825..e7ed766 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -270,6 +270,8 @@ struct drm_crtc_funcs {
* @dev: parent DRM device
* @head: list management
* @base: base KMS object for ID tracking etc.
+ * @primary: primary plane for this CRTC
+ * @cursor: cursor plane for this CRTC
* @enabled: is this CRTC enabled?
* @mode: current mode timings
* @hwmode: mode timings as programmed to hw regs
@@ -305,6 +307,10 @@ struct drm_crtc {
struct drm_mode_object base;
+ /* primary and cursor planes for CRTC */
+ struct drm_plane *primary;
+ struct drm_plane *cursor;
+
/* framebuffer the connector is currently bound to */
struct drm_framebuffer *fb;
@@ -826,6 +832,11 @@ extern void drm_modeset_lock_all(struct drm_device *dev);
extern void drm_modeset_unlock_all(struct drm_device *dev);
extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
+extern int drm_crtc_init_with_planes(struct drm_device *dev,
+ struct drm_crtc *crtc,
+ struct drm_plane *primary,
+ struct drm_plane *cursor,
+ const struct drm_crtc_funcs *funcs);
extern int drm_crtc_init(struct drm_device *dev,
struct drm_crtc *crtc,
const struct drm_crtc_funcs *funcs);
--
1.8.5.1
next prev parent reply other threads:[~2014-03-28 0:44 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 0:44 [PATCHv4 00/13] Universal plane preparation patches Matt Roper
2014-03-28 0:44 ` [PATCHv4 01/13] drm: Add support for multiple plane types (v2) Matt Roper
2014-03-28 0:44 ` [PATCHv4 02/13] drm/exynos: Restrict plane loops to only operate on overlay planes (v2) Matt Roper
2014-03-28 0:44 ` [PATCHv4 03/13] drm/i915: " Matt Roper
2014-03-28 0:44 ` [PATCHv4 04/13] drm/shmobile: Restrict plane loops to only operate on legacy planes Matt Roper
2014-03-28 15:50 ` Laurent Pinchart
2014-03-28 17:52 ` Daniel Vetter
2014-03-28 17:53 ` Daniel Vetter
2014-04-01 15:27 ` Laurent Pinchart
2014-04-01 21:43 ` Daniel Vetter
2014-03-28 0:44 ` [PATCHv4 05/13] drm: Make drm_crtc_check_viewport non-static Matt Roper
2014-03-28 0:44 ` [PATCHv4 06/13] drm: Add primary plane helpers (v2) Matt Roper
2014-03-28 8:32 ` Daniel Vetter
2014-03-28 15:48 ` Laurent Pinchart
2014-03-28 17:54 ` Daniel Vetter
2014-04-01 15:25 ` Laurent Pinchart
2014-04-01 1:03 ` Matt Roper
2014-04-01 7:45 ` Daniel Vetter
2014-04-01 11:45 ` Rob Clark
2014-04-01 12:33 ` Daniel Vetter
2014-04-01 19:46 ` Dave Airlie
2014-04-01 21:47 ` Daniel Vetter
2014-04-01 1:04 ` Rob Clark
2014-03-28 0:44 ` [PATCHv4 07/13] drm: Add drm_universal_plane_init() Matt Roper
2014-03-28 0:44 ` [PATCHv4 08/13] drm: Add plane type property (v2) Matt Roper
2014-03-28 0:44 ` [PATCHv4 09/13] drm: Add plane max width/height properties Matt Roper
2014-03-28 8:21 ` Daniel Vetter
2014-03-28 0:44 ` Matt Roper [this message]
2014-03-28 9:11 ` [PATCHv4 10/13] drm: Add drm_crtc_init_with_planes() Daniel Vetter
2014-03-28 17:56 ` Daniel Vetter
2014-03-28 0:44 ` [PATCHv4 11/13] drm/msm: Switch to universal plane API's Matt Roper
2014-03-28 0:44 ` [PATCHv4 12/13] drm: Replace crtc fb with primary plane fb (v3) Matt Roper
2014-03-28 8:40 ` Daniel Vetter
2014-03-28 0:44 ` [PATCHv4 13/13] drm: Remove unused drm_crtc->fb Matt Roper
2014-03-28 8:15 ` [Intel-gfx] [PATCHv4 00/13] Universal plane preparation patches Daniel Vetter
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=1395967478-30549-11-git-send-email-matthew.d.roper@intel.com \
--to=matthew.d.roper@intel.com \
--cc=dri-devel@lists.freedesktop.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