summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_mipi_dbi.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2020-06-12 18:00:55 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2020-06-24 09:17:34 +0200
commit7e06886bbfca73717e45a0f20cdb4053793c191b (patch)
tree4608d9633f9afd2b2d69e83a65060c89d7e667c0 /drivers/gpu/drm/drm_mipi_dbi.c
parente8411b7ede3bd59f45a7ad997536d235e9c71c36 (diff)
drm/mipi-dbi: Remove ->enabled
The atomic helpers try really hard to not lose track of things, duplicating enabled tracking in the driver is at best confusing. Double-enabling or disabling is a bug in atomic helpers. In the fb_dirty function we can just assume that the fb always exists, simple display pipe helpers guarantee that the crtc is only enabled together with the output, so we always have a primary plane around. Now in the update function we need to be a notch more careful, since that can also get called when the crtc is off. And we don't want to upload frames when that's the case, so filter that out too. Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: David Lechner <david@lechnology.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200612160056.2082681-7-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/drm_mipi_dbi.c')
-rw-r--r--drivers/gpu/drm/drm_mipi_dbi.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index fd8d672972a9..79532b9a324a 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -268,7 +268,7 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
bool full;
void *tr;
- if (!dbidev->enabled)
+ if (WARN_ON(!fb))
return;
if (!drm_dev_enter(fb->dev, &idx))
@@ -314,6 +314,9 @@ void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *state = pipe->plane.state;
struct drm_rect rect;
+ if (!pipe->crtc.state->active)
+ return;
+
if (drm_atomic_helper_damage_merged(old_state, state, &rect))
mipi_dbi_fb_dirty(state->fb, &rect);
}
@@ -325,9 +328,8 @@ EXPORT_SYMBOL(mipi_dbi_pipe_update);
* @crtc_state: CRTC state
* @plane_state: Plane state
*
- * This function sets &mipi_dbi->enabled, flushes the whole framebuffer and
- * enables the backlight. Drivers can use this in their
- * &drm_simple_display_pipe_funcs->enable callback.
+ * Flushes the whole framebuffer and enables the backlight. Drivers can use this
+ * in their &drm_simple_display_pipe_funcs->enable callback.
*
* Note: Drivers which don't use mipi_dbi_pipe_update() because they have custom
* framebuffer flushing, can't use this function since they both use the same
@@ -349,7 +351,6 @@ void mipi_dbi_enable_flush(struct mipi_dbi_dev *dbidev,
if (!drm_dev_enter(&dbidev->drm, &idx))
return;
- dbidev->enabled = true;
mipi_dbi_fb_dirty(fb, &rect);
backlight_enable(dbidev->backlight);
@@ -390,13 +391,8 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
{
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
- if (!dbidev->enabled)
- return;
-
DRM_DEBUG_KMS("\n");
- dbidev->enabled = false;
-
if (dbidev->backlight)
backlight_disable(dbidev->backlight);
else