brintos

brintos / linux-shallow public Read only

0
0
Text · 1.9 KiB · 210d0ed Raw
66 lines · c
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_H6#define _DPU_FORMATS_H7 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 supported14 * @format:		dpu format15 * @supported_formats:	supported formats by dpu HW16 * @num_formatss:	total number of formats17 *18 * Return: false if not valid format, true on success19 */20static 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/**35 * dpu_format_check_modified_format - validate format and buffers for36 *                   dpu non-standard, i.e. modified format37 * @kms:             kms driver38 * @msm_fmt:         pointer to the msm_fmt base pointer of an msm_format39 * @cmd:             fb_cmd2 structure user request40 * @bos:             gem buffer object list41 *42 * Return: error code on failure, 0 on success43 */44int dpu_format_check_modified_format(45		const struct msm_kms *kms,46		const struct msm_format *msm_fmt,47		const struct drm_mode_fb_cmd2 *cmd,48		struct drm_gem_object **bos);49 50/**51 * dpu_format_populate_layout - populate the given format layout based on52 *                     mmu, fb, and format found in the fb53 * @aspace:            address space pointer54 * @fb:                framebuffer pointer55 * @fmtl:              format layout structure to populate56 *57 * Return: error code on failure, -EAGAIN if success but the addresses58 *         are the same as before or 0 if new addresses were populated59 */60int dpu_format_populate_layout(61		struct msm_gem_address_space *aspace,62		struct drm_framebuffer *fb,63		struct dpu_hw_fmt_layout *fmtl);64 65#endif /*_DPU_FORMATS_H */66