drm/simple-helpers: Always add planes to the state update
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 23 Aug 2016 06:25:40 +0000 (08:25 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 25 Aug 2016 18:46:03 +0000 (20:46 +0200)
Our update function is hooked to the single plane, which might not get
called for crtc-only updates. Which is surprising, so fix this by
always adding the plane.

While at it document how&when the event should be sent out better in
the kerneldoc.

Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: andrea.merello@gmail.com
Tested-and-Reported-by: andrea.merello@gmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1471933540-31131-1-git-send-email-daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_simple_kms_helper.c
include/drm/drm_simple_kms_helper.h

index bada171665120fbd2aa8a528c0c5e24410c20ea4..44763101842610fda97cd53b3d931573ebdbf576 100644 (file)
@@ -34,6 +34,12 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = {
        .destroy = drm_encoder_cleanup,
 };
 
+static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
+                                    struct drm_crtc_state *state)
+{
+       return drm_atomic_add_affected_planes(state->state, crtc);
+}
+
 static void drm_simple_kms_crtc_enable(struct drm_crtc *crtc)
 {
        struct drm_simple_display_pipe *pipe;
@@ -57,6 +63,7 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc *crtc)
 }
 
 static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
+       .atomic_check = drm_simple_kms_crtc_check,
        .disable = drm_simple_kms_crtc_disable,
        .enable = drm_simple_kms_crtc_enable,
 };
index 269039722f91f458872b24db5a373d0871dd6d1c..826946ca2b8265f6ff46465f5bd53e632c4517d9 100644 (file)
@@ -60,6 +60,12 @@ struct drm_simple_display_pipe_funcs {
         *
         * This function is called when the underlying plane state is updated.
         * This hook is optional.
+        *
+        * This is the function drivers should submit the
+        * &drm_pending_vblank_event from. Using either
+        * drm_crtc_arm_vblank_event(), when the driver supports vblank
+        * interrupt handling, or drm_crtc_send_vblank_event() directly in case
+        * the hardware lacks vblank support entirely.
         */
        void (*update)(struct drm_simple_display_pipe *pipe,
                       struct drm_plane_state *plane_state);