1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. 3 */ 4 5 #ifndef _DPU_FORMATS_H 6 #define _DPU_FORMATS_H 7 8 #include <drm/drm_fourcc.h> 9 #include "msm_gem.h" 10 #include "dpu_hw_mdss.h" 11 12 /** 13 * dpu_find_format - validate if the pixel format is supported 14 * @format: dpu format 15 * @supported_formats: supported formats by dpu HW 16 * @num_formatss: total number of formats 17 * 18 * Return: false if not valid format, true on success 19 */ 20 static inline bool dpu_find_format(u32 format, const u32 *supported_formats, 21 size_t num_formats) 22 { 23 int i; 24 25 for (i = 0; i < num_formats; i++) { 26 /* check for valid formats supported */ 27 if (format == supported_formats[i]) 28 return true; 29 } 30 31 return false; 32 } 33 34 void dpu_format_populate_addrs(struct msm_gem_address_space *aspace, 35 struct drm_framebuffer *fb, 36 struct dpu_hw_fmt_layout *layout); 37 38 int dpu_format_populate_plane_sizes( 39 struct drm_framebuffer *fb, 40 struct dpu_hw_fmt_layout *layout); 41 42 #endif /*_DPU_FORMATS_H */ 43