1 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. 2 * 3 * This program is free software; you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License version 2 and 5 * only version 2 as published by the Free Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 */ 12 13 #ifndef _DPU_FORMATS_H 14 #define _DPU_FORMATS_H 15 16 #include <drm/drm_fourcc.h> 17 #include "msm_gem.h" 18 #include "dpu_hw_mdss.h" 19 20 /** 21 * dpu_get_dpu_format_ext() - Returns dpu format structure pointer. 22 * @format: DRM FourCC Code 23 * @modifiers: format modifier array from client, one per plane 24 */ 25 const struct dpu_format *dpu_get_dpu_format_ext( 26 const uint32_t format, 27 const uint64_t modifier); 28 29 #define dpu_get_dpu_format(f) dpu_get_dpu_format_ext(f, 0) 30 31 /** 32 * dpu_get_msm_format - get an dpu_format by its msm_format base 33 * callback function registers with the msm_kms layer 34 * @kms: kms driver 35 * @format: DRM FourCC Code 36 * @modifiers: data layout modifier 37 */ 38 const struct msm_format *dpu_get_msm_format( 39 struct msm_kms *kms, 40 const uint32_t format, 41 const uint64_t modifiers); 42 43 /** 44 * dpu_format_check_modified_format - validate format and buffers for 45 * dpu non-standard, i.e. modified format 46 * @kms: kms driver 47 * @msm_fmt: pointer to the msm_fmt base pointer of an dpu_format 48 * @cmd: fb_cmd2 structure user request 49 * @bos: gem buffer object list 50 * 51 * Return: error code on failure, 0 on success 52 */ 53 int dpu_format_check_modified_format( 54 const struct msm_kms *kms, 55 const struct msm_format *msm_fmt, 56 const struct drm_mode_fb_cmd2 *cmd, 57 struct drm_gem_object **bos); 58 59 /** 60 * dpu_format_populate_layout - populate the given format layout based on 61 * mmu, fb, and format found in the fb 62 * @aspace: address space pointer 63 * @fb: framebuffer pointer 64 * @fmtl: format layout structure to populate 65 * 66 * Return: error code on failure, -EAGAIN if success but the addresses 67 * are the same as before or 0 if new addresses were populated 68 */ 69 int dpu_format_populate_layout( 70 struct msm_gem_address_space *aspace, 71 struct drm_framebuffer *fb, 72 struct dpu_hw_fmt_layout *fmtl); 73 74 #endif /*_DPU_FORMATS_H */ 75