Skip to content

Commit

Permalink
drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks
Browse files Browse the repository at this point in the history
Add .prepare_fb and .cleanup_fb plane hooks into the drm_simple_kms.
These can be used by drivers to call ie. the drm_fb_cma_setup_fence()
helper.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161002170124.6099-1-marex@denx.de
  • Loading branch information
Marek Vasut authored and Daniel Vetter committed Oct 5, 2016
1 parent 587680c commit 7d83a15
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
26 changes: 26 additions & 0 deletions drivers/gpu/drm/drm_simple_kms_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,33 @@ static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane,
pipe->funcs->update(pipe, pstate);
}

static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state)
{
struct drm_simple_display_pipe *pipe;

pipe = container_of(plane, struct drm_simple_display_pipe, plane);
if (!pipe->funcs || !pipe->funcs->prepare_fb)
return 0;

return pipe->funcs->prepare_fb(pipe, state);
}

static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *state)
{
struct drm_simple_display_pipe *pipe;

pipe = container_of(plane, struct drm_simple_display_pipe, plane);
if (!pipe->funcs || !pipe->funcs->cleanup_fb)
return;

pipe->funcs->cleanup_fb(pipe, state);
}

static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = {
.prepare_fb = drm_simple_kms_plane_prepare_fb,
.cleanup_fb = drm_simple_kms_plane_cleanup_fb,
.atomic_check = drm_simple_kms_plane_atomic_check,
.atomic_update = drm_simple_kms_plane_atomic_update,
};
Expand Down
20 changes: 20 additions & 0 deletions include/drm/drm_simple_kms_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ struct drm_simple_display_pipe_funcs {
*/
void (*update)(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state);

/**
* @prepare_fb:
*
* Optional, called by struct &drm_plane_helper_funcs ->prepare_fb .
* Please read the documentation for the ->prepare_fb hook in
* struct &drm_plane_helper_funcs for more details.
*/
int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state);

/**
* @cleanup_fb:
*
* Optional, called by struct &drm_plane_helper_funcs ->cleanup_fb .
* Please read the documentation for the ->cleanup_fb hook in
* struct &drm_plane_helper_funcs for more details.
*/
void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state);
};

/**
Expand Down

0 comments on commit 7d83a15

Please sign in to comment.