mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 01:21:28 +00:00
drm/mipi-dbi: Move drm_dev_{enter, exit}() out from fb_dirty functions
Call drm_dev_enter() and drm_dev_exit() in the outer-most callbacks of the modesetting pipeline. If drm_dev_enter() fails, the driver can thus avoid unnecessary work. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Tested-by: Javier Martinez Canillas <javierm@redhat.com> Tested-by: Noralf Trønnes <noralf@tronnes.org> # drm/tiny/mi0283qt Link: https://patchwork.freedesktop.org/patch/msgid/20221202125644.7917-9-tzimmermann@suse.de
This commit is contained in:
parent
69c63e88ea
commit
3ea44105bd
@ -259,13 +259,10 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
|
||||
unsigned int width = rect->x2 - rect->x1;
|
||||
struct mipi_dbi *dbi = &dbidev->dbi;
|
||||
bool swap = dbi->swap_bytes;
|
||||
int idx, ret = 0;
|
||||
int ret = 0;
|
||||
bool full;
|
||||
void *tr;
|
||||
|
||||
if (!drm_dev_enter(fb->dev, &idx))
|
||||
return;
|
||||
|
||||
full = width == fb->width && height == fb->height;
|
||||
|
||||
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
|
||||
@ -288,8 +285,6 @@ static void mipi_dbi_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
|
||||
err_msg:
|
||||
if (ret)
|
||||
drm_err_once(fb->dev, "Failed to update display %d\n", ret);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,6 +320,7 @@ void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||
struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state);
|
||||
struct drm_framebuffer *fb = state->fb;
|
||||
struct drm_rect rect;
|
||||
int idx;
|
||||
|
||||
if (!pipe->crtc.state->active)
|
||||
return;
|
||||
@ -332,8 +328,13 @@ void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||
if (WARN_ON(!fb))
|
||||
return;
|
||||
|
||||
if (!drm_dev_enter(fb->dev, &idx))
|
||||
return;
|
||||
|
||||
if (drm_atomic_helper_damage_merged(old_state, state, &rect))
|
||||
mipi_dbi_fb_dirty(&shadow_plane_state->data[0], fb, &rect);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
EXPORT_SYMBOL(mipi_dbi_pipe_update);
|
||||
|
||||
|
@ -87,13 +87,10 @@ static void ili9225_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
|
||||
bool swap = dbi->swap_bytes;
|
||||
u16 x_start, y_start;
|
||||
u16 x1, x2, y1, y2;
|
||||
int idx, ret = 0;
|
||||
int ret = 0;
|
||||
bool full;
|
||||
void *tr;
|
||||
|
||||
if (!drm_dev_enter(fb->dev, &idx))
|
||||
return;
|
||||
|
||||
full = width == fb->width && height == fb->height;
|
||||
|
||||
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
|
||||
@ -156,8 +153,6 @@ static void ili9225_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
|
||||
err_msg:
|
||||
if (ret)
|
||||
dev_err_once(fb->dev->dev, "Failed to update display %d\n", ret);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
static void ili9225_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||
@ -167,12 +162,18 @@ static void ili9225_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||
struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state);
|
||||
struct drm_framebuffer *fb = state->fb;
|
||||
struct drm_rect rect;
|
||||
int idx;
|
||||
|
||||
if (!pipe->crtc.state->active)
|
||||
return;
|
||||
|
||||
if (!drm_dev_enter(fb->dev, &idx))
|
||||
return;
|
||||
|
||||
if (drm_atomic_helper_damage_merged(old_state, state, &rect))
|
||||
ili9225_fb_dirty(&shadow_plane_state->data[0], fb, &rect);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
|
||||
|
@ -113,10 +113,7 @@ static void st7586_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
|
||||
{
|
||||
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
|
||||
struct mipi_dbi *dbi = &dbidev->dbi;
|
||||
int start, end, idx, ret = 0;
|
||||
|
||||
if (!drm_dev_enter(fb->dev, &idx))
|
||||
return;
|
||||
int start, end, ret = 0;
|
||||
|
||||
/* 3 pixels per byte, so grow clip to nearest multiple of 3 */
|
||||
rect->x1 = rounddown(rect->x1, 3);
|
||||
@ -145,8 +142,6 @@ static void st7586_fb_dirty(struct iosys_map *src, struct drm_framebuffer *fb,
|
||||
err_msg:
|
||||
if (ret)
|
||||
dev_err_once(fb->dev->dev, "Failed to update display %d\n", ret);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
static void st7586_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||
@ -156,12 +151,18 @@ static void st7586_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||
struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state);
|
||||
struct drm_framebuffer *fb = state->fb;
|
||||
struct drm_rect rect;
|
||||
int idx;
|
||||
|
||||
if (!pipe->crtc.state->active)
|
||||
return;
|
||||
|
||||
if (!drm_dev_enter(fb->dev, &idx))
|
||||
return;
|
||||
|
||||
if (drm_atomic_helper_damage_merged(old_state, state, &rect))
|
||||
st7586_fb_dirty(&shadow_plane_state->data[0], fb, &rect);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
}
|
||||
|
||||
static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
|
||||
|
Loading…
Reference in New Issue
Block a user