cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

dpu_formats.h (2644B)


      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_get_dpu_format_ext() - Returns dpu format structure pointer.
     14 * @format:          DRM FourCC Code
     15 * @modifiers:       format modifier array from client, one per plane
     16 */
     17const struct dpu_format *dpu_get_dpu_format_ext(
     18		const uint32_t format,
     19		const uint64_t modifier);
     20
     21#define dpu_get_dpu_format(f) dpu_get_dpu_format_ext(f, 0)
     22
     23/**
     24 * dpu_find_format - validate if the pixel format is supported
     25 * @format:		dpu format
     26 * @supported_formats:	supported formats by dpu HW
     27 * @num_formatss:	total number of formats
     28 *
     29 * Return: false if not valid format, true on success
     30 */
     31static inline bool dpu_find_format(u32 format, const u32 *supported_formats,
     32					size_t num_formats)
     33{
     34	int i;
     35
     36	for (i = 0; i < num_formats; i++) {
     37		/* check for valid formats supported */
     38		if (format == supported_formats[i])
     39			return true;
     40	}
     41
     42	return false;
     43}
     44
     45/**
     46 * dpu_get_msm_format - get an dpu_format by its msm_format base
     47 *                     callback function registers with the msm_kms layer
     48 * @kms:             kms driver
     49 * @format:          DRM FourCC Code
     50 * @modifiers:       data layout modifier
     51 */
     52const struct msm_format *dpu_get_msm_format(
     53		struct msm_kms *kms,
     54		const uint32_t format,
     55		const uint64_t modifiers);
     56
     57/**
     58 * dpu_format_check_modified_format - validate format and buffers for
     59 *                   dpu non-standard, i.e. modified format
     60 * @kms:             kms driver
     61 * @msm_fmt:         pointer to the msm_fmt base pointer of an dpu_format
     62 * @cmd:             fb_cmd2 structure user request
     63 * @bos:             gem buffer object list
     64 *
     65 * Return: error code on failure, 0 on success
     66 */
     67int dpu_format_check_modified_format(
     68		const struct msm_kms *kms,
     69		const struct msm_format *msm_fmt,
     70		const struct drm_mode_fb_cmd2 *cmd,
     71		struct drm_gem_object **bos);
     72
     73/**
     74 * dpu_format_populate_layout - populate the given format layout based on
     75 *                     mmu, fb, and format found in the fb
     76 * @aspace:            address space pointer
     77 * @fb:                framebuffer pointer
     78 * @fmtl:              format layout structure to populate
     79 *
     80 * Return: error code on failure, -EAGAIN if success but the addresses
     81 *         are the same as before or 0 if new addresses were populated
     82 */
     83int dpu_format_populate_layout(
     84		struct msm_gem_address_space *aspace,
     85		struct drm_framebuffer *fb,
     86		struct dpu_hw_fmt_layout *fmtl);
     87
     88#endif /*_DPU_FORMATS_H */