18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2015 Broadcom 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#ifndef _VC4_DRV_H_ 68c2ecf20Sopenharmony_ci#define _VC4_DRV_H_ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/delay.h> 98c2ecf20Sopenharmony_ci#include <linux/refcount.h> 108c2ecf20Sopenharmony_ci#include <linux/uaccess.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <drm/drm_atomic.h> 138c2ecf20Sopenharmony_ci#include <drm/drm_debugfs.h> 148c2ecf20Sopenharmony_ci#include <drm/drm_device.h> 158c2ecf20Sopenharmony_ci#include <drm/drm_encoder.h> 168c2ecf20Sopenharmony_ci#include <drm/drm_gem_cma_helper.h> 178c2ecf20Sopenharmony_ci#include <drm/drm_managed.h> 188c2ecf20Sopenharmony_ci#include <drm/drm_mm.h> 198c2ecf20Sopenharmony_ci#include <drm/drm_modeset_lock.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "uapi/drm/vc4_drm.h" 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cistruct drm_device; 248c2ecf20Sopenharmony_cistruct drm_gem_object; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Don't forget to update vc4_bo.c: bo_type_names[] when adding to 278c2ecf20Sopenharmony_ci * this. 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_cienum vc4_kernel_bo_type { 308c2ecf20Sopenharmony_ci /* Any kernel allocation (gem_create_object hook) before it 318c2ecf20Sopenharmony_ci * gets another type set. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci VC4_BO_TYPE_KERNEL, 348c2ecf20Sopenharmony_ci VC4_BO_TYPE_V3D, 358c2ecf20Sopenharmony_ci VC4_BO_TYPE_V3D_SHADER, 368c2ecf20Sopenharmony_ci VC4_BO_TYPE_DUMB, 378c2ecf20Sopenharmony_ci VC4_BO_TYPE_BIN, 388c2ecf20Sopenharmony_ci VC4_BO_TYPE_RCL, 398c2ecf20Sopenharmony_ci VC4_BO_TYPE_BCL, 408c2ecf20Sopenharmony_ci VC4_BO_TYPE_KERNEL_CACHE, 418c2ecf20Sopenharmony_ci VC4_BO_TYPE_COUNT 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* Performance monitor object. The perform lifetime is controlled by userspace 458c2ecf20Sopenharmony_ci * using perfmon related ioctls. A perfmon can be attached to a submit_cl 468c2ecf20Sopenharmony_ci * request, and when this is the case, HW perf counters will be activated just 478c2ecf20Sopenharmony_ci * before the submit_cl is submitted to the GPU and disabled when the job is 488c2ecf20Sopenharmony_ci * done. This way, only events related to a specific job will be counted. 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_cistruct vc4_perfmon { 518c2ecf20Sopenharmony_ci /* Tracks the number of users of the perfmon, when this counter reaches 528c2ecf20Sopenharmony_ci * zero the perfmon is destroyed. 538c2ecf20Sopenharmony_ci */ 548c2ecf20Sopenharmony_ci refcount_t refcnt; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci /* Number of counters activated in this perfmon instance 578c2ecf20Sopenharmony_ci * (should be less than DRM_VC4_MAX_PERF_COUNTERS). 588c2ecf20Sopenharmony_ci */ 598c2ecf20Sopenharmony_ci u8 ncounters; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci /* Events counted by the HW perf counters. */ 628c2ecf20Sopenharmony_ci u8 events[DRM_VC4_MAX_PERF_COUNTERS]; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci /* Storage for counter values. Counters are incremented by the HW 658c2ecf20Sopenharmony_ci * perf counter values every time the perfmon is attached to a GPU job. 668c2ecf20Sopenharmony_ci * This way, perfmon users don't have to retrieve the results after 678c2ecf20Sopenharmony_ci * each job if they want to track events covering several submissions. 688c2ecf20Sopenharmony_ci * Note that counter values can't be reset, but you can fake a reset by 698c2ecf20Sopenharmony_ci * destroying the perfmon and creating a new one. 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_ci u64 counters[]; 728c2ecf20Sopenharmony_ci}; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cistruct vc4_dev { 758c2ecf20Sopenharmony_ci struct drm_device base; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci struct vc4_hvs *hvs; 788c2ecf20Sopenharmony_ci struct vc4_v3d *v3d; 798c2ecf20Sopenharmony_ci struct vc4_dpi *dpi; 808c2ecf20Sopenharmony_ci struct vc4_vec *vec; 818c2ecf20Sopenharmony_ci struct vc4_txp *txp; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci struct vc4_hang_state *hang_state; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci /* The kernel-space BO cache. Tracks buffers that have been 868c2ecf20Sopenharmony_ci * unreferenced by all other users (refcounts of 0!) but not 878c2ecf20Sopenharmony_ci * yet freed, so we can do cheap allocations. 888c2ecf20Sopenharmony_ci */ 898c2ecf20Sopenharmony_ci struct vc4_bo_cache { 908c2ecf20Sopenharmony_ci /* Array of list heads for entries in the BO cache, 918c2ecf20Sopenharmony_ci * based on number of pages, so we can do O(1) lookups 928c2ecf20Sopenharmony_ci * in the cache when allocating. 938c2ecf20Sopenharmony_ci */ 948c2ecf20Sopenharmony_ci struct list_head *size_list; 958c2ecf20Sopenharmony_ci uint32_t size_list_size; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci /* List of all BOs in the cache, ordered by age, so we 988c2ecf20Sopenharmony_ci * can do O(1) lookups when trying to free old 998c2ecf20Sopenharmony_ci * buffers. 1008c2ecf20Sopenharmony_ci */ 1018c2ecf20Sopenharmony_ci struct list_head time_list; 1028c2ecf20Sopenharmony_ci struct work_struct time_work; 1038c2ecf20Sopenharmony_ci struct timer_list time_timer; 1048c2ecf20Sopenharmony_ci } bo_cache; 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci u32 num_labels; 1078c2ecf20Sopenharmony_ci struct vc4_label { 1088c2ecf20Sopenharmony_ci const char *name; 1098c2ecf20Sopenharmony_ci u32 num_allocated; 1108c2ecf20Sopenharmony_ci u32 size_allocated; 1118c2ecf20Sopenharmony_ci } *bo_labels; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci /* Protects bo_cache and bo_labels. */ 1148c2ecf20Sopenharmony_ci struct mutex bo_lock; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci /* Purgeable BO pool. All BOs in this pool can have their memory 1178c2ecf20Sopenharmony_ci * reclaimed if the driver is unable to allocate new BOs. We also 1188c2ecf20Sopenharmony_ci * keep stats related to the purge mechanism here. 1198c2ecf20Sopenharmony_ci */ 1208c2ecf20Sopenharmony_ci struct { 1218c2ecf20Sopenharmony_ci struct list_head list; 1228c2ecf20Sopenharmony_ci unsigned int num; 1238c2ecf20Sopenharmony_ci size_t size; 1248c2ecf20Sopenharmony_ci unsigned int purged_num; 1258c2ecf20Sopenharmony_ci size_t purged_size; 1268c2ecf20Sopenharmony_ci struct mutex lock; 1278c2ecf20Sopenharmony_ci } purgeable; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci uint64_t dma_fence_context; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* Sequence number for the last job queued in bin_job_list. 1328c2ecf20Sopenharmony_ci * Starts at 0 (no jobs emitted). 1338c2ecf20Sopenharmony_ci */ 1348c2ecf20Sopenharmony_ci uint64_t emit_seqno; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci /* Sequence number for the last completed job on the GPU. 1378c2ecf20Sopenharmony_ci * Starts at 0 (no jobs completed). 1388c2ecf20Sopenharmony_ci */ 1398c2ecf20Sopenharmony_ci uint64_t finished_seqno; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci /* List of all struct vc4_exec_info for jobs to be executed in 1428c2ecf20Sopenharmony_ci * the binner. The first job in the list is the one currently 1438c2ecf20Sopenharmony_ci * programmed into ct0ca for execution. 1448c2ecf20Sopenharmony_ci */ 1458c2ecf20Sopenharmony_ci struct list_head bin_job_list; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci /* List of all struct vc4_exec_info for jobs that have 1488c2ecf20Sopenharmony_ci * completed binning and are ready for rendering. The first 1498c2ecf20Sopenharmony_ci * job in the list is the one currently programmed into ct1ca 1508c2ecf20Sopenharmony_ci * for execution. 1518c2ecf20Sopenharmony_ci */ 1528c2ecf20Sopenharmony_ci struct list_head render_job_list; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci /* List of the finished vc4_exec_infos waiting to be freed by 1558c2ecf20Sopenharmony_ci * job_done_work. 1568c2ecf20Sopenharmony_ci */ 1578c2ecf20Sopenharmony_ci struct list_head job_done_list; 1588c2ecf20Sopenharmony_ci /* Spinlock used to synchronize the job_list and seqno 1598c2ecf20Sopenharmony_ci * accesses between the IRQ handler and GEM ioctls. 1608c2ecf20Sopenharmony_ci */ 1618c2ecf20Sopenharmony_ci spinlock_t job_lock; 1628c2ecf20Sopenharmony_ci wait_queue_head_t job_wait_queue; 1638c2ecf20Sopenharmony_ci struct work_struct job_done_work; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci /* Used to track the active perfmon if any. Access to this field is 1668c2ecf20Sopenharmony_ci * protected by job_lock. 1678c2ecf20Sopenharmony_ci */ 1688c2ecf20Sopenharmony_ci struct vc4_perfmon *active_perfmon; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci /* List of struct vc4_seqno_cb for callbacks to be made from a 1718c2ecf20Sopenharmony_ci * workqueue when the given seqno is passed. 1728c2ecf20Sopenharmony_ci */ 1738c2ecf20Sopenharmony_ci struct list_head seqno_cb_list; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci /* The memory used for storing binner tile alloc, tile state, 1768c2ecf20Sopenharmony_ci * and overflow memory allocations. This is freed when V3D 1778c2ecf20Sopenharmony_ci * powers down. 1788c2ecf20Sopenharmony_ci */ 1798c2ecf20Sopenharmony_ci struct vc4_bo *bin_bo; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci /* Size of blocks allocated within bin_bo. */ 1828c2ecf20Sopenharmony_ci uint32_t bin_alloc_size; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci /* Bitmask of the bin_alloc_size chunks in bin_bo that are 1858c2ecf20Sopenharmony_ci * used. 1868c2ecf20Sopenharmony_ci */ 1878c2ecf20Sopenharmony_ci uint32_t bin_alloc_used; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci /* Bitmask of the current bin_alloc used for overflow memory. */ 1908c2ecf20Sopenharmony_ci uint32_t bin_alloc_overflow; 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci /* Incremented when an underrun error happened after an atomic commit. 1938c2ecf20Sopenharmony_ci * This is particularly useful to detect when a specific modeset is too 1948c2ecf20Sopenharmony_ci * demanding in term of memory or HVS bandwidth which is hard to guess 1958c2ecf20Sopenharmony_ci * at atomic check time. 1968c2ecf20Sopenharmony_ci */ 1978c2ecf20Sopenharmony_ci atomic_t underrun; 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci struct work_struct overflow_mem_work; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci int power_refcount; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci /* Set to true when the load tracker is supported. */ 2048c2ecf20Sopenharmony_ci bool load_tracker_available; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci /* Set to true when the load tracker is active. */ 2078c2ecf20Sopenharmony_ci bool load_tracker_enabled; 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci /* Mutex controlling the power refcount. */ 2108c2ecf20Sopenharmony_ci struct mutex power_lock; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci struct { 2138c2ecf20Sopenharmony_ci struct timer_list timer; 2148c2ecf20Sopenharmony_ci struct work_struct reset_work; 2158c2ecf20Sopenharmony_ci } hangcheck; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci struct semaphore async_modeset; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci struct drm_modeset_lock ctm_state_lock; 2208c2ecf20Sopenharmony_ci struct drm_private_obj ctm_manager; 2218c2ecf20Sopenharmony_ci struct drm_private_obj hvs_channels; 2228c2ecf20Sopenharmony_ci struct drm_private_obj load_tracker; 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci /* List of vc4_debugfs_info_entry for adding to debugfs once 2258c2ecf20Sopenharmony_ci * the minor is available (after drm_dev_register()). 2268c2ecf20Sopenharmony_ci */ 2278c2ecf20Sopenharmony_ci struct list_head debugfs_list; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci /* Mutex for binner bo allocation. */ 2308c2ecf20Sopenharmony_ci struct mutex bin_bo_lock; 2318c2ecf20Sopenharmony_ci /* Reference count for our binner bo. */ 2328c2ecf20Sopenharmony_ci struct kref bin_bo_kref; 2338c2ecf20Sopenharmony_ci}; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_cistatic inline struct vc4_dev * 2368c2ecf20Sopenharmony_cito_vc4_dev(struct drm_device *dev) 2378c2ecf20Sopenharmony_ci{ 2388c2ecf20Sopenharmony_ci return container_of(dev, struct vc4_dev, base); 2398c2ecf20Sopenharmony_ci} 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_cistruct vc4_bo { 2428c2ecf20Sopenharmony_ci struct drm_gem_cma_object base; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci /* seqno of the last job to render using this BO. */ 2458c2ecf20Sopenharmony_ci uint64_t seqno; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci /* seqno of the last job to use the RCL to write to this BO. 2488c2ecf20Sopenharmony_ci * 2498c2ecf20Sopenharmony_ci * Note that this doesn't include binner overflow memory 2508c2ecf20Sopenharmony_ci * writes. 2518c2ecf20Sopenharmony_ci */ 2528c2ecf20Sopenharmony_ci uint64_t write_seqno; 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci bool t_format; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci /* List entry for the BO's position in either 2578c2ecf20Sopenharmony_ci * vc4_exec_info->unref_list or vc4_dev->bo_cache.time_list 2588c2ecf20Sopenharmony_ci */ 2598c2ecf20Sopenharmony_ci struct list_head unref_head; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci /* Time in jiffies when the BO was put in vc4->bo_cache. */ 2628c2ecf20Sopenharmony_ci unsigned long free_time; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci /* List entry for the BO's position in vc4_dev->bo_cache.size_list */ 2658c2ecf20Sopenharmony_ci struct list_head size_head; 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci /* Struct for shader validation state, if created by 2688c2ecf20Sopenharmony_ci * DRM_IOCTL_VC4_CREATE_SHADER_BO. 2698c2ecf20Sopenharmony_ci */ 2708c2ecf20Sopenharmony_ci struct vc4_validated_shader_info *validated_shader; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i 2738c2ecf20Sopenharmony_ci * for user-allocated labels. 2748c2ecf20Sopenharmony_ci */ 2758c2ecf20Sopenharmony_ci int label; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci /* Count the number of active users. This is needed to determine 2788c2ecf20Sopenharmony_ci * whether we can move the BO to the purgeable list or not (when the BO 2798c2ecf20Sopenharmony_ci * is used by the GPU or the display engine we can't purge it). 2808c2ecf20Sopenharmony_ci */ 2818c2ecf20Sopenharmony_ci refcount_t usecnt; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci /* Store purgeable/purged state here */ 2848c2ecf20Sopenharmony_ci u32 madv; 2858c2ecf20Sopenharmony_ci struct mutex madv_lock; 2868c2ecf20Sopenharmony_ci}; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_cistatic inline struct vc4_bo * 2898c2ecf20Sopenharmony_cito_vc4_bo(struct drm_gem_object *bo) 2908c2ecf20Sopenharmony_ci{ 2918c2ecf20Sopenharmony_ci return container_of(to_drm_gem_cma_obj(bo), struct vc4_bo, base); 2928c2ecf20Sopenharmony_ci} 2938c2ecf20Sopenharmony_ci 2948c2ecf20Sopenharmony_cistruct vc4_fence { 2958c2ecf20Sopenharmony_ci struct dma_fence base; 2968c2ecf20Sopenharmony_ci struct drm_device *dev; 2978c2ecf20Sopenharmony_ci /* vc4 seqno for signaled() test */ 2988c2ecf20Sopenharmony_ci uint64_t seqno; 2998c2ecf20Sopenharmony_ci}; 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_cistatic inline struct vc4_fence * 3028c2ecf20Sopenharmony_cito_vc4_fence(struct dma_fence *fence) 3038c2ecf20Sopenharmony_ci{ 3048c2ecf20Sopenharmony_ci return container_of(fence, struct vc4_fence, base); 3058c2ecf20Sopenharmony_ci} 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_cistruct vc4_seqno_cb { 3088c2ecf20Sopenharmony_ci struct work_struct work; 3098c2ecf20Sopenharmony_ci uint64_t seqno; 3108c2ecf20Sopenharmony_ci void (*func)(struct vc4_seqno_cb *cb); 3118c2ecf20Sopenharmony_ci}; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistruct vc4_v3d { 3148c2ecf20Sopenharmony_ci struct vc4_dev *vc4; 3158c2ecf20Sopenharmony_ci struct platform_device *pdev; 3168c2ecf20Sopenharmony_ci void __iomem *regs; 3178c2ecf20Sopenharmony_ci struct clk *clk; 3188c2ecf20Sopenharmony_ci struct debugfs_regset32 regset; 3198c2ecf20Sopenharmony_ci}; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_cistruct vc4_hvs { 3228c2ecf20Sopenharmony_ci struct platform_device *pdev; 3238c2ecf20Sopenharmony_ci void __iomem *regs; 3248c2ecf20Sopenharmony_ci u32 __iomem *dlist; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci struct clk *core_clk; 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci /* Memory manager for CRTCs to allocate space in the display 3298c2ecf20Sopenharmony_ci * list. Units are dwords. 3308c2ecf20Sopenharmony_ci */ 3318c2ecf20Sopenharmony_ci struct drm_mm dlist_mm; 3328c2ecf20Sopenharmony_ci /* Memory manager for the LBM memory used by HVS scaling. */ 3338c2ecf20Sopenharmony_ci struct drm_mm lbm_mm; 3348c2ecf20Sopenharmony_ci spinlock_t mm_lock; 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ci struct drm_mm_node mitchell_netravali_filter; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci struct debugfs_regset32 regset; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci /* HVS version 5 flag, therefore requires updated dlist structures */ 3418c2ecf20Sopenharmony_ci bool hvs5; 3428c2ecf20Sopenharmony_ci}; 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_cistruct vc4_plane { 3458c2ecf20Sopenharmony_ci struct drm_plane base; 3468c2ecf20Sopenharmony_ci}; 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistatic inline struct vc4_plane * 3498c2ecf20Sopenharmony_cito_vc4_plane(struct drm_plane *plane) 3508c2ecf20Sopenharmony_ci{ 3518c2ecf20Sopenharmony_ci return container_of(plane, struct vc4_plane, base); 3528c2ecf20Sopenharmony_ci} 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_cienum vc4_scaling_mode { 3558c2ecf20Sopenharmony_ci VC4_SCALING_NONE, 3568c2ecf20Sopenharmony_ci VC4_SCALING_TPZ, 3578c2ecf20Sopenharmony_ci VC4_SCALING_PPF, 3588c2ecf20Sopenharmony_ci}; 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_cistruct vc4_plane_state { 3618c2ecf20Sopenharmony_ci struct drm_plane_state base; 3628c2ecf20Sopenharmony_ci /* System memory copy of the display list for this element, computed 3638c2ecf20Sopenharmony_ci * at atomic_check time. 3648c2ecf20Sopenharmony_ci */ 3658c2ecf20Sopenharmony_ci u32 *dlist; 3668c2ecf20Sopenharmony_ci u32 dlist_size; /* Number of dwords allocated for the display list */ 3678c2ecf20Sopenharmony_ci u32 dlist_count; /* Number of used dwords in the display list. */ 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci /* Offset in the dlist to various words, for pageflip or 3708c2ecf20Sopenharmony_ci * cursor updates. 3718c2ecf20Sopenharmony_ci */ 3728c2ecf20Sopenharmony_ci u32 pos0_offset; 3738c2ecf20Sopenharmony_ci u32 pos2_offset; 3748c2ecf20Sopenharmony_ci u32 ptr0_offset; 3758c2ecf20Sopenharmony_ci u32 lbm_offset; 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci /* Offset where the plane's dlist was last stored in the 3788c2ecf20Sopenharmony_ci * hardware at vc4_crtc_atomic_flush() time. 3798c2ecf20Sopenharmony_ci */ 3808c2ecf20Sopenharmony_ci u32 __iomem *hw_dlist; 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci /* Clipped coordinates of the plane on the display. */ 3838c2ecf20Sopenharmony_ci int crtc_x, crtc_y, crtc_w, crtc_h; 3848c2ecf20Sopenharmony_ci /* Clipped area being scanned from in the FB. */ 3858c2ecf20Sopenharmony_ci u32 src_x, src_y; 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci u32 src_w[2], src_h[2]; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci /* Scaling selection for the RGB/Y plane and the Cb/Cr planes. */ 3908c2ecf20Sopenharmony_ci enum vc4_scaling_mode x_scaling[2], y_scaling[2]; 3918c2ecf20Sopenharmony_ci bool is_unity; 3928c2ecf20Sopenharmony_ci bool is_yuv; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci /* Offset to start scanning out from the start of the plane's 3958c2ecf20Sopenharmony_ci * BO. 3968c2ecf20Sopenharmony_ci */ 3978c2ecf20Sopenharmony_ci u32 offsets[3]; 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci /* Our allocation in LBM for temporary storage during scaling. */ 4008c2ecf20Sopenharmony_ci struct drm_mm_node lbm; 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci /* Set when the plane has per-pixel alpha content or does not cover 4038c2ecf20Sopenharmony_ci * the entire screen. This is a hint to the CRTC that it might need 4048c2ecf20Sopenharmony_ci * to enable background color fill. 4058c2ecf20Sopenharmony_ci */ 4068c2ecf20Sopenharmony_ci bool needs_bg_fill; 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci /* Mark the dlist as initialized. Useful to avoid initializing it twice 4098c2ecf20Sopenharmony_ci * when async update is not possible. 4108c2ecf20Sopenharmony_ci */ 4118c2ecf20Sopenharmony_ci bool dlist_initialized; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci /* Load of this plane on the HVS block. The load is expressed in HVS 4148c2ecf20Sopenharmony_ci * cycles/sec. 4158c2ecf20Sopenharmony_ci */ 4168c2ecf20Sopenharmony_ci u64 hvs_load; 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci /* Memory bandwidth needed for this plane. This is expressed in 4198c2ecf20Sopenharmony_ci * bytes/sec. 4208c2ecf20Sopenharmony_ci */ 4218c2ecf20Sopenharmony_ci u64 membus_load; 4228c2ecf20Sopenharmony_ci}; 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_cistatic inline struct vc4_plane_state * 4258c2ecf20Sopenharmony_cito_vc4_plane_state(struct drm_plane_state *state) 4268c2ecf20Sopenharmony_ci{ 4278c2ecf20Sopenharmony_ci return container_of(state, struct vc4_plane_state, base); 4288c2ecf20Sopenharmony_ci} 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_cienum vc4_encoder_type { 4318c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_NONE, 4328c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_HDMI0, 4338c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_HDMI1, 4348c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_VEC, 4358c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_DSI0, 4368c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_DSI1, 4378c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_SMI, 4388c2ecf20Sopenharmony_ci VC4_ENCODER_TYPE_DPI, 4398c2ecf20Sopenharmony_ci}; 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_cistruct vc4_encoder { 4428c2ecf20Sopenharmony_ci struct drm_encoder base; 4438c2ecf20Sopenharmony_ci enum vc4_encoder_type type; 4448c2ecf20Sopenharmony_ci u32 clock_select; 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci void (*pre_crtc_configure)(struct drm_encoder *encoder); 4478c2ecf20Sopenharmony_ci void (*pre_crtc_enable)(struct drm_encoder *encoder); 4488c2ecf20Sopenharmony_ci void (*post_crtc_enable)(struct drm_encoder *encoder); 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci void (*post_crtc_disable)(struct drm_encoder *encoder); 4518c2ecf20Sopenharmony_ci void (*post_crtc_powerdown)(struct drm_encoder *encoder); 4528c2ecf20Sopenharmony_ci}; 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_cistatic inline struct vc4_encoder * 4558c2ecf20Sopenharmony_cito_vc4_encoder(struct drm_encoder *encoder) 4568c2ecf20Sopenharmony_ci{ 4578c2ecf20Sopenharmony_ci return container_of(encoder, struct vc4_encoder, base); 4588c2ecf20Sopenharmony_ci} 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_cistruct vc4_crtc_data { 4618c2ecf20Sopenharmony_ci /* Bitmask of channels (FIFOs) of the HVS that the output can source from */ 4628c2ecf20Sopenharmony_ci unsigned int hvs_available_channels; 4638c2ecf20Sopenharmony_ci 4648c2ecf20Sopenharmony_ci /* Which output of the HVS this pixelvalve sources from. */ 4658c2ecf20Sopenharmony_ci int hvs_output; 4668c2ecf20Sopenharmony_ci}; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cistruct vc4_pv_data { 4698c2ecf20Sopenharmony_ci struct vc4_crtc_data base; 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci /* Depth of the PixelValve FIFO in bytes */ 4728c2ecf20Sopenharmony_ci unsigned int fifo_depth; 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ci /* Number of pixels output per clock period */ 4758c2ecf20Sopenharmony_ci u8 pixels_per_clock; 4768c2ecf20Sopenharmony_ci 4778c2ecf20Sopenharmony_ci enum vc4_encoder_type encoder_types[4]; 4788c2ecf20Sopenharmony_ci const char *debugfs_name; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci}; 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_cistruct vc4_crtc { 4838c2ecf20Sopenharmony_ci struct drm_crtc base; 4848c2ecf20Sopenharmony_ci struct platform_device *pdev; 4858c2ecf20Sopenharmony_ci const struct vc4_crtc_data *data; 4868c2ecf20Sopenharmony_ci void __iomem *regs; 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci /* Timestamp at start of vblank irq - unaffected by lock delays. */ 4898c2ecf20Sopenharmony_ci ktime_t t_vblank; 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci u8 lut_r[256]; 4928c2ecf20Sopenharmony_ci u8 lut_g[256]; 4938c2ecf20Sopenharmony_ci u8 lut_b[256]; 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ci struct drm_pending_vblank_event *event; 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci struct debugfs_regset32 regset; 4988c2ecf20Sopenharmony_ci}; 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_cistatic inline struct vc4_crtc * 5018c2ecf20Sopenharmony_cito_vc4_crtc(struct drm_crtc *crtc) 5028c2ecf20Sopenharmony_ci{ 5038c2ecf20Sopenharmony_ci return container_of(crtc, struct vc4_crtc, base); 5048c2ecf20Sopenharmony_ci} 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_cistatic inline const struct vc4_crtc_data * 5078c2ecf20Sopenharmony_civc4_crtc_to_vc4_crtc_data(const struct vc4_crtc *crtc) 5088c2ecf20Sopenharmony_ci{ 5098c2ecf20Sopenharmony_ci return crtc->data; 5108c2ecf20Sopenharmony_ci} 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_cistatic inline const struct vc4_pv_data * 5138c2ecf20Sopenharmony_civc4_crtc_to_vc4_pv_data(const struct vc4_crtc *crtc) 5148c2ecf20Sopenharmony_ci{ 5158c2ecf20Sopenharmony_ci const struct vc4_crtc_data *data = vc4_crtc_to_vc4_crtc_data(crtc); 5168c2ecf20Sopenharmony_ci 5178c2ecf20Sopenharmony_ci return container_of(data, struct vc4_pv_data, base); 5188c2ecf20Sopenharmony_ci} 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_cistruct vc4_crtc_state { 5218c2ecf20Sopenharmony_ci struct drm_crtc_state base; 5228c2ecf20Sopenharmony_ci /* Dlist area for this CRTC configuration. */ 5238c2ecf20Sopenharmony_ci struct drm_mm_node mm; 5248c2ecf20Sopenharmony_ci bool feed_txp; 5258c2ecf20Sopenharmony_ci bool txp_armed; 5268c2ecf20Sopenharmony_ci unsigned int assigned_channel; 5278c2ecf20Sopenharmony_ci 5288c2ecf20Sopenharmony_ci struct { 5298c2ecf20Sopenharmony_ci unsigned int left; 5308c2ecf20Sopenharmony_ci unsigned int right; 5318c2ecf20Sopenharmony_ci unsigned int top; 5328c2ecf20Sopenharmony_ci unsigned int bottom; 5338c2ecf20Sopenharmony_ci } margins; 5348c2ecf20Sopenharmony_ci 5358c2ecf20Sopenharmony_ci /* Transitional state below, only valid during atomic commits */ 5368c2ecf20Sopenharmony_ci bool update_muxing; 5378c2ecf20Sopenharmony_ci}; 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci#define VC4_HVS_CHANNEL_DISABLED ((unsigned int)-1) 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_cistatic inline struct vc4_crtc_state * 5428c2ecf20Sopenharmony_cito_vc4_crtc_state(struct drm_crtc_state *crtc_state) 5438c2ecf20Sopenharmony_ci{ 5448c2ecf20Sopenharmony_ci return container_of(crtc_state, struct vc4_crtc_state, base); 5458c2ecf20Sopenharmony_ci} 5468c2ecf20Sopenharmony_ci 5478c2ecf20Sopenharmony_ci#define V3D_READ(offset) readl(vc4->v3d->regs + offset) 5488c2ecf20Sopenharmony_ci#define V3D_WRITE(offset, val) writel(val, vc4->v3d->regs + offset) 5498c2ecf20Sopenharmony_ci#define HVS_READ(offset) readl(vc4->hvs->regs + offset) 5508c2ecf20Sopenharmony_ci#define HVS_WRITE(offset, val) writel(val, vc4->hvs->regs + offset) 5518c2ecf20Sopenharmony_ci 5528c2ecf20Sopenharmony_ci#define VC4_REG32(reg) { .name = #reg, .offset = reg } 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_cistruct vc4_exec_info { 5558c2ecf20Sopenharmony_ci /* Sequence number for this bin/render job. */ 5568c2ecf20Sopenharmony_ci uint64_t seqno; 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci /* Latest write_seqno of any BO that binning depends on. */ 5598c2ecf20Sopenharmony_ci uint64_t bin_dep_seqno; 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci struct dma_fence *fence; 5628c2ecf20Sopenharmony_ci 5638c2ecf20Sopenharmony_ci /* Last current addresses the hardware was processing when the 5648c2ecf20Sopenharmony_ci * hangcheck timer checked on us. 5658c2ecf20Sopenharmony_ci */ 5668c2ecf20Sopenharmony_ci uint32_t last_ct0ca, last_ct1ca; 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci /* Kernel-space copy of the ioctl arguments */ 5698c2ecf20Sopenharmony_ci struct drm_vc4_submit_cl *args; 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci /* This is the array of BOs that were looked up at the start of exec. 5728c2ecf20Sopenharmony_ci * Command validation will use indices into this array. 5738c2ecf20Sopenharmony_ci */ 5748c2ecf20Sopenharmony_ci struct drm_gem_cma_object **bo; 5758c2ecf20Sopenharmony_ci uint32_t bo_count; 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci /* List of BOs that are being written by the RCL. Other than 5788c2ecf20Sopenharmony_ci * the binner temporary storage, this is all the BOs written 5798c2ecf20Sopenharmony_ci * by the job. 5808c2ecf20Sopenharmony_ci */ 5818c2ecf20Sopenharmony_ci struct drm_gem_cma_object *rcl_write_bo[4]; 5828c2ecf20Sopenharmony_ci uint32_t rcl_write_bo_count; 5838c2ecf20Sopenharmony_ci 5848c2ecf20Sopenharmony_ci /* Pointers for our position in vc4->job_list */ 5858c2ecf20Sopenharmony_ci struct list_head head; 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci /* List of other BOs used in the job that need to be released 5888c2ecf20Sopenharmony_ci * once the job is complete. 5898c2ecf20Sopenharmony_ci */ 5908c2ecf20Sopenharmony_ci struct list_head unref_list; 5918c2ecf20Sopenharmony_ci 5928c2ecf20Sopenharmony_ci /* Current unvalidated indices into @bo loaded by the non-hardware 5938c2ecf20Sopenharmony_ci * VC4_PACKET_GEM_HANDLES. 5948c2ecf20Sopenharmony_ci */ 5958c2ecf20Sopenharmony_ci uint32_t bo_index[2]; 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci /* This is the BO where we store the validated command lists, shader 5988c2ecf20Sopenharmony_ci * records, and uniforms. 5998c2ecf20Sopenharmony_ci */ 6008c2ecf20Sopenharmony_ci struct drm_gem_cma_object *exec_bo; 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci /** 6038c2ecf20Sopenharmony_ci * This tracks the per-shader-record state (packet 64) that 6048c2ecf20Sopenharmony_ci * determines the length of the shader record and the offset 6058c2ecf20Sopenharmony_ci * it's expected to be found at. It gets read in from the 6068c2ecf20Sopenharmony_ci * command lists. 6078c2ecf20Sopenharmony_ci */ 6088c2ecf20Sopenharmony_ci struct vc4_shader_state { 6098c2ecf20Sopenharmony_ci uint32_t addr; 6108c2ecf20Sopenharmony_ci /* Maximum vertex index referenced by any primitive using this 6118c2ecf20Sopenharmony_ci * shader state. 6128c2ecf20Sopenharmony_ci */ 6138c2ecf20Sopenharmony_ci uint32_t max_index; 6148c2ecf20Sopenharmony_ci } *shader_state; 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ci /** How many shader states the user declared they were using. */ 6178c2ecf20Sopenharmony_ci uint32_t shader_state_size; 6188c2ecf20Sopenharmony_ci /** How many shader state records the validator has seen. */ 6198c2ecf20Sopenharmony_ci uint32_t shader_state_count; 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci bool found_tile_binning_mode_config_packet; 6228c2ecf20Sopenharmony_ci bool found_start_tile_binning_packet; 6238c2ecf20Sopenharmony_ci bool found_increment_semaphore_packet; 6248c2ecf20Sopenharmony_ci bool found_flush; 6258c2ecf20Sopenharmony_ci uint8_t bin_tiles_x, bin_tiles_y; 6268c2ecf20Sopenharmony_ci /* Physical address of the start of the tile alloc array 6278c2ecf20Sopenharmony_ci * (where each tile's binned CL will start) 6288c2ecf20Sopenharmony_ci */ 6298c2ecf20Sopenharmony_ci uint32_t tile_alloc_offset; 6308c2ecf20Sopenharmony_ci /* Bitmask of which binner slots are freed when this job completes. */ 6318c2ecf20Sopenharmony_ci uint32_t bin_slots; 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci /** 6348c2ecf20Sopenharmony_ci * Computed addresses pointing into exec_bo where we start the 6358c2ecf20Sopenharmony_ci * bin thread (ct0) and render thread (ct1). 6368c2ecf20Sopenharmony_ci */ 6378c2ecf20Sopenharmony_ci uint32_t ct0ca, ct0ea; 6388c2ecf20Sopenharmony_ci uint32_t ct1ca, ct1ea; 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_ci /* Pointer to the unvalidated bin CL (if present). */ 6418c2ecf20Sopenharmony_ci void *bin_u; 6428c2ecf20Sopenharmony_ci 6438c2ecf20Sopenharmony_ci /* Pointers to the shader recs. These paddr gets incremented as CL 6448c2ecf20Sopenharmony_ci * packets are relocated in validate_gl_shader_state, and the vaddrs 6458c2ecf20Sopenharmony_ci * (u and v) get incremented and size decremented as the shader recs 6468c2ecf20Sopenharmony_ci * themselves are validated. 6478c2ecf20Sopenharmony_ci */ 6488c2ecf20Sopenharmony_ci void *shader_rec_u; 6498c2ecf20Sopenharmony_ci void *shader_rec_v; 6508c2ecf20Sopenharmony_ci uint32_t shader_rec_p; 6518c2ecf20Sopenharmony_ci uint32_t shader_rec_size; 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci /* Pointers to the uniform data. These pointers are incremented, and 6548c2ecf20Sopenharmony_ci * size decremented, as each batch of uniforms is uploaded. 6558c2ecf20Sopenharmony_ci */ 6568c2ecf20Sopenharmony_ci void *uniforms_u; 6578c2ecf20Sopenharmony_ci void *uniforms_v; 6588c2ecf20Sopenharmony_ci uint32_t uniforms_p; 6598c2ecf20Sopenharmony_ci uint32_t uniforms_size; 6608c2ecf20Sopenharmony_ci 6618c2ecf20Sopenharmony_ci /* Pointer to a performance monitor object if the user requested it, 6628c2ecf20Sopenharmony_ci * NULL otherwise. 6638c2ecf20Sopenharmony_ci */ 6648c2ecf20Sopenharmony_ci struct vc4_perfmon *perfmon; 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci /* Whether the exec has taken a reference to the binner BO, which should 6678c2ecf20Sopenharmony_ci * happen with a VC4_PACKET_TILE_BINNING_MODE_CONFIG packet. 6688c2ecf20Sopenharmony_ci */ 6698c2ecf20Sopenharmony_ci bool bin_bo_used; 6708c2ecf20Sopenharmony_ci}; 6718c2ecf20Sopenharmony_ci 6728c2ecf20Sopenharmony_ci/* Per-open file private data. Any driver-specific resource that has to be 6738c2ecf20Sopenharmony_ci * released when the DRM file is closed should be placed here. 6748c2ecf20Sopenharmony_ci */ 6758c2ecf20Sopenharmony_cistruct vc4_file { 6768c2ecf20Sopenharmony_ci struct { 6778c2ecf20Sopenharmony_ci struct idr idr; 6788c2ecf20Sopenharmony_ci struct mutex lock; 6798c2ecf20Sopenharmony_ci } perfmon; 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ci bool bin_bo_used; 6828c2ecf20Sopenharmony_ci}; 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_cistatic inline struct vc4_exec_info * 6858c2ecf20Sopenharmony_civc4_first_bin_job(struct vc4_dev *vc4) 6868c2ecf20Sopenharmony_ci{ 6878c2ecf20Sopenharmony_ci return list_first_entry_or_null(&vc4->bin_job_list, 6888c2ecf20Sopenharmony_ci struct vc4_exec_info, head); 6898c2ecf20Sopenharmony_ci} 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_cistatic inline struct vc4_exec_info * 6928c2ecf20Sopenharmony_civc4_first_render_job(struct vc4_dev *vc4) 6938c2ecf20Sopenharmony_ci{ 6948c2ecf20Sopenharmony_ci return list_first_entry_or_null(&vc4->render_job_list, 6958c2ecf20Sopenharmony_ci struct vc4_exec_info, head); 6968c2ecf20Sopenharmony_ci} 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_cistatic inline struct vc4_exec_info * 6998c2ecf20Sopenharmony_civc4_last_render_job(struct vc4_dev *vc4) 7008c2ecf20Sopenharmony_ci{ 7018c2ecf20Sopenharmony_ci if (list_empty(&vc4->render_job_list)) 7028c2ecf20Sopenharmony_ci return NULL; 7038c2ecf20Sopenharmony_ci return list_last_entry(&vc4->render_job_list, 7048c2ecf20Sopenharmony_ci struct vc4_exec_info, head); 7058c2ecf20Sopenharmony_ci} 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_ci/** 7088c2ecf20Sopenharmony_ci * struct vc4_texture_sample_info - saves the offsets into the UBO for texture 7098c2ecf20Sopenharmony_ci * setup parameters. 7108c2ecf20Sopenharmony_ci * 7118c2ecf20Sopenharmony_ci * This will be used at draw time to relocate the reference to the texture 7128c2ecf20Sopenharmony_ci * contents in p0, and validate that the offset combined with 7138c2ecf20Sopenharmony_ci * width/height/stride/etc. from p1 and p2/p3 doesn't sample outside the BO. 7148c2ecf20Sopenharmony_ci * Note that the hardware treats unprovided config parameters as 0, so not all 7158c2ecf20Sopenharmony_ci * of them need to be set up for every texure sample, and we'll store ~0 as 7168c2ecf20Sopenharmony_ci * the offset to mark the unused ones. 7178c2ecf20Sopenharmony_ci * 7188c2ecf20Sopenharmony_ci * See the VC4 3D architecture guide page 41 ("Texture and Memory Lookup Unit 7198c2ecf20Sopenharmony_ci * Setup") for definitions of the texture parameters. 7208c2ecf20Sopenharmony_ci */ 7218c2ecf20Sopenharmony_cistruct vc4_texture_sample_info { 7228c2ecf20Sopenharmony_ci bool is_direct; 7238c2ecf20Sopenharmony_ci uint32_t p_offset[4]; 7248c2ecf20Sopenharmony_ci}; 7258c2ecf20Sopenharmony_ci 7268c2ecf20Sopenharmony_ci/** 7278c2ecf20Sopenharmony_ci * struct vc4_validated_shader_info - information about validated shaders that 7288c2ecf20Sopenharmony_ci * needs to be used from command list validation. 7298c2ecf20Sopenharmony_ci * 7308c2ecf20Sopenharmony_ci * For a given shader, each time a shader state record references it, we need 7318c2ecf20Sopenharmony_ci * to verify that the shader doesn't read more uniforms than the shader state 7328c2ecf20Sopenharmony_ci * record's uniform BO pointer can provide, and we need to apply relocations 7338c2ecf20Sopenharmony_ci * and validate the shader state record's uniforms that define the texture 7348c2ecf20Sopenharmony_ci * samples. 7358c2ecf20Sopenharmony_ci */ 7368c2ecf20Sopenharmony_cistruct vc4_validated_shader_info { 7378c2ecf20Sopenharmony_ci uint32_t uniforms_size; 7388c2ecf20Sopenharmony_ci uint32_t uniforms_src_size; 7398c2ecf20Sopenharmony_ci uint32_t num_texture_samples; 7408c2ecf20Sopenharmony_ci struct vc4_texture_sample_info *texture_samples; 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_ci uint32_t num_uniform_addr_offsets; 7438c2ecf20Sopenharmony_ci uint32_t *uniform_addr_offsets; 7448c2ecf20Sopenharmony_ci 7458c2ecf20Sopenharmony_ci bool is_threaded; 7468c2ecf20Sopenharmony_ci}; 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_ci/** 7498c2ecf20Sopenharmony_ci * __wait_for - magic wait macro 7508c2ecf20Sopenharmony_ci * 7518c2ecf20Sopenharmony_ci * Macro to help avoid open coding check/wait/timeout patterns. Note that it's 7528c2ecf20Sopenharmony_ci * important that we check the condition again after having timed out, since the 7538c2ecf20Sopenharmony_ci * timeout could be due to preemption or similar and we've never had a chance to 7548c2ecf20Sopenharmony_ci * check the condition before the timeout. 7558c2ecf20Sopenharmony_ci */ 7568c2ecf20Sopenharmony_ci#define __wait_for(OP, COND, US, Wmin, Wmax) ({ \ 7578c2ecf20Sopenharmony_ci const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ 7588c2ecf20Sopenharmony_ci long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ 7598c2ecf20Sopenharmony_ci int ret__; \ 7608c2ecf20Sopenharmony_ci might_sleep(); \ 7618c2ecf20Sopenharmony_ci for (;;) { \ 7628c2ecf20Sopenharmony_ci const bool expired__ = ktime_after(ktime_get_raw(), end__); \ 7638c2ecf20Sopenharmony_ci OP; \ 7648c2ecf20Sopenharmony_ci /* Guarantee COND check prior to timeout */ \ 7658c2ecf20Sopenharmony_ci barrier(); \ 7668c2ecf20Sopenharmony_ci if (COND) { \ 7678c2ecf20Sopenharmony_ci ret__ = 0; \ 7688c2ecf20Sopenharmony_ci break; \ 7698c2ecf20Sopenharmony_ci } \ 7708c2ecf20Sopenharmony_ci if (expired__) { \ 7718c2ecf20Sopenharmony_ci ret__ = -ETIMEDOUT; \ 7728c2ecf20Sopenharmony_ci break; \ 7738c2ecf20Sopenharmony_ci } \ 7748c2ecf20Sopenharmony_ci usleep_range(wait__, wait__ * 2); \ 7758c2ecf20Sopenharmony_ci if (wait__ < (Wmax)) \ 7768c2ecf20Sopenharmony_ci wait__ <<= 1; \ 7778c2ecf20Sopenharmony_ci } \ 7788c2ecf20Sopenharmony_ci ret__; \ 7798c2ecf20Sopenharmony_ci}) 7808c2ecf20Sopenharmony_ci 7818c2ecf20Sopenharmony_ci#define _wait_for(COND, US, Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ 7828c2ecf20Sopenharmony_ci (Wmax)) 7838c2ecf20Sopenharmony_ci#define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000) 7848c2ecf20Sopenharmony_ci 7858c2ecf20Sopenharmony_ci/* vc4_bo.c */ 7868c2ecf20Sopenharmony_cistruct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); 7878c2ecf20Sopenharmony_civoid vc4_free_object(struct drm_gem_object *gem_obj); 7888c2ecf20Sopenharmony_cistruct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, 7898c2ecf20Sopenharmony_ci bool from_cache, enum vc4_kernel_bo_type type); 7908c2ecf20Sopenharmony_ciint vc4_dumb_create(struct drm_file *file_priv, 7918c2ecf20Sopenharmony_ci struct drm_device *dev, 7928c2ecf20Sopenharmony_ci struct drm_mode_create_dumb *args); 7938c2ecf20Sopenharmony_cistruct dma_buf *vc4_prime_export(struct drm_gem_object *obj, int flags); 7948c2ecf20Sopenharmony_ciint vc4_create_bo_ioctl(struct drm_device *dev, void *data, 7958c2ecf20Sopenharmony_ci struct drm_file *file_priv); 7968c2ecf20Sopenharmony_ciint vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, 7978c2ecf20Sopenharmony_ci struct drm_file *file_priv); 7988c2ecf20Sopenharmony_ciint vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, 7998c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8008c2ecf20Sopenharmony_ciint vc4_set_tiling_ioctl(struct drm_device *dev, void *data, 8018c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8028c2ecf20Sopenharmony_ciint vc4_get_tiling_ioctl(struct drm_device *dev, void *data, 8038c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8048c2ecf20Sopenharmony_ciint vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, 8058c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8068c2ecf20Sopenharmony_ciint vc4_label_bo_ioctl(struct drm_device *dev, void *data, 8078c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8088c2ecf20Sopenharmony_civm_fault_t vc4_fault(struct vm_fault *vmf); 8098c2ecf20Sopenharmony_ciint vc4_mmap(struct file *filp, struct vm_area_struct *vma); 8108c2ecf20Sopenharmony_ciint vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); 8118c2ecf20Sopenharmony_cistruct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, 8128c2ecf20Sopenharmony_ci struct dma_buf_attachment *attach, 8138c2ecf20Sopenharmony_ci struct sg_table *sgt); 8148c2ecf20Sopenharmony_civoid *vc4_prime_vmap(struct drm_gem_object *obj); 8158c2ecf20Sopenharmony_ciint vc4_bo_cache_init(struct drm_device *dev); 8168c2ecf20Sopenharmony_ciint vc4_bo_inc_usecnt(struct vc4_bo *bo); 8178c2ecf20Sopenharmony_civoid vc4_bo_dec_usecnt(struct vc4_bo *bo); 8188c2ecf20Sopenharmony_civoid vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); 8198c2ecf20Sopenharmony_civoid vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo); 8208c2ecf20Sopenharmony_ci 8218c2ecf20Sopenharmony_ci/* vc4_crtc.c */ 8228c2ecf20Sopenharmony_ciextern struct platform_driver vc4_crtc_driver; 8238c2ecf20Sopenharmony_ciint vc4_crtc_disable_at_boot(struct drm_crtc *crtc); 8248c2ecf20Sopenharmony_ciint vc4_crtc_init(struct drm_device *drm, struct vc4_crtc *vc4_crtc, 8258c2ecf20Sopenharmony_ci const struct drm_crtc_funcs *crtc_funcs, 8268c2ecf20Sopenharmony_ci const struct drm_crtc_helper_funcs *crtc_helper_funcs); 8278c2ecf20Sopenharmony_civoid vc4_crtc_destroy(struct drm_crtc *crtc); 8288c2ecf20Sopenharmony_ciint vc4_page_flip(struct drm_crtc *crtc, 8298c2ecf20Sopenharmony_ci struct drm_framebuffer *fb, 8308c2ecf20Sopenharmony_ci struct drm_pending_vblank_event *event, 8318c2ecf20Sopenharmony_ci uint32_t flags, 8328c2ecf20Sopenharmony_ci struct drm_modeset_acquire_ctx *ctx); 8338c2ecf20Sopenharmony_cistruct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc); 8348c2ecf20Sopenharmony_civoid vc4_crtc_destroy_state(struct drm_crtc *crtc, 8358c2ecf20Sopenharmony_ci struct drm_crtc_state *state); 8368c2ecf20Sopenharmony_civoid vc4_crtc_reset(struct drm_crtc *crtc); 8378c2ecf20Sopenharmony_civoid vc4_crtc_handle_vblank(struct vc4_crtc *crtc); 8388c2ecf20Sopenharmony_civoid vc4_crtc_get_margins(struct drm_crtc_state *state, 8398c2ecf20Sopenharmony_ci unsigned int *left, unsigned int *right, 8408c2ecf20Sopenharmony_ci unsigned int *top, unsigned int *bottom); 8418c2ecf20Sopenharmony_ci 8428c2ecf20Sopenharmony_ci/* vc4_debugfs.c */ 8438c2ecf20Sopenharmony_civoid vc4_debugfs_init(struct drm_minor *minor); 8448c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS 8458c2ecf20Sopenharmony_civoid vc4_debugfs_add_file(struct drm_device *drm, 8468c2ecf20Sopenharmony_ci const char *filename, 8478c2ecf20Sopenharmony_ci int (*show)(struct seq_file*, void*), 8488c2ecf20Sopenharmony_ci void *data); 8498c2ecf20Sopenharmony_civoid vc4_debugfs_add_regset32(struct drm_device *drm, 8508c2ecf20Sopenharmony_ci const char *filename, 8518c2ecf20Sopenharmony_ci struct debugfs_regset32 *regset); 8528c2ecf20Sopenharmony_ci#else 8538c2ecf20Sopenharmony_cistatic inline void vc4_debugfs_add_file(struct drm_device *drm, 8548c2ecf20Sopenharmony_ci const char *filename, 8558c2ecf20Sopenharmony_ci int (*show)(struct seq_file*, void*), 8568c2ecf20Sopenharmony_ci void *data) 8578c2ecf20Sopenharmony_ci{ 8588c2ecf20Sopenharmony_ci} 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_cistatic inline void vc4_debugfs_add_regset32(struct drm_device *drm, 8618c2ecf20Sopenharmony_ci const char *filename, 8628c2ecf20Sopenharmony_ci struct debugfs_regset32 *regset) 8638c2ecf20Sopenharmony_ci{ 8648c2ecf20Sopenharmony_ci} 8658c2ecf20Sopenharmony_ci#endif 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_ci/* vc4_drv.c */ 8688c2ecf20Sopenharmony_civoid __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci/* vc4_dpi.c */ 8718c2ecf20Sopenharmony_ciextern struct platform_driver vc4_dpi_driver; 8728c2ecf20Sopenharmony_ci 8738c2ecf20Sopenharmony_ci/* vc4_dsi.c */ 8748c2ecf20Sopenharmony_ciextern struct platform_driver vc4_dsi_driver; 8758c2ecf20Sopenharmony_ci 8768c2ecf20Sopenharmony_ci/* vc4_fence.c */ 8778c2ecf20Sopenharmony_ciextern const struct dma_fence_ops vc4_fence_ops; 8788c2ecf20Sopenharmony_ci 8798c2ecf20Sopenharmony_ci/* vc4_gem.c */ 8808c2ecf20Sopenharmony_ciint vc4_gem_init(struct drm_device *dev); 8818c2ecf20Sopenharmony_ciint vc4_submit_cl_ioctl(struct drm_device *dev, void *data, 8828c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8838c2ecf20Sopenharmony_ciint vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, 8848c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8858c2ecf20Sopenharmony_ciint vc4_wait_bo_ioctl(struct drm_device *dev, void *data, 8868c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8878c2ecf20Sopenharmony_civoid vc4_submit_next_bin_job(struct drm_device *dev); 8888c2ecf20Sopenharmony_civoid vc4_submit_next_render_job(struct drm_device *dev); 8898c2ecf20Sopenharmony_civoid vc4_move_job_to_render(struct drm_device *dev, struct vc4_exec_info *exec); 8908c2ecf20Sopenharmony_ciint vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, 8918c2ecf20Sopenharmony_ci uint64_t timeout_ns, bool interruptible); 8928c2ecf20Sopenharmony_civoid vc4_job_handle_completed(struct vc4_dev *vc4); 8938c2ecf20Sopenharmony_ciint vc4_queue_seqno_cb(struct drm_device *dev, 8948c2ecf20Sopenharmony_ci struct vc4_seqno_cb *cb, uint64_t seqno, 8958c2ecf20Sopenharmony_ci void (*func)(struct vc4_seqno_cb *cb)); 8968c2ecf20Sopenharmony_ciint vc4_gem_madvise_ioctl(struct drm_device *dev, void *data, 8978c2ecf20Sopenharmony_ci struct drm_file *file_priv); 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci/* vc4_hdmi.c */ 9008c2ecf20Sopenharmony_ciextern struct platform_driver vc4_hdmi_driver; 9018c2ecf20Sopenharmony_ci 9028c2ecf20Sopenharmony_ci/* vc4_vec.c */ 9038c2ecf20Sopenharmony_ciextern struct platform_driver vc4_vec_driver; 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci/* vc4_txp.c */ 9068c2ecf20Sopenharmony_ciextern struct platform_driver vc4_txp_driver; 9078c2ecf20Sopenharmony_ci 9088c2ecf20Sopenharmony_ci/* vc4_irq.c */ 9098c2ecf20Sopenharmony_ciirqreturn_t vc4_irq(int irq, void *arg); 9108c2ecf20Sopenharmony_civoid vc4_irq_preinstall(struct drm_device *dev); 9118c2ecf20Sopenharmony_ciint vc4_irq_postinstall(struct drm_device *dev); 9128c2ecf20Sopenharmony_civoid vc4_irq_uninstall(struct drm_device *dev); 9138c2ecf20Sopenharmony_civoid vc4_irq_reset(struct drm_device *dev); 9148c2ecf20Sopenharmony_ci 9158c2ecf20Sopenharmony_ci/* vc4_hvs.c */ 9168c2ecf20Sopenharmony_ciextern struct platform_driver vc4_hvs_driver; 9178c2ecf20Sopenharmony_civoid vc4_hvs_stop_channel(struct drm_device *dev, unsigned int output); 9188c2ecf20Sopenharmony_ciint vc4_hvs_get_fifo_from_output(struct drm_device *dev, unsigned int output); 9198c2ecf20Sopenharmony_ciint vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state); 9208c2ecf20Sopenharmony_civoid vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state); 9218c2ecf20Sopenharmony_civoid vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state); 9228c2ecf20Sopenharmony_civoid vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *state); 9238c2ecf20Sopenharmony_civoid vc4_hvs_dump_state(struct drm_device *dev); 9248c2ecf20Sopenharmony_civoid vc4_hvs_unmask_underrun(struct drm_device *dev, int channel); 9258c2ecf20Sopenharmony_civoid vc4_hvs_mask_underrun(struct drm_device *dev, int channel); 9268c2ecf20Sopenharmony_ci 9278c2ecf20Sopenharmony_ci/* vc4_kms.c */ 9288c2ecf20Sopenharmony_ciint vc4_kms_load(struct drm_device *dev); 9298c2ecf20Sopenharmony_ci 9308c2ecf20Sopenharmony_ci/* vc4_plane.c */ 9318c2ecf20Sopenharmony_cistruct drm_plane *vc4_plane_init(struct drm_device *dev, 9328c2ecf20Sopenharmony_ci enum drm_plane_type type); 9338c2ecf20Sopenharmony_ciint vc4_plane_create_additional_planes(struct drm_device *dev); 9348c2ecf20Sopenharmony_ciu32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); 9358c2ecf20Sopenharmony_ciu32 vc4_plane_dlist_size(const struct drm_plane_state *state); 9368c2ecf20Sopenharmony_civoid vc4_plane_async_set_fb(struct drm_plane *plane, 9378c2ecf20Sopenharmony_ci struct drm_framebuffer *fb); 9388c2ecf20Sopenharmony_ci 9398c2ecf20Sopenharmony_ci/* vc4_v3d.c */ 9408c2ecf20Sopenharmony_ciextern struct platform_driver vc4_v3d_driver; 9418c2ecf20Sopenharmony_ciextern const struct of_device_id vc4_v3d_dt_match[]; 9428c2ecf20Sopenharmony_ciint vc4_v3d_get_bin_slot(struct vc4_dev *vc4); 9438c2ecf20Sopenharmony_ciint vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used); 9448c2ecf20Sopenharmony_civoid vc4_v3d_bin_bo_put(struct vc4_dev *vc4); 9458c2ecf20Sopenharmony_ciint vc4_v3d_pm_get(struct vc4_dev *vc4); 9468c2ecf20Sopenharmony_civoid vc4_v3d_pm_put(struct vc4_dev *vc4); 9478c2ecf20Sopenharmony_ci 9488c2ecf20Sopenharmony_ci/* vc4_validate.c */ 9498c2ecf20Sopenharmony_ciint 9508c2ecf20Sopenharmony_civc4_validate_bin_cl(struct drm_device *dev, 9518c2ecf20Sopenharmony_ci void *validated, 9528c2ecf20Sopenharmony_ci void *unvalidated, 9538c2ecf20Sopenharmony_ci struct vc4_exec_info *exec); 9548c2ecf20Sopenharmony_ci 9558c2ecf20Sopenharmony_ciint 9568c2ecf20Sopenharmony_civc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); 9578c2ecf20Sopenharmony_ci 9588c2ecf20Sopenharmony_cistruct drm_gem_cma_object *vc4_use_bo(struct vc4_exec_info *exec, 9598c2ecf20Sopenharmony_ci uint32_t hindex); 9608c2ecf20Sopenharmony_ci 9618c2ecf20Sopenharmony_ciint vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec); 9628c2ecf20Sopenharmony_ci 9638c2ecf20Sopenharmony_cibool vc4_check_tex_size(struct vc4_exec_info *exec, 9648c2ecf20Sopenharmony_ci struct drm_gem_cma_object *fbo, 9658c2ecf20Sopenharmony_ci uint32_t offset, uint8_t tiling_format, 9668c2ecf20Sopenharmony_ci uint32_t width, uint32_t height, uint8_t cpp); 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_ci/* vc4_validate_shader.c */ 9698c2ecf20Sopenharmony_cistruct vc4_validated_shader_info * 9708c2ecf20Sopenharmony_civc4_validate_shader(struct drm_gem_cma_object *shader_obj); 9718c2ecf20Sopenharmony_ci 9728c2ecf20Sopenharmony_ci/* vc4_perfmon.c */ 9738c2ecf20Sopenharmony_civoid vc4_perfmon_get(struct vc4_perfmon *perfmon); 9748c2ecf20Sopenharmony_civoid vc4_perfmon_put(struct vc4_perfmon *perfmon); 9758c2ecf20Sopenharmony_civoid vc4_perfmon_start(struct vc4_dev *vc4, struct vc4_perfmon *perfmon); 9768c2ecf20Sopenharmony_civoid vc4_perfmon_stop(struct vc4_dev *vc4, struct vc4_perfmon *perfmon, 9778c2ecf20Sopenharmony_ci bool capture); 9788c2ecf20Sopenharmony_cistruct vc4_perfmon *vc4_perfmon_find(struct vc4_file *vc4file, int id); 9798c2ecf20Sopenharmony_civoid vc4_perfmon_open_file(struct vc4_file *vc4file); 9808c2ecf20Sopenharmony_civoid vc4_perfmon_close_file(struct vc4_file *vc4file); 9818c2ecf20Sopenharmony_ciint vc4_perfmon_create_ioctl(struct drm_device *dev, void *data, 9828c2ecf20Sopenharmony_ci struct drm_file *file_priv); 9838c2ecf20Sopenharmony_ciint vc4_perfmon_destroy_ioctl(struct drm_device *dev, void *data, 9848c2ecf20Sopenharmony_ci struct drm_file *file_priv); 9858c2ecf20Sopenharmony_ciint vc4_perfmon_get_values_ioctl(struct drm_device *dev, void *data, 9868c2ecf20Sopenharmony_ci struct drm_file *file_priv); 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_ci#endif /* _VC4_DRV_H_ */ 989