diff options
author | Eric Anholt <eric@anholt.net> | 2018-03-16 15:04:33 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2018-05-31 11:19:04 -0700 |
commit | 8fb756dfa273bcb42bdaff65baae83548b6c326d (patch) | |
tree | 41143554d41b74f3b266ce36508a9e5e4eecae9c /drivers/gpu/drm/drm_plane.c | |
parent | a38189c5f79d486cb6193a3965dad98d1b0a17b2 (diff) | |
download | linux-8fb756dfa273bcb42bdaff65baae83548b6c326d.tar.gz linux-8fb756dfa273bcb42bdaff65baae83548b6c326d.tar.bz2 linux-8fb756dfa273bcb42bdaff65baae83548b6c326d.zip |
drm: Trust format_mod_supported() when it OKs a plane modifier.
For parameterized modifiers (Broadcom's SAND and UIF), we need to
allow the parameter fields to be filled in, while exposing only the
variant of the modifier with the parameter unfilled in the internal
arrays and the format blob.
Signed-off-by: Eric Anholt <eric@anholt.net>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180316220435.31416-1-eric@anholt.net
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/drm_plane.c')
-rw-r--r-- | drivers/gpu/drm/drm_plane.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 035054455301..7ce88dff871d 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -561,19 +561,20 @@ int drm_plane_check_pixel_format(struct drm_plane *plane, if (i == plane->format_count) return -EINVAL; - if (!plane->modifier_count) - return 0; + if (plane->funcs->format_mod_supported) { + if (!plane->funcs->format_mod_supported(plane, format, modifier)) + return -EINVAL; + } else { + if (!plane->modifier_count) + return 0; - for (i = 0; i < plane->modifier_count; i++) { - if (modifier == plane->modifiers[i]) - break; + for (i = 0; i < plane->modifier_count; i++) { + if (modifier == plane->modifiers[i]) + break; + } + if (i == plane->modifier_count) + return -EINVAL; } - if (i == plane->modifier_count) - return -EINVAL; - - if (plane->funcs->format_mod_supported && - !plane->funcs->format_mod_supported(plane, format, modifier)) - return -EINVAL; return 0; } |