Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: MIT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright © 2014-2018 Broadcom
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright © 2019 Collabora ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef _PANFROST_DRM_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define _PANFROST_DRM_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "drm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #if defined(__cplusplus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) extern "C" {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define DRM_PANFROST_SUBMIT			0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define DRM_PANFROST_WAIT_BO			0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define DRM_PANFROST_CREATE_BO			0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define DRM_PANFROST_MMAP_BO			0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define DRM_PANFROST_GET_PARAM			0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define DRM_PANFROST_GET_BO_OFFSET		0x05
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define DRM_PANFROST_PERFCNT_ENABLE		0x06
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define DRM_PANFROST_PERFCNT_DUMP		0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define DRM_PANFROST_MADVISE			0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define DRM_IOCTL_PANFROST_SUBMIT		DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define DRM_IOCTL_PANFROST_WAIT_BO		DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define DRM_IOCTL_PANFROST_CREATE_BO		DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define DRM_IOCTL_PANFROST_MMAP_BO		DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define DRM_IOCTL_PANFROST_GET_PARAM		DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define DRM_IOCTL_PANFROST_GET_BO_OFFSET	DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define DRM_IOCTL_PANFROST_MADVISE		DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MADVISE, struct drm_panfrost_madvise)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * param is set to true.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * All these ioctl(s) are subject to deprecation, so please don't rely on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * them for anything but debugging purpose.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define DRM_IOCTL_PANFROST_PERFCNT_ENABLE	DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define DRM_IOCTL_PANFROST_PERFCNT_DUMP		DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct drm_panfrost_perfcnt_dump)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define PANFROST_JD_REQ_FS (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * engine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * This asks the kernel to have the GPU execute a render command list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) struct drm_panfrost_submit {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	/** Address to GPU mapping of job descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	__u64 jc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	/** An optional array of sync objects to wait on before starting this job. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	__u64 in_syncs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	/** Number of sync objects to wait on before starting this job. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	__u32 in_sync_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/** An optional sync object to place the completion fence in. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	__u32 out_sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/** Pointer to a u32 array of the BOs that are referenced by the job. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	__u64 bo_handles;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	/** Number of BO handles passed in (size is that times 4). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	__u32 bo_handle_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	/** A combination of PANFROST_JD_REQ_* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	__u32 requirements;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * struct drm_panfrost_wait_bo - ioctl argument for waiting for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * completion of the last DRM_PANFROST_SUBMIT on a BO.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * This is useful for cases where multiple processes might be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * rendering to a BO and you want to wait for all rendering to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * completed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) struct drm_panfrost_wait_bo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	__u32 handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	__u32 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	__s64 timeout_ns;	/* absolute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define PANFROST_BO_NOEXEC	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #define PANFROST_BO_HEAP	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * There are currently no values for the flags argument, but it may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * used in a future extension.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) struct drm_panfrost_create_bo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	__u32 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	__u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	/** Returned GEM handle for the BO. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	__u32 handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	/* Pad, must be zero-filled. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	__u32 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * Returned offset for the BO in the GPU address space.  This offset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 * is private to the DRM fd and is valid for the lifetime of the GEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	 * handle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	 * This offset value will always be nonzero, since various HW
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 * units treat 0 specially.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	__u64 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  * struct drm_panfrost_mmap_bo - ioctl argument for mapping Panfrost BOs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  * This doesn't actually perform an mmap.  Instead, it returns the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  * offset you need to use in an mmap on the DRM device node.  This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * means that tools like valgrind end up knowing about the mapped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * There are currently no values for the flags argument, but it may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * used in a future extension.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) struct drm_panfrost_mmap_bo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	/** Handle for the object being mapped. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	__u32 handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	__u32 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	/** offset into the drm node to use for subsequent mmap call. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	__u64 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) enum drm_panfrost_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	DRM_PANFROST_PARAM_GPU_PROD_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	DRM_PANFROST_PARAM_GPU_REVISION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	DRM_PANFROST_PARAM_SHADER_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	DRM_PANFROST_PARAM_TILER_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	DRM_PANFROST_PARAM_L2_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	DRM_PANFROST_PARAM_STACK_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	DRM_PANFROST_PARAM_AS_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	DRM_PANFROST_PARAM_JS_PRESENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	DRM_PANFROST_PARAM_L2_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	DRM_PANFROST_PARAM_CORE_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	DRM_PANFROST_PARAM_TILER_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	DRM_PANFROST_PARAM_MEM_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	DRM_PANFROST_PARAM_MMU_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	DRM_PANFROST_PARAM_THREAD_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	DRM_PANFROST_PARAM_MAX_THREADS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	DRM_PANFROST_PARAM_THREAD_MAX_WORKGROUP_SZ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	DRM_PANFROST_PARAM_THREAD_MAX_BARRIER_SZ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	DRM_PANFROST_PARAM_COHERENCY_FEATURES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	DRM_PANFROST_PARAM_TEXTURE_FEATURES0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	DRM_PANFROST_PARAM_TEXTURE_FEATURES1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	DRM_PANFROST_PARAM_TEXTURE_FEATURES2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	DRM_PANFROST_PARAM_TEXTURE_FEATURES3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	DRM_PANFROST_PARAM_JS_FEATURES0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	DRM_PANFROST_PARAM_JS_FEATURES1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	DRM_PANFROST_PARAM_JS_FEATURES2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	DRM_PANFROST_PARAM_JS_FEATURES3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	DRM_PANFROST_PARAM_JS_FEATURES4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	DRM_PANFROST_PARAM_JS_FEATURES5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	DRM_PANFROST_PARAM_JS_FEATURES6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	DRM_PANFROST_PARAM_JS_FEATURES7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	DRM_PANFROST_PARAM_JS_FEATURES8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	DRM_PANFROST_PARAM_JS_FEATURES9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	DRM_PANFROST_PARAM_JS_FEATURES10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	DRM_PANFROST_PARAM_JS_FEATURES11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	DRM_PANFROST_PARAM_JS_FEATURES12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	DRM_PANFROST_PARAM_JS_FEATURES13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	DRM_PANFROST_PARAM_JS_FEATURES14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	DRM_PANFROST_PARAM_JS_FEATURES15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	DRM_PANFROST_PARAM_NR_CORE_GROUPS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	DRM_PANFROST_PARAM_THREAD_TLS_ALLOC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct drm_panfrost_get_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	__u32 param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	__u32 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	__u64 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * Returns the offset for the BO in the GPU address space for this DRM fd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  * This is the same value returned by drm_panfrost_create_bo, if that was called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * from this DRM fd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct drm_panfrost_get_bo_offset {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	__u32 handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	__u32 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	__u64 offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct drm_panfrost_perfcnt_enable {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	__u32 enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	 * On bifrost we have 2 sets of counters, this parameter defines the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	 * one to track.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	__u32 counterset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) struct drm_panfrost_perfcnt_dump {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	__u64 buf_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) /* madvise provides a way to tell the kernel in case a buffers contents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * can be discarded under memory pressure, which is useful for userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * bo cache where we want to optimistically hold on to buffer allocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * and potential mmap, but allow the pages to be discarded under memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * pressure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * Typical usage would involve madvise(DONTNEED) when buffer enters BO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  * In the WILLNEED case, 'retained' indicates to userspace whether the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  * backing pages still exist.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) #define PANFROST_MADV_WILLNEED 0	/* backing pages are needed, status returned in 'retained' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #define PANFROST_MADV_DONTNEED 1	/* backing pages not needed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct drm_panfrost_madvise {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	__u32 handle;         /* in, GEM handle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	__u32 madv;           /* in, PANFROST_MADV_x */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	__u32 retained;       /* out, whether backing store still exists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) #if defined(__cplusplus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #endif /* _PANFROST_DRM_H_ */