aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2014-04-01 18:22:38 -0400
committerRob Clark <robdclark@gmail.com>2014-04-01 20:18:27 -0400
commite13161af80c185ecd8dc4641d0f5df58f9e3e0af (patch)
treef91577cef047892521deed04a077c87babcfeb2c /drivers/gpu/drm/drm_crtc.c
parent9922ab5a7e4a4e089b2abfb1425590b97a7a90a3 (diff)
drm: Add drm_crtc_init_with_planes() (v2)
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. v2: - Move drm_crtc_init() to plane helper file so that nothing in the DRM core depends on helpers. [suggested by Daniel Vetter] - Keep cursor parameter to drm_crtc_init_with_planes() a void* until we actually add cursor support. [suggested by Daniel Vetter] Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index eb2165954f18..110e5ce117f5 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -692,9 +692,12 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
692EXPORT_SYMBOL(drm_framebuffer_remove); 692EXPORT_SYMBOL(drm_framebuffer_remove);
693 693
694/** 694/**
695 * drm_crtc_init - Initialise a new CRTC object 695 * drm_crtc_init_with_planes - Initialise a new CRTC object with
696 * specified primary and cursor planes.
696 * @dev: DRM device 697 * @dev: DRM device
697 * @crtc: CRTC object to init 698 * @crtc: CRTC object to init
699 * @primary: Primary plane for CRTC
700 * @cursor: Cursor plane for CRTC
698 * @funcs: callbacks for the new CRTC 701 * @funcs: callbacks for the new CRTC
699 * 702 *
700 * Inits a new object created as base part of a driver crtc object. 703 * Inits a new object created as base part of a driver crtc object.
@@ -702,8 +705,10 @@ EXPORT_SYMBOL(drm_framebuffer_remove);
702 * Returns: 705 * Returns:
703 * Zero on success, error code on failure. 706 * Zero on success, error code on failure.
704 */ 707 */
705int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, 708int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
706 const struct drm_crtc_funcs *funcs) 709 struct drm_plane *primary,
710 void *cursor,
711 const struct drm_crtc_funcs *funcs)
707{ 712{
708 int ret; 713 int ret;
709 714
@@ -724,12 +729,16 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
724 list_add_tail(&crtc->head, &dev->mode_config.crtc_list); 729 list_add_tail(&crtc->head, &dev->mode_config.crtc_list);
725 dev->mode_config.num_crtc++; 730 dev->mode_config.num_crtc++;
726 731
732 crtc->primary = primary;
733 if (primary)
734 primary->possible_crtcs = 1 << drm_crtc_index(crtc);
735
727 out: 736 out:
728 drm_modeset_unlock_all(dev); 737 drm_modeset_unlock_all(dev);
729 738
730 return ret; 739 return ret;
731} 740}
732EXPORT_SYMBOL(drm_crtc_init); 741EXPORT_SYMBOL(drm_crtc_init_with_planes);
733 742
734/** 743/**
735 * drm_crtc_cleanup - Clean up the core crtc usage 744 * drm_crtc_cleanup - Clean up the core crtc usage
@@ -2219,6 +2228,8 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
2219 2228
2220 ret = crtc->funcs->set_config(set); 2229 ret = crtc->funcs->set_config(set);
2221 if (ret == 0) { 2230 if (ret == 0) {
2231 crtc->primary->crtc = crtc;
2232
2222 /* crtc->fb must be updated by ->set_config, enforces this. */ 2233 /* crtc->fb must be updated by ->set_config, enforces this. */
2223 WARN_ON(fb != crtc->fb); 2234 WARN_ON(fb != crtc->fb);
2224 } 2235 }