Skip to content

Commit

Permalink
drm: simple_kms_helper: Add mode_valid() callback support
Browse files Browse the repository at this point in the history
The PL111 needs to filter valid modes based on memory bandwidth.
I guess it is a pretty simple operation, so we can still claim
the DRM KMS helper pipeline is simple after adding this (optional)
vtable callback.

Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
linusw authored and iartemenko committed Apr 25, 2018
1 parent f1b7904 commit de90dc8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/gpu/drm/drm_simple_kms_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};

static enum drm_mode_status
drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
{
struct drm_simple_display_pipe *pipe;

pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
if (!pipe->funcs || !pipe->funcs->mode_valid)
/* Anything goes */
return MODE_OK;

return pipe->funcs->mode_valid(crtc, mode);
}

static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{
Expand Down Expand Up @@ -72,6 +86,7 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc *crtc,
}

static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
.mode_valid = drm_simple_kms_crtc_mode_valid,
.atomic_check = drm_simple_kms_crtc_check,
.atomic_enable = drm_simple_kms_crtc_enable,
.atomic_disable = drm_simple_kms_crtc_disable,
Expand Down
14 changes: 14 additions & 0 deletions include/drm/drm_simple_kms_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ struct drm_simple_display_pipe;
* display pipeline
*/
struct drm_simple_display_pipe_funcs {
/**
* @mode_valid:
*
* This function is called to filter out valid modes from the
* suggestions suggested by the bridge or display. This optional
* hook is passed in when initializing the pipeline.
*
* RETURNS:
*
* drm_mode_status Enum
*/
enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
const struct drm_display_mode *mode);

/**
* @enable:
*
Expand Down

0 comments on commit de90dc8

Please sign in to comment.