aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2015-02-20 04:30:59 -0500
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2015-03-03 09:16:12 -0500
commit3e8da87d0c04e585f4af0f223376128f923cf7bc (patch)
tree1fbd6f64273d17cab059f6d8f0c62542bb7f5cb5
parent845f46356ba490b654194b8d5c26032841719a78 (diff)
drm: rcar-du: Wire up atomic state object scaffolding
Hook up the default .reset(), .atomic_duplicate_state() and .atomic_free_state() helpers to ensure that state objects are properly created and destroyed, and call drm_mode_config_reset() at init time to create the initial state objects. Framebuffer reference count also gets maintained automatically by the transitional helpers except for the legacy page flip operation. Maintain it explicitly there. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_crtc.c7
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c4
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_kms.c2
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c4
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_plane.c4
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_vgacon.c4
6 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 169558a3ab40..6e7266c1a47b 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -15,6 +15,8 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16 16
17#include <drm/drmP.h> 17#include <drm/drmP.h>
18#include <drm/drm_atomic.h>
19#include <drm/drm_atomic_helper.h>
18#include <drm/drm_crtc.h> 20#include <drm/drm_crtc.h>
19#include <drm/drm_crtc_helper.h> 21#include <drm/drm_crtc_helper.h>
20#include <drm/drm_fb_cma_helper.h> 22#include <drm/drm_fb_cma_helper.h>
@@ -572,6 +574,8 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc,
572 } 574 }
573 spin_unlock_irqrestore(&dev->event_lock, flags); 575 spin_unlock_irqrestore(&dev->event_lock, flags);
574 576
577 drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
578
575 crtc->primary->fb = fb; 579 crtc->primary->fb = fb;
576 rcar_du_crtc_update_base(rcrtc); 580 rcar_du_crtc_update_base(rcrtc);
577 581
@@ -587,9 +591,12 @@ static int rcar_du_crtc_page_flip(struct drm_crtc *crtc,
587} 591}
588 592
589static const struct drm_crtc_funcs crtc_funcs = { 593static const struct drm_crtc_funcs crtc_funcs = {
594 .reset = drm_atomic_helper_crtc_reset,
590 .destroy = drm_crtc_cleanup, 595 .destroy = drm_crtc_cleanup,
591 .set_config = drm_crtc_helper_set_config, 596 .set_config = drm_crtc_helper_set_config,
592 .page_flip = rcar_du_crtc_page_flip, 597 .page_flip = rcar_du_crtc_page_flip,
598 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
599 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
593}; 600};
594 601
595/* ----------------------------------------------------------------------------- 602/* -----------------------------------------------------------------------------
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
index 3896cb20ad51..9378c283cb58 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_hdmicon.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <drm/drmP.h> 14#include <drm/drmP.h>
15#include <drm/drm_atomic_helper.h>
15#include <drm/drm_crtc.h> 16#include <drm/drm_crtc.h>
16#include <drm/drm_crtc_helper.h> 17#include <drm/drm_crtc_helper.h>
17#include <drm/drm_encoder_slave.h> 18#include <drm/drm_encoder_slave.h>
@@ -75,9 +76,12 @@ rcar_du_hdmi_connector_detect(struct drm_connector *connector, bool force)
75 76
76static const struct drm_connector_funcs connector_funcs = { 77static const struct drm_connector_funcs connector_funcs = {
77 .dpms = drm_helper_connector_dpms, 78 .dpms = drm_helper_connector_dpms,
79 .reset = drm_atomic_helper_connector_reset,
78 .detect = rcar_du_hdmi_connector_detect, 80 .detect = rcar_du_hdmi_connector_detect,
79 .fill_modes = drm_helper_probe_single_connector_modes, 81 .fill_modes = drm_helper_probe_single_connector_modes,
80 .destroy = rcar_du_hdmi_connector_destroy, 82 .destroy = rcar_du_hdmi_connector_destroy,
83 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
84 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
81}; 85};
82 86
83int rcar_du_hdmi_connector_init(struct rcar_du_device *rcdu, 87int rcar_du_hdmi_connector_init(struct rcar_du_device *rcdu,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 413145de3db3..94ff8fcc7268 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -439,6 +439,8 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
439 encoder->possible_clones = (1 << num_encoders) - 1; 439 encoder->possible_clones = (1 << num_encoders) - 1;
440 } 440 }
441 441
442 drm_mode_config_reset(dev);
443
442 drm_kms_helper_poll_init(dev); 444 drm_kms_helper_poll_init(dev);
443 445
444 if (dev->mode_config.num_connector) { 446 if (dev->mode_config.num_connector) {
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
index 7c0b08fe0774..4bfa3ce34ab3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <drm/drmP.h> 14#include <drm/drmP.h>
15#include <drm/drm_atomic_helper.h>
15#include <drm/drm_crtc.h> 16#include <drm/drm_crtc.h>
16#include <drm/drm_crtc_helper.h> 17#include <drm/drm_crtc_helper.h>
17 18
@@ -75,9 +76,12 @@ rcar_du_lvds_connector_detect(struct drm_connector *connector, bool force)
75 76
76static const struct drm_connector_funcs connector_funcs = { 77static const struct drm_connector_funcs connector_funcs = {
77 .dpms = drm_helper_connector_dpms, 78 .dpms = drm_helper_connector_dpms,
79 .reset = drm_atomic_helper_connector_reset,
78 .detect = rcar_du_lvds_connector_detect, 80 .detect = rcar_du_lvds_connector_detect,
79 .fill_modes = drm_helper_probe_single_connector_modes, 81 .fill_modes = drm_helper_probe_single_connector_modes,
80 .destroy = rcar_du_lvds_connector_destroy, 82 .destroy = rcar_du_lvds_connector_destroy,
83 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
84 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
81}; 85};
82 86
83int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu, 87int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index d4682ac7db03..c4e4fd293eee 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <drm/drmP.h> 14#include <drm/drmP.h>
15#include <drm/drm_atomic_helper.h>
15#include <drm/drm_crtc.h> 16#include <drm/drm_crtc.h>
16#include <drm/drm_crtc_helper.h> 17#include <drm/drm_crtc_helper.h>
17#include <drm/drm_fb_cma_helper.h> 18#include <drm/drm_fb_cma_helper.h>
@@ -486,8 +487,11 @@ static int rcar_du_plane_set_property(struct drm_plane *plane,
486static const struct drm_plane_funcs rcar_du_plane_funcs = { 487static const struct drm_plane_funcs rcar_du_plane_funcs = {
487 .update_plane = drm_plane_helper_update, 488 .update_plane = drm_plane_helper_update,
488 .disable_plane = drm_plane_helper_disable, 489 .disable_plane = drm_plane_helper_disable,
490 .reset = drm_atomic_helper_plane_reset,
489 .set_property = rcar_du_plane_set_property, 491 .set_property = rcar_du_plane_set_property,
490 .destroy = drm_plane_cleanup, 492 .destroy = drm_plane_cleanup,
493 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
494 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
491}; 495};
492 496
493static const uint32_t formats[] = { 497static const uint32_t formats[] = {
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
index ae8b304e6fea..a110cf22f3b0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <drm/drmP.h> 14#include <drm/drmP.h>
15#include <drm/drm_atomic_helper.h>
15#include <drm/drm_crtc.h> 16#include <drm/drm_crtc.h>
16#include <drm/drm_crtc_helper.h> 17#include <drm/drm_crtc_helper.h>
17 18
@@ -44,9 +45,12 @@ rcar_du_vga_connector_detect(struct drm_connector *connector, bool force)
44 45
45static const struct drm_connector_funcs connector_funcs = { 46static const struct drm_connector_funcs connector_funcs = {
46 .dpms = drm_helper_connector_dpms, 47 .dpms = drm_helper_connector_dpms,
48 .reset = drm_atomic_helper_connector_reset,
47 .detect = rcar_du_vga_connector_detect, 49 .detect = rcar_du_vga_connector_detect,
48 .fill_modes = drm_helper_probe_single_connector_modes, 50 .fill_modes = drm_helper_probe_single_connector_modes,
49 .destroy = rcar_du_vga_connector_destroy, 51 .destroy = rcar_du_vga_connector_destroy,
52 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
53 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
50}; 54};
51 55
52int rcar_du_vga_connector_init(struct rcar_du_device *rcdu, 56int rcar_du_vga_connector_init(struct rcar_du_device *rcdu,