diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_plane_helper.c | 21 |
2 files changed, 36 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) | |||
692 | EXPORT_SYMBOL(drm_framebuffer_remove); | 692 | EXPORT_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 | */ |
705 | int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, | 708 | int 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 | } |
732 | EXPORT_SYMBOL(drm_crtc_init); | 741 | EXPORT_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 | } |
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 2f2374aba42e..e768d35ff22e 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c | |||
@@ -310,3 +310,24 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev, | |||
310 | } | 310 | } |
311 | EXPORT_SYMBOL(drm_primary_helper_create_plane); | 311 | EXPORT_SYMBOL(drm_primary_helper_create_plane); |
312 | 312 | ||
313 | /** | ||
314 | * drm_crtc_init - Legacy CRTC initialization function | ||
315 | * @dev: DRM device | ||
316 | * @crtc: CRTC object to init | ||
317 | * @funcs: callbacks for the new CRTC | ||
318 | * | ||
319 | * Initialize a CRTC object with a default helper-provided primary plane and no | ||
320 | * cursor plane. | ||
321 | * | ||
322 | * Returns: | ||
323 | * Zero on success, error code on failure. | ||
324 | */ | ||
325 | int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, | ||
326 | const struct drm_crtc_funcs *funcs) | ||
327 | { | ||
328 | struct drm_plane *primary; | ||
329 | |||
330 | primary = drm_primary_helper_create_plane(dev, NULL, 0); | ||
331 | return drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs); | ||
332 | } | ||
333 | EXPORT_SYMBOL(drm_crtc_init); | ||