diff options
author | Greg Hackmann <ghackmann@google.com> | 2013-10-15 12:51:20 -0700 |
---|---|---|
committer | Greg Hackmann <ghackmann@google.com> | 2013-10-24 10:04:56 -0700 |
commit | 896971ea097116d141ef8811421d13eddf8f94b2 (patch) | |
tree | bfaff7c3a20e73784c9b167f910da5d9ce27f644 /include | |
parent | 27e7183c5aa432bfd6a99e6164761eae3917748b (diff) |
video: adf: add helpers for validating custom formats
Many custom formats look a lot like the standard ones, but with
different subsampling, bpp, etc. Expose and document
adf_buffer_validate()'s main body, so drivers can reuse its logic when
validating these formats.
Change-Id: I1d06981c9e5aab26f3ab2956c08c679f2c823bcc
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/video/adf.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/video/adf.h b/include/video/adf.h index 82d49fcf00cf..1681354e1e87 100644 --- a/include/video/adf.h +++ b/include/video/adf.h @@ -435,6 +435,27 @@ const char *adf_event_type_str(struct adf_obj *obj, enum adf_event_type type); #define ADF_FORMAT_STR_SIZE 5 void adf_format_str(u32 format, char buf[ADF_FORMAT_STR_SIZE]); +int adf_format_validate_yuv(struct adf_device *dev, struct adf_buffer *buf, + u8 num_planes, u8 hsub, u8 vsub, u8 cpp[]); +/** + * adf_format_validate_rgb - validate the number and size of planes in buffers + * with a custom RGB format. + * + * @dev: ADF device performing the validation + * @buf: buffer to validate + * @cpp: expected bytes per pixel + * + * adf_format_validate_rgb() is intended to be called as a helper from @dev's + * validate_custom_format() op. @buf must have a single RGB plane. + * + * Returns 0 if @buf has a single plane with sufficient size, or -EINVAL + * otherwise. + */ +static inline int adf_format_validate_rgb(struct adf_device *dev, + struct adf_buffer *buf, u8 cpp) +{ + return adf_format_validate_yuv(dev, buf, 1, 1, 1, &cpp); +} int adf_event_get(struct adf_obj *obj, enum adf_event_type type); int adf_event_put(struct adf_obj *obj, enum adf_event_type type); |