Commit ac86cba9 authored by Oleksandr Andrushchenko's avatar Oleksandr Andrushchenko Committed by Daniel Vetter

drm/simple_kms_helper: Add {enable|disable}_vblank callback support

If simple_kms_helper based driver needs to work with vblanks,
then it has to provide drm_driver.{enable|disable}_vblank callbacks,
because drm_simple_kms_helper.drm_crtc_funcs does not provide any.
At the same time drm_driver.{enable|disable}_vblank callbacks
are marked as deprecated and shouldn't be used by new drivers.

Fix this by extending drm_simple_kms_helper.drm_crtc_funcs
to provide the missing callbacks.
Signed-off-by: default avatarOleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1518425574-32671-2-git-send-email-andr2000@gmail.com
parent 58871706
...@@ -92,6 +92,28 @@ static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = { ...@@ -92,6 +92,28 @@ static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
.atomic_disable = drm_simple_kms_crtc_disable, .atomic_disable = drm_simple_kms_crtc_disable,
}; };
static int drm_simple_kms_crtc_enable_vblank(struct drm_crtc *crtc)
{
struct drm_simple_display_pipe *pipe;
pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
if (!pipe->funcs || !pipe->funcs->enable_vblank)
return 0;
return pipe->funcs->enable_vblank(pipe);
}
static void drm_simple_kms_crtc_disable_vblank(struct drm_crtc *crtc)
{
struct drm_simple_display_pipe *pipe;
pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
if (!pipe->funcs || !pipe->funcs->disable_vblank)
return;
pipe->funcs->disable_vblank(pipe);
}
static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = { static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
.reset = drm_atomic_helper_crtc_reset, .reset = drm_atomic_helper_crtc_reset,
.destroy = drm_crtc_cleanup, .destroy = drm_crtc_cleanup,
...@@ -99,6 +121,8 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = { ...@@ -99,6 +121,8 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
.page_flip = drm_atomic_helper_page_flip, .page_flip = drm_atomic_helper_page_flip,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
.enable_vblank = drm_simple_kms_crtc_enable_vblank,
.disable_vblank = drm_simple_kms_crtc_disable_vblank,
}; };
static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane, static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
......
...@@ -107,6 +107,24 @@ struct drm_simple_display_pipe_funcs { ...@@ -107,6 +107,24 @@ struct drm_simple_display_pipe_funcs {
*/ */
void (*cleanup_fb)(struct drm_simple_display_pipe *pipe, void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state); struct drm_plane_state *plane_state);
/**
* @enable_vblank:
*
* Optional, called by &drm_crtc_funcs.enable_vblank. Please read
* the documentation for the &drm_crtc_funcs.enable_vblank hook for
* more details.
*/
int (*enable_vblank)(struct drm_simple_display_pipe *pipe);
/**
* @disable_vblank:
*
* Optional, called by &drm_crtc_funcs.disable_vblank. Please read
* the documentation for the &drm_crtc_funcs.disable_vblank hook for
* more details.
*/
void (*disable_vblank)(struct drm_simple_display_pipe *pipe);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment