diff options
author | Noralf Trønnes <noralf@tronnes.org> | 2020-05-09 16:16:12 +0200 |
---|---|---|
committer | Noralf Trønnes <noralf@tronnes.org> | 2020-05-26 13:31:01 +0200 |
commit | c9c03e3cf07299bf635e6fadad8d09106d26252f (patch) | |
tree | e4d0cee4d51506c18120b7c9e6bc7769b5c2911e /drivers/gpu/drm/drm_client.c | |
parent | drm/vc4: hdmi: Silence pixel clock error on -EPROBE_DEFER (diff) | |
download | linux-c9c03e3cf07299bf635e6fadad8d09106d26252f.tar.xz linux-c9c03e3cf07299bf635e6fadad8d09106d26252f.zip |
drm/client: Add drm_client_framebuffer_flush()
Some drivers need explicit flushing of buffer changes, add a function
that does that.
v2:
- Put all clip rect stuff inside if statement (Sam)
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200509141619.32970-4-noralf@tronnes.org
Diffstat (limited to 'drivers/gpu/drm/drm_client.c')
-rw-r--r-- | drivers/gpu/drm/drm_client.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index 536a22747b51..495f47d23d87 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -437,6 +437,39 @@ void drm_client_framebuffer_delete(struct drm_client_buffer *buffer) } EXPORT_SYMBOL(drm_client_framebuffer_delete); +/** + * drm_client_framebuffer_flush - Manually flush client framebuffer + * @buffer: DRM client buffer (can be NULL) + * @rect: Damage rectangle (if NULL flushes all) + * + * This calls &drm_framebuffer_funcs->dirty (if present) to flush buffer changes + * for drivers that need it. + * + * Returns: + * Zero on success or negative error code on failure. + */ +int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect) +{ + if (!buffer || !buffer->fb || !buffer->fb->funcs->dirty) + return 0; + + if (rect) { + struct drm_clip_rect clip = { + .x1 = rect->x1, + .y1 = rect->y1, + .x2 = rect->x2, + .y2 = rect->y2, + }; + + return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, + 0, 0, &clip, 1); + } + + return buffer->fb->funcs->dirty(buffer->fb, buffer->client->file, + 0, 0, NULL, 0); +} +EXPORT_SYMBOL(drm_client_framebuffer_flush); + #ifdef CONFIG_DEBUG_FS static int drm_client_debugfs_internal_clients(struct seq_file *m, void *data) { |