1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2c8b75bcaSEric Anholt /* 3c8b75bcaSEric Anholt * Copyright (C) 2015 Broadcom 4c8b75bcaSEric Anholt */ 56a88752cSMaxime Ripard #ifndef _VC4_DRV_H_ 66a88752cSMaxime Ripard #define _VC4_DRV_H_ 7c8b75bcaSEric Anholt 8fd6d6d80SSam Ravnborg #include <linux/delay.h> 973289afeSVille Syrjälä #include <linux/of.h> 10fd6d6d80SSam Ravnborg #include <linux/refcount.h> 11fd6d6d80SSam Ravnborg #include <linux/uaccess.h> 12fd6d6d80SSam Ravnborg 13fd6d6d80SSam Ravnborg #include <drm/drm_atomic.h> 14fd6d6d80SSam Ravnborg #include <drm/drm_debugfs.h> 15fd6d6d80SSam Ravnborg #include <drm/drm_device.h> 169338203cSLaurent Pinchart #include <drm/drm_encoder.h> 174a83c26aSDanilo Krummrich #include <drm/drm_gem_dma_helper.h> 181c80be48SMaxime Ripard #include <drm/drm_managed.h> 19fd6d6d80SSam Ravnborg #include <drm/drm_mm.h> 20fd6d6d80SSam Ravnborg #include <drm/drm_modeset_lock.h> 219338203cSLaurent Pinchart 22da43ff04SMaxime Ripard #include <kunit/test-bug.h> 23da43ff04SMaxime Ripard 2465101d8cSBoris Brezillon #include "uapi/drm/vc4_drm.h" 2565101d8cSBoris Brezillon 26fd6d6d80SSam Ravnborg struct drm_device; 27fd6d6d80SSam Ravnborg struct drm_gem_object; 28fd6d6d80SSam Ravnborg 29f759f5b5SMaxime Ripard extern const struct drm_driver vc4_drm_driver; 30f759f5b5SMaxime Ripard extern const struct drm_driver vc5_drm_driver; 31f759f5b5SMaxime Ripard 32f3099462SEric Anholt /* Don't forget to update vc4_bo.c: bo_type_names[] when adding to 33f3099462SEric Anholt * this. 34f3099462SEric Anholt */ 35f3099462SEric Anholt enum vc4_kernel_bo_type { 36f3099462SEric Anholt /* Any kernel allocation (gem_create_object hook) before it 37f3099462SEric Anholt * gets another type set. 38f3099462SEric Anholt */ 39f3099462SEric Anholt VC4_BO_TYPE_KERNEL, 40f3099462SEric Anholt VC4_BO_TYPE_V3D, 41f3099462SEric Anholt VC4_BO_TYPE_V3D_SHADER, 42f3099462SEric Anholt VC4_BO_TYPE_DUMB, 43f3099462SEric Anholt VC4_BO_TYPE_BIN, 44f3099462SEric Anholt VC4_BO_TYPE_RCL, 45f3099462SEric Anholt VC4_BO_TYPE_BCL, 46f3099462SEric Anholt VC4_BO_TYPE_KERNEL_CACHE, 47f3099462SEric Anholt VC4_BO_TYPE_COUNT 48f3099462SEric Anholt }; 49f3099462SEric Anholt 5065101d8cSBoris Brezillon /* Performance monitor object. The perform lifetime is controlled by userspace 5165101d8cSBoris Brezillon * using perfmon related ioctls. A perfmon can be attached to a submit_cl 5265101d8cSBoris Brezillon * request, and when this is the case, HW perf counters will be activated just 5365101d8cSBoris Brezillon * before the submit_cl is submitted to the GPU and disabled when the job is 5465101d8cSBoris Brezillon * done. This way, only events related to a specific job will be counted. 5565101d8cSBoris Brezillon */ 5665101d8cSBoris Brezillon struct vc4_perfmon { 5730f8c74cSMaxime Ripard struct vc4_dev *dev; 5830f8c74cSMaxime Ripard 5965101d8cSBoris Brezillon /* Tracks the number of users of the perfmon, when this counter reaches 6065101d8cSBoris Brezillon * zero the perfmon is destroyed. 6165101d8cSBoris Brezillon */ 6265101d8cSBoris Brezillon refcount_t refcnt; 6365101d8cSBoris Brezillon 6465101d8cSBoris Brezillon /* Number of counters activated in this perfmon instance 6565101d8cSBoris Brezillon * (should be less than DRM_VC4_MAX_PERF_COUNTERS). 6665101d8cSBoris Brezillon */ 6765101d8cSBoris Brezillon u8 ncounters; 6865101d8cSBoris Brezillon 6965101d8cSBoris Brezillon /* Events counted by the HW perf counters. */ 7065101d8cSBoris Brezillon u8 events[DRM_VC4_MAX_PERF_COUNTERS]; 7165101d8cSBoris Brezillon 7265101d8cSBoris Brezillon /* Storage for counter values. Counters are incremented by the HW 7365101d8cSBoris Brezillon * perf counter values every time the perfmon is attached to a GPU job. 7465101d8cSBoris Brezillon * This way, perfmon users don't have to retrieve the results after 7565101d8cSBoris Brezillon * each job if they want to track events covering several submissions. 7665101d8cSBoris Brezillon * Note that counter values can't be reset, but you can fake a reset by 7765101d8cSBoris Brezillon * destroying the perfmon and creating a new one. 7865101d8cSBoris Brezillon */ 795b2adbddSGustavo A. R. Silva u64 counters[]; 8065101d8cSBoris Brezillon }; 8165101d8cSBoris Brezillon 82c8b75bcaSEric Anholt struct vc4_dev { 8384d7d472SMaxime Ripard struct drm_device base; 846cf61bf4SMaxime Ripard struct device *dev; 85c8b75bcaSEric Anholt 861cbc91ebSMaxime Ripard bool is_vc5; 871cbc91ebSMaxime Ripard 885226711eSThomas Zimmermann unsigned int irq; 895226711eSThomas Zimmermann 90c8b75bcaSEric Anholt struct vc4_hvs *hvs; 91d3f5168aSEric Anholt struct vc4_v3d *v3d; 9248666d56SDerek Foreman 9321461365SEric Anholt struct vc4_hang_state *hang_state; 9421461365SEric Anholt 95c826a6e1SEric Anholt /* The kernel-space BO cache. Tracks buffers that have been 96c826a6e1SEric Anholt * unreferenced by all other users (refcounts of 0!) but not 97c826a6e1SEric Anholt * yet freed, so we can do cheap allocations. 98c826a6e1SEric Anholt */ 99c826a6e1SEric Anholt struct vc4_bo_cache { 100c826a6e1SEric Anholt /* Array of list heads for entries in the BO cache, 101c826a6e1SEric Anholt * based on number of pages, so we can do O(1) lookups 102c826a6e1SEric Anholt * in the cache when allocating. 103c826a6e1SEric Anholt */ 104c826a6e1SEric Anholt struct list_head *size_list; 105c826a6e1SEric Anholt uint32_t size_list_size; 106c826a6e1SEric Anholt 107c826a6e1SEric Anholt /* List of all BOs in the cache, ordered by age, so we 108c826a6e1SEric Anholt * can do O(1) lookups when trying to free old 109c826a6e1SEric Anholt * buffers. 110c826a6e1SEric Anholt */ 111c826a6e1SEric Anholt struct list_head time_list; 112c826a6e1SEric Anholt struct work_struct time_work; 113c826a6e1SEric Anholt struct timer_list time_timer; 114c826a6e1SEric Anholt } bo_cache; 115c826a6e1SEric Anholt 116f3099462SEric Anholt u32 num_labels; 117f3099462SEric Anholt struct vc4_label { 118f3099462SEric Anholt const char *name; 119c826a6e1SEric Anholt u32 num_allocated; 120c826a6e1SEric Anholt u32 size_allocated; 121f3099462SEric Anholt } *bo_labels; 122c826a6e1SEric Anholt 123f3099462SEric Anholt /* Protects bo_cache and bo_labels. */ 124c826a6e1SEric Anholt struct mutex bo_lock; 125d5b1a78aSEric Anholt 126b9f19259SBoris Brezillon /* Purgeable BO pool. All BOs in this pool can have their memory 127b9f19259SBoris Brezillon * reclaimed if the driver is unable to allocate new BOs. We also 128b9f19259SBoris Brezillon * keep stats related to the purge mechanism here. 129b9f19259SBoris Brezillon */ 130b9f19259SBoris Brezillon struct { 131b9f19259SBoris Brezillon struct list_head list; 132b9f19259SBoris Brezillon unsigned int num; 133b9f19259SBoris Brezillon size_t size; 134b9f19259SBoris Brezillon unsigned int purged_num; 135b9f19259SBoris Brezillon size_t purged_size; 136b9f19259SBoris Brezillon struct mutex lock; 137b9f19259SBoris Brezillon } purgeable; 138b9f19259SBoris Brezillon 139cdec4d36SEric Anholt uint64_t dma_fence_context; 140cdec4d36SEric Anholt 141ca26d28bSVarad Gautam /* Sequence number for the last job queued in bin_job_list. 142d5b1a78aSEric Anholt * Starts at 0 (no jobs emitted). 143d5b1a78aSEric Anholt */ 144d5b1a78aSEric Anholt uint64_t emit_seqno; 145d5b1a78aSEric Anholt 146d5b1a78aSEric Anholt /* Sequence number for the last completed job on the GPU. 147d5b1a78aSEric Anholt * Starts at 0 (no jobs completed). 148d5b1a78aSEric Anholt */ 149d5b1a78aSEric Anholt uint64_t finished_seqno; 150d5b1a78aSEric Anholt 151ca26d28bSVarad Gautam /* List of all struct vc4_exec_info for jobs to be executed in 152ca26d28bSVarad Gautam * the binner. The first job in the list is the one currently 153ca26d28bSVarad Gautam * programmed into ct0ca for execution. 154d5b1a78aSEric Anholt */ 155ca26d28bSVarad Gautam struct list_head bin_job_list; 156ca26d28bSVarad Gautam 157ca26d28bSVarad Gautam /* List of all struct vc4_exec_info for jobs that have 158ca26d28bSVarad Gautam * completed binning and are ready for rendering. The first 159ca26d28bSVarad Gautam * job in the list is the one currently programmed into ct1ca 160ca26d28bSVarad Gautam * for execution. 161ca26d28bSVarad Gautam */ 162ca26d28bSVarad Gautam struct list_head render_job_list; 163ca26d28bSVarad Gautam 164d5b1a78aSEric Anholt /* List of the finished vc4_exec_infos waiting to be freed by 165d5b1a78aSEric Anholt * job_done_work. 166d5b1a78aSEric Anholt */ 167d5b1a78aSEric Anholt struct list_head job_done_list; 168d5b1a78aSEric Anholt /* Spinlock used to synchronize the job_list and seqno 169d5b1a78aSEric Anholt * accesses between the IRQ handler and GEM ioctls. 170d5b1a78aSEric Anholt */ 171d5b1a78aSEric Anholt spinlock_t job_lock; 172d5b1a78aSEric Anholt wait_queue_head_t job_wait_queue; 173d5b1a78aSEric Anholt struct work_struct job_done_work; 174d5b1a78aSEric Anholt 17565101d8cSBoris Brezillon /* Used to track the active perfmon if any. Access to this field is 17665101d8cSBoris Brezillon * protected by job_lock. 17765101d8cSBoris Brezillon */ 17865101d8cSBoris Brezillon struct vc4_perfmon *active_perfmon; 17965101d8cSBoris Brezillon 180b501baccSEric Anholt /* List of struct vc4_seqno_cb for callbacks to be made from a 181b501baccSEric Anholt * workqueue when the given seqno is passed. 182b501baccSEric Anholt */ 183b501baccSEric Anholt struct list_head seqno_cb_list; 184b501baccSEric Anholt 185553c942fSEric Anholt /* The memory used for storing binner tile alloc, tile state, 186553c942fSEric Anholt * and overflow memory allocations. This is freed when V3D 187553c942fSEric Anholt * powers down. 188d5b1a78aSEric Anholt */ 189553c942fSEric Anholt struct vc4_bo *bin_bo; 190553c942fSEric Anholt 191553c942fSEric Anholt /* Size of blocks allocated within bin_bo. */ 192553c942fSEric Anholt uint32_t bin_alloc_size; 193553c942fSEric Anholt 194553c942fSEric Anholt /* Bitmask of the bin_alloc_size chunks in bin_bo that are 195553c942fSEric Anholt * used. 196553c942fSEric Anholt */ 197553c942fSEric Anholt uint32_t bin_alloc_used; 198553c942fSEric Anholt 199553c942fSEric Anholt /* Bitmask of the current bin_alloc used for overflow memory. */ 200553c942fSEric Anholt uint32_t bin_alloc_overflow; 201553c942fSEric Anholt 202531a1b62SBoris Brezillon /* Incremented when an underrun error happened after an atomic commit. 203531a1b62SBoris Brezillon * This is particularly useful to detect when a specific modeset is too 204531a1b62SBoris Brezillon * demanding in term of memory or HVS bandwidth which is hard to guess 205531a1b62SBoris Brezillon * at atomic check time. 206531a1b62SBoris Brezillon */ 207531a1b62SBoris Brezillon atomic_t underrun; 208531a1b62SBoris Brezillon 209d5b1a78aSEric Anholt struct work_struct overflow_mem_work; 210d5b1a78aSEric Anholt 21136cb6253SEric Anholt int power_refcount; 21236cb6253SEric Anholt 2136b5c029dSPaul Kocialkowski /* Set to true when the load tracker is active. */ 2146b5c029dSPaul Kocialkowski bool load_tracker_enabled; 2156b5c029dSPaul Kocialkowski 21636cb6253SEric Anholt /* Mutex controlling the power refcount. */ 21736cb6253SEric Anholt struct mutex power_lock; 21836cb6253SEric Anholt 219d5b1a78aSEric Anholt struct { 220d5b1a78aSEric Anholt struct timer_list timer; 221d5b1a78aSEric Anholt struct work_struct reset_work; 222d5b1a78aSEric Anholt } hangcheck; 223d5b1a78aSEric Anholt 224766cc6b1SStefan Schake struct drm_modeset_lock ctm_state_lock; 225766cc6b1SStefan Schake struct drm_private_obj ctm_manager; 226f2df84e0SMaxime Ripard struct drm_private_obj hvs_channels; 2274686da83SBoris Brezillon struct drm_private_obj load_tracker; 228c9be804cSEric Anholt 22935c8b4b2SPaul Kocialkowski /* Mutex for binner bo allocation. */ 23035c8b4b2SPaul Kocialkowski struct mutex bin_bo_lock; 23135c8b4b2SPaul Kocialkowski /* Reference count for our binner bo. */ 23235c8b4b2SPaul Kocialkowski struct kref bin_bo_kref; 233c8b75bcaSEric Anholt }; 234c8b75bcaSEric Anholt 235c8b75bcaSEric Anholt static inline struct vc4_dev * 236553a241bSMaxime Ripard to_vc4_dev(const struct drm_device *dev) 237c8b75bcaSEric Anholt { 23884d7d472SMaxime Ripard return container_of(dev, struct vc4_dev, base); 239c8b75bcaSEric Anholt } 240c8b75bcaSEric Anholt 241c8b75bcaSEric Anholt struct vc4_bo { 2424a83c26aSDanilo Krummrich struct drm_gem_dma_object base; 243c826a6e1SEric Anholt 2447edabee0SEric Anholt /* seqno of the last job to render using this BO. */ 245d5b1a78aSEric Anholt uint64_t seqno; 246d5b1a78aSEric Anholt 2477edabee0SEric Anholt /* seqno of the last job to use the RCL to write to this BO. 2487edabee0SEric Anholt * 2497edabee0SEric Anholt * Note that this doesn't include binner overflow memory 2507edabee0SEric Anholt * writes. 2517edabee0SEric Anholt */ 2527edabee0SEric Anholt uint64_t write_seqno; 2537edabee0SEric Anholt 25483753117SEric Anholt bool t_format; 25583753117SEric Anholt 256c826a6e1SEric Anholt /* List entry for the BO's position in either 257c826a6e1SEric Anholt * vc4_exec_info->unref_list or vc4_dev->bo_cache.time_list 258c826a6e1SEric Anholt */ 259c826a6e1SEric Anholt struct list_head unref_head; 260c826a6e1SEric Anholt 261c826a6e1SEric Anholt /* Time in jiffies when the BO was put in vc4->bo_cache. */ 262c826a6e1SEric Anholt unsigned long free_time; 263c826a6e1SEric Anholt 264c826a6e1SEric Anholt /* List entry for the BO's position in vc4_dev->bo_cache.size_list */ 265c826a6e1SEric Anholt struct list_head size_head; 266463873d5SEric Anholt 267463873d5SEric Anholt /* Struct for shader validation state, if created by 268463873d5SEric Anholt * DRM_IOCTL_VC4_CREATE_SHADER_BO. 269463873d5SEric Anholt */ 270463873d5SEric Anholt struct vc4_validated_shader_info *validated_shader; 271cdec4d36SEric Anholt 272f3099462SEric Anholt /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i 273f3099462SEric Anholt * for user-allocated labels. 274f3099462SEric Anholt */ 275f3099462SEric Anholt int label; 276b9f19259SBoris Brezillon 277b9f19259SBoris Brezillon /* Count the number of active users. This is needed to determine 278b9f19259SBoris Brezillon * whether we can move the BO to the purgeable list or not (when the BO 279b9f19259SBoris Brezillon * is used by the GPU or the display engine we can't purge it). 280b9f19259SBoris Brezillon */ 281b9f19259SBoris Brezillon refcount_t usecnt; 282b9f19259SBoris Brezillon 283b9f19259SBoris Brezillon /* Store purgeable/purged state here */ 284b9f19259SBoris Brezillon u32 madv; 285b9f19259SBoris Brezillon struct mutex madv_lock; 286c8b75bcaSEric Anholt }; 287c8b75bcaSEric Anholt 288c8b75bcaSEric Anholt static inline struct vc4_bo * 289553a241bSMaxime Ripard to_vc4_bo(const struct drm_gem_object *bo) 290c8b75bcaSEric Anholt { 2914a83c26aSDanilo Krummrich return container_of(to_drm_gem_dma_obj(bo), struct vc4_bo, base); 292c8b75bcaSEric Anholt } 293c8b75bcaSEric Anholt 294cdec4d36SEric Anholt struct vc4_fence { 295cdec4d36SEric Anholt struct dma_fence base; 296cdec4d36SEric Anholt struct drm_device *dev; 297cdec4d36SEric Anholt /* vc4 seqno for signaled() test */ 298cdec4d36SEric Anholt uint64_t seqno; 299cdec4d36SEric Anholt }; 300cdec4d36SEric Anholt 301cdec4d36SEric Anholt static inline struct vc4_fence * 302553a241bSMaxime Ripard to_vc4_fence(const struct dma_fence *fence) 303cdec4d36SEric Anholt { 3045066f42cSMaxime Ripard return container_of(fence, struct vc4_fence, base); 305cdec4d36SEric Anholt } 306cdec4d36SEric Anholt 307b501baccSEric Anholt struct vc4_seqno_cb { 308b501baccSEric Anholt struct work_struct work; 309b501baccSEric Anholt uint64_t seqno; 310b501baccSEric Anholt void (*func)(struct vc4_seqno_cb *cb); 311b501baccSEric Anholt }; 312b501baccSEric Anholt 313d3f5168aSEric Anholt struct vc4_v3d { 314001bdb55SEric Anholt struct vc4_dev *vc4; 315d3f5168aSEric Anholt struct platform_device *pdev; 316d3f5168aSEric Anholt void __iomem *regs; 317b72a2816SEric Anholt struct clk *clk; 3183051719aSEric Anholt struct debugfs_regset32 regset; 319d3f5168aSEric Anholt }; 320d3f5168aSEric Anholt 321c8b75bcaSEric Anholt struct vc4_hvs { 3221cbc91ebSMaxime Ripard struct vc4_dev *vc4; 323c8b75bcaSEric Anholt struct platform_device *pdev; 324c8b75bcaSEric Anholt void __iomem *regs; 325d8dbf44fSEric Anholt u32 __iomem *dlist; 326d8dbf44fSEric Anholt 327d7d96c00SMaxime Ripard struct clk *core_clk; 328d7d96c00SMaxime Ripard 3292a001ca0SMaxime Ripard unsigned long max_core_rate; 3302a001ca0SMaxime Ripard 331d8dbf44fSEric Anholt /* Memory manager for CRTCs to allocate space in the display 332d8dbf44fSEric Anholt * list. Units are dwords. 333d8dbf44fSEric Anholt */ 334d8dbf44fSEric Anholt struct drm_mm dlist_mm; 33521af94cfSEric Anholt /* Memory manager for the LBM memory used by HVS scaling. */ 33621af94cfSEric Anholt struct drm_mm lbm_mm; 337d8dbf44fSEric Anholt spinlock_t mm_lock; 33821af94cfSEric Anholt 33921af94cfSEric Anholt struct drm_mm_node mitchell_netravali_filter; 340c54619b0SDave Stevenson 3413051719aSEric Anholt struct debugfs_regset32 regset; 3422a001ca0SMaxime Ripard 3432a001ca0SMaxime Ripard /* 3442a001ca0SMaxime Ripard * Even if HDMI0 on the RPi4 can output modes requiring a pixel 3452a001ca0SMaxime Ripard * rate higher than 297MHz, it needs some adjustments in the 3462a001ca0SMaxime Ripard * config.txt file to be able to do so and thus won't always be 3472a001ca0SMaxime Ripard * available. 3482a001ca0SMaxime Ripard */ 3492a001ca0SMaxime Ripard bool vc5_hdmi_enable_hdmi_20; 350f09e172dSDom Cobley 351f09e172dSDom Cobley /* 352f09e172dSDom Cobley * 4096x2160@60 requires a core overclock to work, so register 353f09e172dSDom Cobley * whether that is sufficient. 354f09e172dSDom Cobley */ 355f09e172dSDom Cobley bool vc5_hdmi_enable_4096by2160; 356c8b75bcaSEric Anholt }; 357c8b75bcaSEric Anholt 3583c5cb5ecSMaxime Ripard #define HVS_NUM_CHANNELS 3 3593c5cb5ecSMaxime Ripard 3603c5cb5ecSMaxime Ripard struct vc4_hvs_state { 3613c5cb5ecSMaxime Ripard struct drm_private_state base; 3623c5cb5ecSMaxime Ripard unsigned long core_clock_rate; 3633c5cb5ecSMaxime Ripard 3643c5cb5ecSMaxime Ripard struct { 3653c5cb5ecSMaxime Ripard unsigned in_use: 1; 3663c5cb5ecSMaxime Ripard unsigned long fifo_load; 3673c5cb5ecSMaxime Ripard struct drm_crtc_commit *pending_commit; 3683c5cb5ecSMaxime Ripard } fifo_state[HVS_NUM_CHANNELS]; 3693c5cb5ecSMaxime Ripard }; 3703c5cb5ecSMaxime Ripard 3713c5cb5ecSMaxime Ripard static inline struct vc4_hvs_state * 3723c5cb5ecSMaxime Ripard to_vc4_hvs_state(const struct drm_private_state *priv) 3733c5cb5ecSMaxime Ripard { 3743c5cb5ecSMaxime Ripard return container_of(priv, struct vc4_hvs_state, base); 3753c5cb5ecSMaxime Ripard } 3763c5cb5ecSMaxime Ripard 3773c5cb5ecSMaxime Ripard struct vc4_hvs_state *vc4_hvs_get_global_state(struct drm_atomic_state *state); 3783c5cb5ecSMaxime Ripard struct vc4_hvs_state *vc4_hvs_get_old_global_state(const struct drm_atomic_state *state); 3793c5cb5ecSMaxime Ripard struct vc4_hvs_state *vc4_hvs_get_new_global_state(const struct drm_atomic_state *state); 3803c5cb5ecSMaxime Ripard 381c8b75bcaSEric Anholt struct vc4_plane { 382c8b75bcaSEric Anholt struct drm_plane base; 383c8b75bcaSEric Anholt }; 384c8b75bcaSEric Anholt 385c8b75bcaSEric Anholt static inline struct vc4_plane * 386553a241bSMaxime Ripard to_vc4_plane(const struct drm_plane *plane) 387c8b75bcaSEric Anholt { 3885066f42cSMaxime Ripard return container_of(plane, struct vc4_plane, base); 389c8b75bcaSEric Anholt } 390c8b75bcaSEric Anholt 39182364698SStefan Schake enum vc4_scaling_mode { 39282364698SStefan Schake VC4_SCALING_NONE, 39382364698SStefan Schake VC4_SCALING_TPZ, 39482364698SStefan Schake VC4_SCALING_PPF, 39582364698SStefan Schake }; 39682364698SStefan Schake 39782364698SStefan Schake struct vc4_plane_state { 39882364698SStefan Schake struct drm_plane_state base; 39982364698SStefan Schake /* System memory copy of the display list for this element, computed 40082364698SStefan Schake * at atomic_check time. 40182364698SStefan Schake */ 40282364698SStefan Schake u32 *dlist; 40382364698SStefan Schake u32 dlist_size; /* Number of dwords allocated for the display list */ 40482364698SStefan Schake u32 dlist_count; /* Number of used dwords in the display list. */ 40582364698SStefan Schake 40682364698SStefan Schake /* Offset in the dlist to various words, for pageflip or 40782364698SStefan Schake * cursor updates. 40882364698SStefan Schake */ 40982364698SStefan Schake u32 pos0_offset; 41082364698SStefan Schake u32 pos2_offset; 41182364698SStefan Schake u32 ptr0_offset; 4120a038c1cSBoris Brezillon u32 lbm_offset; 41382364698SStefan Schake 41482364698SStefan Schake /* Offset where the plane's dlist was last stored in the 41582364698SStefan Schake * hardware at vc4_crtc_atomic_flush() time. 41682364698SStefan Schake */ 41782364698SStefan Schake u32 __iomem *hw_dlist; 41882364698SStefan Schake 41982364698SStefan Schake /* Clipped coordinates of the plane on the display. */ 42082364698SStefan Schake int crtc_x, crtc_y, crtc_w, crtc_h; 42182364698SStefan Schake /* Clipped area being scanned from in the FB. */ 42282364698SStefan Schake u32 src_x, src_y; 42382364698SStefan Schake 42482364698SStefan Schake u32 src_w[2], src_h[2]; 42582364698SStefan Schake 42682364698SStefan Schake /* Scaling selection for the RGB/Y plane and the Cb/Cr planes. */ 42782364698SStefan Schake enum vc4_scaling_mode x_scaling[2], y_scaling[2]; 42882364698SStefan Schake bool is_unity; 42982364698SStefan Schake bool is_yuv; 43082364698SStefan Schake 43182364698SStefan Schake /* Offset to start scanning out from the start of the plane's 43282364698SStefan Schake * BO. 43382364698SStefan Schake */ 43482364698SStefan Schake u32 offsets[3]; 43582364698SStefan Schake 43682364698SStefan Schake /* Our allocation in LBM for temporary storage during scaling. */ 43782364698SStefan Schake struct drm_mm_node lbm; 43882364698SStefan Schake 43982364698SStefan Schake /* Set when the plane has per-pixel alpha content or does not cover 44082364698SStefan Schake * the entire screen. This is a hint to the CRTC that it might need 44182364698SStefan Schake * to enable background color fill. 44282364698SStefan Schake */ 44382364698SStefan Schake bool needs_bg_fill; 4448d938449SBoris Brezillon 4458d938449SBoris Brezillon /* Mark the dlist as initialized. Useful to avoid initializing it twice 4468d938449SBoris Brezillon * when async update is not possible. 4478d938449SBoris Brezillon */ 4488d938449SBoris Brezillon bool dlist_initialized; 4494686da83SBoris Brezillon 4504686da83SBoris Brezillon /* Load of this plane on the HVS block. The load is expressed in HVS 4514686da83SBoris Brezillon * cycles/sec. 4524686da83SBoris Brezillon */ 4534686da83SBoris Brezillon u64 hvs_load; 4544686da83SBoris Brezillon 4554686da83SBoris Brezillon /* Memory bandwidth needed for this plane. This is expressed in 4564686da83SBoris Brezillon * bytes/sec. 4574686da83SBoris Brezillon */ 4584686da83SBoris Brezillon u64 membus_load; 45982364698SStefan Schake }; 46082364698SStefan Schake 46182364698SStefan Schake static inline struct vc4_plane_state * 462553a241bSMaxime Ripard to_vc4_plane_state(const struct drm_plane_state *state) 46382364698SStefan Schake { 4645066f42cSMaxime Ripard return container_of(state, struct vc4_plane_state, base); 46582364698SStefan Schake } 46682364698SStefan Schake 467c8b75bcaSEric Anholt enum vc4_encoder_type { 468ab8df60eSBoris Brezillon VC4_ENCODER_TYPE_NONE, 469ed024b22SMaxime Ripard VC4_ENCODER_TYPE_HDMI0, 470aa2fd1caSMaxime Ripard VC4_ENCODER_TYPE_HDMI1, 471c8b75bcaSEric Anholt VC4_ENCODER_TYPE_VEC, 472c8b75bcaSEric Anholt VC4_ENCODER_TYPE_DSI0, 473c8b75bcaSEric Anholt VC4_ENCODER_TYPE_DSI1, 474c8b75bcaSEric Anholt VC4_ENCODER_TYPE_SMI, 475c8b75bcaSEric Anholt VC4_ENCODER_TYPE_DPI, 476b998eb4fSMaxime Ripard VC4_ENCODER_TYPE_TXP, 477c8b75bcaSEric Anholt }; 478c8b75bcaSEric Anholt 479c8b75bcaSEric Anholt struct vc4_encoder { 480c8b75bcaSEric Anholt struct drm_encoder base; 481c8b75bcaSEric Anholt enum vc4_encoder_type type; 482c8b75bcaSEric Anholt u32 clock_select; 483792c3132SMaxime Ripard 4848d914746SMaxime Ripard void (*pre_crtc_configure)(struct drm_encoder *encoder, struct drm_atomic_state *state); 4858d914746SMaxime Ripard void (*pre_crtc_enable)(struct drm_encoder *encoder, struct drm_atomic_state *state); 4868d914746SMaxime Ripard void (*post_crtc_enable)(struct drm_encoder *encoder, struct drm_atomic_state *state); 487792c3132SMaxime Ripard 4888d914746SMaxime Ripard void (*post_crtc_disable)(struct drm_encoder *encoder, struct drm_atomic_state *state); 4898d914746SMaxime Ripard void (*post_crtc_powerdown)(struct drm_encoder *encoder, struct drm_atomic_state *state); 490c8b75bcaSEric Anholt }; 491c8b75bcaSEric Anholt 492c8b75bcaSEric Anholt static inline struct vc4_encoder * 493553a241bSMaxime Ripard to_vc4_encoder(const struct drm_encoder *encoder) 494c8b75bcaSEric Anholt { 495c8b75bcaSEric Anholt return container_of(encoder, struct vc4_encoder, base); 496c8b75bcaSEric Anholt } 497c8b75bcaSEric Anholt 4980656ce12SMaxime Ripard static inline 4990656ce12SMaxime Ripard struct drm_encoder *vc4_find_encoder_by_type(struct drm_device *drm, 5000656ce12SMaxime Ripard enum vc4_encoder_type type) 5010656ce12SMaxime Ripard { 5020656ce12SMaxime Ripard struct drm_encoder *encoder; 5030656ce12SMaxime Ripard 5040656ce12SMaxime Ripard drm_for_each_encoder(encoder, drm) { 5050656ce12SMaxime Ripard struct vc4_encoder *vc4_encoder = to_vc4_encoder(encoder); 5060656ce12SMaxime Ripard 5070656ce12SMaxime Ripard if (vc4_encoder->type == type) 5080656ce12SMaxime Ripard return encoder; 5090656ce12SMaxime Ripard } 5100656ce12SMaxime Ripard 5110656ce12SMaxime Ripard return NULL; 5120656ce12SMaxime Ripard } 5130656ce12SMaxime Ripard 51479271807SStefan Schake struct vc4_crtc_data { 5159a49bf09SMaxime Ripard const char *name; 5169a49bf09SMaxime Ripard 5176bad4774SMaxime Ripard const char *debugfs_name; 5186bad4774SMaxime Ripard 51987ebcd42SMaxime Ripard /* Bitmask of channels (FIFOs) of the HVS that the output can source from */ 52087ebcd42SMaxime Ripard unsigned int hvs_available_channels; 52187ebcd42SMaxime Ripard 5228ebb2cf0SMaxime Ripard /* Which output of the HVS this pixelvalve sources from. */ 5238ebb2cf0SMaxime Ripard int hvs_output; 5245a20ff8bSMaxime Ripard }; 5255a20ff8bSMaxime Ripard 526f759f5b5SMaxime Ripard extern const struct vc4_crtc_data vc4_txp_crtc_data; 527f759f5b5SMaxime Ripard 5285a20ff8bSMaxime Ripard struct vc4_pv_data { 5295a20ff8bSMaxime Ripard struct vc4_crtc_data base; 53079271807SStefan Schake 531649abf2fSMaxime Ripard /* Depth of the PixelValve FIFO in bytes */ 532649abf2fSMaxime Ripard unsigned int fifo_depth; 533649abf2fSMaxime Ripard 534644df22fSMaxime Ripard /* Number of pixels output per clock period */ 535644df22fSMaxime Ripard u8 pixels_per_clock; 536644df22fSMaxime Ripard 53779271807SStefan Schake enum vc4_encoder_type encoder_types[4]; 53879271807SStefan Schake }; 53979271807SStefan Schake 540f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2835_pv0_data; 541f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2835_pv1_data; 542f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2835_pv2_data; 543f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2711_pv0_data; 544f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2711_pv1_data; 545f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2711_pv2_data; 546f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2711_pv3_data; 547f759f5b5SMaxime Ripard extern const struct vc4_pv_data bcm2711_pv4_data; 548f759f5b5SMaxime Ripard 54979271807SStefan Schake struct vc4_crtc { 55079271807SStefan Schake struct drm_crtc base; 5513051719aSEric Anholt struct platform_device *pdev; 55279271807SStefan Schake const struct vc4_crtc_data *data; 55379271807SStefan Schake void __iomem *regs; 55479271807SStefan Schake 55579271807SStefan Schake /* Timestamp at start of vblank irq - unaffected by lock delays. */ 55679271807SStefan Schake ktime_t t_vblank; 55779271807SStefan Schake 55879271807SStefan Schake u8 lut_r[256]; 55979271807SStefan Schake u8 lut_g[256]; 56079271807SStefan Schake u8 lut_b[256]; 56179271807SStefan Schake 56279271807SStefan Schake struct drm_pending_vblank_event *event; 5633051719aSEric Anholt 5643051719aSEric Anholt struct debugfs_regset32 regset; 565a16c6640SMaxime Ripard 566a16c6640SMaxime Ripard /** 567a16c6640SMaxime Ripard * @feeds_txp: True if the CRTC feeds our writeback controller. 568a16c6640SMaxime Ripard */ 569a16c6640SMaxime Ripard bool feeds_txp; 5700c250c15SMaxime Ripard 5710c250c15SMaxime Ripard /** 5720c250c15SMaxime Ripard * @irq_lock: Spinlock protecting the resources shared between 5730c250c15SMaxime Ripard * the atomic code and our vblank handler. 5740c250c15SMaxime Ripard */ 5750c250c15SMaxime Ripard spinlock_t irq_lock; 5760c250c15SMaxime Ripard 5770c250c15SMaxime Ripard /** 5780c250c15SMaxime Ripard * @current_dlist: Start offset of the display list currently 5790c250c15SMaxime Ripard * set in the HVS for that CRTC. Protected by @irq_lock, and 5800c250c15SMaxime Ripard * copied in vc4_hvs_update_dlist() for the CRTC interrupt 5810c250c15SMaxime Ripard * handler to have access to that value. 5820c250c15SMaxime Ripard */ 5830c250c15SMaxime Ripard unsigned int current_dlist; 584eeb6ab46SMaxime Ripard 585eeb6ab46SMaxime Ripard /** 586eeb6ab46SMaxime Ripard * @current_hvs_channel: HVS channel currently assigned to the 587eeb6ab46SMaxime Ripard * CRTC. Protected by @irq_lock, and copied in 588eeb6ab46SMaxime Ripard * vc4_hvs_atomic_begin() for the CRTC interrupt handler to have 589eeb6ab46SMaxime Ripard * access to that value. 590eeb6ab46SMaxime Ripard */ 591eeb6ab46SMaxime Ripard unsigned int current_hvs_channel; 59279271807SStefan Schake }; 59379271807SStefan Schake 59479271807SStefan Schake static inline struct vc4_crtc * 595553a241bSMaxime Ripard to_vc4_crtc(const struct drm_crtc *crtc) 59679271807SStefan Schake { 5975066f42cSMaxime Ripard return container_of(crtc, struct vc4_crtc, base); 59879271807SStefan Schake } 59979271807SStefan Schake 6005a20ff8bSMaxime Ripard static inline const struct vc4_crtc_data * 6015a20ff8bSMaxime Ripard vc4_crtc_to_vc4_crtc_data(const struct vc4_crtc *crtc) 6025a20ff8bSMaxime Ripard { 6035a20ff8bSMaxime Ripard return crtc->data; 6045a20ff8bSMaxime Ripard } 6055a20ff8bSMaxime Ripard 6065a20ff8bSMaxime Ripard static inline const struct vc4_pv_data * 6075a20ff8bSMaxime Ripard vc4_crtc_to_vc4_pv_data(const struct vc4_crtc *crtc) 6085a20ff8bSMaxime Ripard { 6095a20ff8bSMaxime Ripard const struct vc4_crtc_data *data = vc4_crtc_to_vc4_crtc_data(crtc); 6105a20ff8bSMaxime Ripard 6115a20ff8bSMaxime Ripard return container_of(data, struct vc4_pv_data, base); 6125a20ff8bSMaxime Ripard } 6135a20ff8bSMaxime Ripard 614d0229c36SMaxime Ripard struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc, 61594c1adc4SMaxime Ripard struct drm_crtc_state *state); 616d0229c36SMaxime Ripard 617ae44a527SMaxime Ripard struct vc4_crtc_state { 618ae44a527SMaxime Ripard struct drm_crtc_state base; 619ae44a527SMaxime Ripard /* Dlist area for this CRTC configuration. */ 620ae44a527SMaxime Ripard struct drm_mm_node mm; 621ae44a527SMaxime Ripard bool txp_armed; 62287ebcd42SMaxime Ripard unsigned int assigned_channel; 623ae44a527SMaxime Ripard 624ae44a527SMaxime Ripard struct { 625ae44a527SMaxime Ripard unsigned int left; 626ae44a527SMaxime Ripard unsigned int right; 627ae44a527SMaxime Ripard unsigned int top; 628ae44a527SMaxime Ripard unsigned int bottom; 629ae44a527SMaxime Ripard } margins; 6302820526dSMaxime Ripard 63116e10105SMaxime Ripard unsigned long hvs_load; 63216e10105SMaxime Ripard 6332820526dSMaxime Ripard /* Transitional state below, only valid during atomic commits */ 6342820526dSMaxime Ripard bool update_muxing; 635ae44a527SMaxime Ripard }; 636ae44a527SMaxime Ripard 6378ba0b6d1SMaxime Ripard #define VC4_HVS_CHANNEL_DISABLED ((unsigned int)-1) 6388ba0b6d1SMaxime Ripard 639ae44a527SMaxime Ripard static inline struct vc4_crtc_state * 640553a241bSMaxime Ripard to_vc4_crtc_state(const struct drm_crtc_state *crtc_state) 641ae44a527SMaxime Ripard { 6425066f42cSMaxime Ripard return container_of(crtc_state, struct vc4_crtc_state, base); 643ae44a527SMaxime Ripard } 644ae44a527SMaxime Ripard 645da43ff04SMaxime Ripard #define V3D_READ(offset) \ 646da43ff04SMaxime Ripard ({ \ 647da43ff04SMaxime Ripard kunit_fail_current_test("Accessing a register in a unit test!\n"); \ 648da43ff04SMaxime Ripard readl(vc4->v3d->regs + (offset)); \ 649da43ff04SMaxime Ripard }) 650da43ff04SMaxime Ripard 651da43ff04SMaxime Ripard #define V3D_WRITE(offset, val) \ 652da43ff04SMaxime Ripard do { \ 653da43ff04SMaxime Ripard kunit_fail_current_test("Accessing a register in a unit test!\n"); \ 654da43ff04SMaxime Ripard writel(val, vc4->v3d->regs + (offset)); \ 655da43ff04SMaxime Ripard } while (0) 656da43ff04SMaxime Ripard 657da43ff04SMaxime Ripard #define HVS_READ(offset) \ 658da43ff04SMaxime Ripard ({ \ 659da43ff04SMaxime Ripard kunit_fail_current_test("Accessing a register in a unit test!\n"); \ 660da43ff04SMaxime Ripard readl(hvs->regs + (offset)); \ 661da43ff04SMaxime Ripard }) 662da43ff04SMaxime Ripard 663da43ff04SMaxime Ripard #define HVS_WRITE(offset, val) \ 664da43ff04SMaxime Ripard do { \ 665da43ff04SMaxime Ripard kunit_fail_current_test("Accessing a register in a unit test!\n"); \ 666da43ff04SMaxime Ripard writel(val, hvs->regs + (offset)); \ 667da43ff04SMaxime Ripard } while (0) 668c8b75bcaSEric Anholt 6693051719aSEric Anholt #define VC4_REG32(reg) { .name = #reg, .offset = reg } 6703051719aSEric Anholt 671d5b1a78aSEric Anholt struct vc4_exec_info { 67230f8c74cSMaxime Ripard struct vc4_dev *dev; 67330f8c74cSMaxime Ripard 674d5b1a78aSEric Anholt /* Sequence number for this bin/render job. */ 675d5b1a78aSEric Anholt uint64_t seqno; 676d5b1a78aSEric Anholt 6777edabee0SEric Anholt /* Latest write_seqno of any BO that binning depends on. */ 6787edabee0SEric Anholt uint64_t bin_dep_seqno; 6797edabee0SEric Anholt 680cdec4d36SEric Anholt struct dma_fence *fence; 681cdec4d36SEric Anholt 682c4ce60dcSEric Anholt /* Last current addresses the hardware was processing when the 683c4ce60dcSEric Anholt * hangcheck timer checked on us. 684c4ce60dcSEric Anholt */ 685c4ce60dcSEric Anholt uint32_t last_ct0ca, last_ct1ca; 686c4ce60dcSEric Anholt 687d5b1a78aSEric Anholt /* Kernel-space copy of the ioctl arguments */ 688d5b1a78aSEric Anholt struct drm_vc4_submit_cl *args; 689d5b1a78aSEric Anholt 690d5b1a78aSEric Anholt /* This is the array of BOs that were looked up at the start of exec. 691d5b1a78aSEric Anholt * Command validation will use indices into this array. 692d5b1a78aSEric Anholt */ 693*47c07e46SMaíra Canal struct drm_gem_object **bo; 694d5b1a78aSEric Anholt uint32_t bo_count; 695d5b1a78aSEric Anholt 6967edabee0SEric Anholt /* List of BOs that are being written by the RCL. Other than 6977edabee0SEric Anholt * the binner temporary storage, this is all the BOs written 6987edabee0SEric Anholt * by the job. 6997edabee0SEric Anholt */ 7004a83c26aSDanilo Krummrich struct drm_gem_dma_object *rcl_write_bo[4]; 7017edabee0SEric Anholt uint32_t rcl_write_bo_count; 7027edabee0SEric Anholt 703d5b1a78aSEric Anholt /* Pointers for our position in vc4->job_list */ 704d5b1a78aSEric Anholt struct list_head head; 705d5b1a78aSEric Anholt 706d5b1a78aSEric Anholt /* List of other BOs used in the job that need to be released 707d5b1a78aSEric Anholt * once the job is complete. 708d5b1a78aSEric Anholt */ 709d5b1a78aSEric Anholt struct list_head unref_list; 710d5b1a78aSEric Anholt 711d5b1a78aSEric Anholt /* Current unvalidated indices into @bo loaded by the non-hardware 712d5b1a78aSEric Anholt * VC4_PACKET_GEM_HANDLES. 713d5b1a78aSEric Anholt */ 714d5b1a78aSEric Anholt uint32_t bo_index[2]; 715d5b1a78aSEric Anholt 716d5b1a78aSEric Anholt /* This is the BO where we store the validated command lists, shader 717d5b1a78aSEric Anholt * records, and uniforms. 718d5b1a78aSEric Anholt */ 7194a83c26aSDanilo Krummrich struct drm_gem_dma_object *exec_bo; 720d5b1a78aSEric Anholt 721d5b1a78aSEric Anholt /** 722d5b1a78aSEric Anholt * This tracks the per-shader-record state (packet 64) that 723d5b1a78aSEric Anholt * determines the length of the shader record and the offset 724d5b1a78aSEric Anholt * it's expected to be found at. It gets read in from the 725d5b1a78aSEric Anholt * command lists. 726d5b1a78aSEric Anholt */ 727d5b1a78aSEric Anholt struct vc4_shader_state { 728d5b1a78aSEric Anholt uint32_t addr; 729d5b1a78aSEric Anholt /* Maximum vertex index referenced by any primitive using this 730d5b1a78aSEric Anholt * shader state. 731d5b1a78aSEric Anholt */ 732d5b1a78aSEric Anholt uint32_t max_index; 733d5b1a78aSEric Anholt } *shader_state; 734d5b1a78aSEric Anholt 735d5b1a78aSEric Anholt /** How many shader states the user declared they were using. */ 736d5b1a78aSEric Anholt uint32_t shader_state_size; 737d5b1a78aSEric Anholt /** How many shader state records the validator has seen. */ 738d5b1a78aSEric Anholt uint32_t shader_state_count; 739d5b1a78aSEric Anholt 740d5b1a78aSEric Anholt bool found_tile_binning_mode_config_packet; 741d5b1a78aSEric Anholt bool found_start_tile_binning_packet; 742d5b1a78aSEric Anholt bool found_increment_semaphore_packet; 743d5b1a78aSEric Anholt bool found_flush; 744d5b1a78aSEric Anholt uint8_t bin_tiles_x, bin_tiles_y; 745553c942fSEric Anholt /* Physical address of the start of the tile alloc array 746553c942fSEric Anholt * (where each tile's binned CL will start) 747553c942fSEric Anholt */ 748d5b1a78aSEric Anholt uint32_t tile_alloc_offset; 749553c942fSEric Anholt /* Bitmask of which binner slots are freed when this job completes. */ 750553c942fSEric Anholt uint32_t bin_slots; 751d5b1a78aSEric Anholt 752d5b1a78aSEric Anholt /** 753d5b1a78aSEric Anholt * Computed addresses pointing into exec_bo where we start the 754d5b1a78aSEric Anholt * bin thread (ct0) and render thread (ct1). 755d5b1a78aSEric Anholt */ 756d5b1a78aSEric Anholt uint32_t ct0ca, ct0ea; 757d5b1a78aSEric Anholt uint32_t ct1ca, ct1ea; 758d5b1a78aSEric Anholt 759d5b1a78aSEric Anholt /* Pointer to the unvalidated bin CL (if present). */ 760d5b1a78aSEric Anholt void *bin_u; 761d5b1a78aSEric Anholt 762d5b1a78aSEric Anholt /* Pointers to the shader recs. These paddr gets incremented as CL 763d5b1a78aSEric Anholt * packets are relocated in validate_gl_shader_state, and the vaddrs 764d5b1a78aSEric Anholt * (u and v) get incremented and size decremented as the shader recs 765d5b1a78aSEric Anholt * themselves are validated. 766d5b1a78aSEric Anholt */ 767d5b1a78aSEric Anholt void *shader_rec_u; 768d5b1a78aSEric Anholt void *shader_rec_v; 769d5b1a78aSEric Anholt uint32_t shader_rec_p; 770d5b1a78aSEric Anholt uint32_t shader_rec_size; 771d5b1a78aSEric Anholt 772d5b1a78aSEric Anholt /* Pointers to the uniform data. These pointers are incremented, and 773d5b1a78aSEric Anholt * size decremented, as each batch of uniforms is uploaded. 774d5b1a78aSEric Anholt */ 775d5b1a78aSEric Anholt void *uniforms_u; 776d5b1a78aSEric Anholt void *uniforms_v; 777d5b1a78aSEric Anholt uint32_t uniforms_p; 778d5b1a78aSEric Anholt uint32_t uniforms_size; 77965101d8cSBoris Brezillon 78065101d8cSBoris Brezillon /* Pointer to a performance monitor object if the user requested it, 78165101d8cSBoris Brezillon * NULL otherwise. 78265101d8cSBoris Brezillon */ 78365101d8cSBoris Brezillon struct vc4_perfmon *perfmon; 78435c8b4b2SPaul Kocialkowski 78535c8b4b2SPaul Kocialkowski /* Whether the exec has taken a reference to the binner BO, which should 78635c8b4b2SPaul Kocialkowski * happen with a VC4_PACKET_TILE_BINNING_MODE_CONFIG packet. 78735c8b4b2SPaul Kocialkowski */ 78835c8b4b2SPaul Kocialkowski bool bin_bo_used; 78965101d8cSBoris Brezillon }; 79065101d8cSBoris Brezillon 79165101d8cSBoris Brezillon /* Per-open file private data. Any driver-specific resource that has to be 79265101d8cSBoris Brezillon * released when the DRM file is closed should be placed here. 79365101d8cSBoris Brezillon */ 79465101d8cSBoris Brezillon struct vc4_file { 79530f8c74cSMaxime Ripard struct vc4_dev *dev; 79630f8c74cSMaxime Ripard 79765101d8cSBoris Brezillon struct { 79865101d8cSBoris Brezillon struct idr idr; 79965101d8cSBoris Brezillon struct mutex lock; 80065101d8cSBoris Brezillon } perfmon; 80135c8b4b2SPaul Kocialkowski 80235c8b4b2SPaul Kocialkowski bool bin_bo_used; 803d5b1a78aSEric Anholt }; 804d5b1a78aSEric Anholt 805d5b1a78aSEric Anholt static inline struct vc4_exec_info * 806ca26d28bSVarad Gautam vc4_first_bin_job(struct vc4_dev *vc4) 807d5b1a78aSEric Anholt { 80857b9f569SMasahiro Yamada return list_first_entry_or_null(&vc4->bin_job_list, 80957b9f569SMasahiro Yamada struct vc4_exec_info, head); 810ca26d28bSVarad Gautam } 811ca26d28bSVarad Gautam 812ca26d28bSVarad Gautam static inline struct vc4_exec_info * 813ca26d28bSVarad Gautam vc4_first_render_job(struct vc4_dev *vc4) 814ca26d28bSVarad Gautam { 81557b9f569SMasahiro Yamada return list_first_entry_or_null(&vc4->render_job_list, 816ca26d28bSVarad Gautam struct vc4_exec_info, head); 817d5b1a78aSEric Anholt } 818d5b1a78aSEric Anholt 8199326e6f2SEric Anholt static inline struct vc4_exec_info * 8209326e6f2SEric Anholt vc4_last_render_job(struct vc4_dev *vc4) 8219326e6f2SEric Anholt { 8229326e6f2SEric Anholt if (list_empty(&vc4->render_job_list)) 8239326e6f2SEric Anholt return NULL; 8249326e6f2SEric Anholt return list_last_entry(&vc4->render_job_list, 8259326e6f2SEric Anholt struct vc4_exec_info, head); 8269326e6f2SEric Anholt } 8279326e6f2SEric Anholt 828c8b75bcaSEric Anholt /** 829463873d5SEric Anholt * struct vc4_texture_sample_info - saves the offsets into the UBO for texture 830463873d5SEric Anholt * setup parameters. 831463873d5SEric Anholt * 832463873d5SEric Anholt * This will be used at draw time to relocate the reference to the texture 833463873d5SEric Anholt * contents in p0, and validate that the offset combined with 834463873d5SEric Anholt * width/height/stride/etc. from p1 and p2/p3 doesn't sample outside the BO. 835463873d5SEric Anholt * Note that the hardware treats unprovided config parameters as 0, so not all 836463873d5SEric Anholt * of them need to be set up for every texure sample, and we'll store ~0 as 837463873d5SEric Anholt * the offset to mark the unused ones. 838463873d5SEric Anholt * 839463873d5SEric Anholt * See the VC4 3D architecture guide page 41 ("Texture and Memory Lookup Unit 840463873d5SEric Anholt * Setup") for definitions of the texture parameters. 841463873d5SEric Anholt */ 842463873d5SEric Anholt struct vc4_texture_sample_info { 843463873d5SEric Anholt bool is_direct; 844463873d5SEric Anholt uint32_t p_offset[4]; 845463873d5SEric Anholt }; 846463873d5SEric Anholt 847463873d5SEric Anholt /** 848463873d5SEric Anholt * struct vc4_validated_shader_info - information about validated shaders that 849463873d5SEric Anholt * needs to be used from command list validation. 850463873d5SEric Anholt * 851463873d5SEric Anholt * For a given shader, each time a shader state record references it, we need 852463873d5SEric Anholt * to verify that the shader doesn't read more uniforms than the shader state 853463873d5SEric Anholt * record's uniform BO pointer can provide, and we need to apply relocations 854463873d5SEric Anholt * and validate the shader state record's uniforms that define the texture 855463873d5SEric Anholt * samples. 856463873d5SEric Anholt */ 857463873d5SEric Anholt struct vc4_validated_shader_info { 858463873d5SEric Anholt uint32_t uniforms_size; 859463873d5SEric Anholt uint32_t uniforms_src_size; 860463873d5SEric Anholt uint32_t num_texture_samples; 861463873d5SEric Anholt struct vc4_texture_sample_info *texture_samples; 8626d45c81dSEric Anholt 8636d45c81dSEric Anholt uint32_t num_uniform_addr_offsets; 8646d45c81dSEric Anholt uint32_t *uniform_addr_offsets; 865c778cc5dSJonas Pfeil 866c778cc5dSJonas Pfeil bool is_threaded; 867463873d5SEric Anholt }; 868463873d5SEric Anholt 869463873d5SEric Anholt /** 8707f2a09ecSJames Hughes * __wait_for - magic wait macro 871c8b75bcaSEric Anholt * 8727f2a09ecSJames Hughes * Macro to help avoid open coding check/wait/timeout patterns. Note that it's 8737f2a09ecSJames Hughes * important that we check the condition again after having timed out, since the 8747f2a09ecSJames Hughes * timeout could be due to preemption or similar and we've never had a chance to 8757f2a09ecSJames Hughes * check the condition before the timeout. 876c8b75bcaSEric Anholt */ 8777f2a09ecSJames Hughes #define __wait_for(OP, COND, US, Wmin, Wmax) ({ \ 8787f2a09ecSJames Hughes const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ 8797f2a09ecSJames Hughes long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ 8807f2a09ecSJames Hughes int ret__; \ 8817f2a09ecSJames Hughes might_sleep(); \ 8827f2a09ecSJames Hughes for (;;) { \ 8837f2a09ecSJames Hughes const bool expired__ = ktime_after(ktime_get_raw(), end__); \ 8847f2a09ecSJames Hughes OP; \ 8857f2a09ecSJames Hughes /* Guarantee COND check prior to timeout */ \ 8867f2a09ecSJames Hughes barrier(); \ 8877f2a09ecSJames Hughes if (COND) { \ 8887f2a09ecSJames Hughes ret__ = 0; \ 8897f2a09ecSJames Hughes break; \ 8907f2a09ecSJames Hughes } \ 8917f2a09ecSJames Hughes if (expired__) { \ 892c8b75bcaSEric Anholt ret__ = -ETIMEDOUT; \ 893c8b75bcaSEric Anholt break; \ 894c8b75bcaSEric Anholt } \ 8957f2a09ecSJames Hughes usleep_range(wait__, wait__ * 2); \ 8967f2a09ecSJames Hughes if (wait__ < (Wmax)) \ 8977f2a09ecSJames Hughes wait__ <<= 1; \ 898c8b75bcaSEric Anholt } \ 899c8b75bcaSEric Anholt ret__; \ 900c8b75bcaSEric Anholt }) 901c8b75bcaSEric Anholt 9027f2a09ecSJames Hughes #define _wait_for(COND, US, Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ 9037f2a09ecSJames Hughes (Wmax)) 9047f2a09ecSJames Hughes #define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000) 905c8b75bcaSEric Anholt 906c8b75bcaSEric Anholt /* vc4_bo.c */ 907c826a6e1SEric Anholt struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); 908c826a6e1SEric Anholt struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, 909f3099462SEric Anholt bool from_cache, enum vc4_kernel_bo_type type); 910dd2dfd44SMaxime Ripard int vc4_bo_dumb_create(struct drm_file *file_priv, 911c8b75bcaSEric Anholt struct drm_device *dev, 912c8b75bcaSEric Anholt struct drm_mode_create_dumb *args); 913d5bc60f6SEric Anholt int vc4_create_bo_ioctl(struct drm_device *dev, void *data, 914d5bc60f6SEric Anholt struct drm_file *file_priv); 915463873d5SEric Anholt int vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, 916463873d5SEric Anholt struct drm_file *file_priv); 917d5bc60f6SEric Anholt int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, 918d5bc60f6SEric Anholt struct drm_file *file_priv); 91983753117SEric Anholt int vc4_set_tiling_ioctl(struct drm_device *dev, void *data, 92083753117SEric Anholt struct drm_file *file_priv); 92183753117SEric Anholt int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, 92283753117SEric Anholt struct drm_file *file_priv); 92321461365SEric Anholt int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, 92421461365SEric Anholt struct drm_file *file_priv); 925f3099462SEric Anholt int vc4_label_bo_ioctl(struct drm_device *dev, void *data, 926f3099462SEric Anholt struct drm_file *file_priv); 927f3099462SEric Anholt int vc4_bo_cache_init(struct drm_device *dev); 928b9f19259SBoris Brezillon int vc4_bo_inc_usecnt(struct vc4_bo *bo); 929b9f19259SBoris Brezillon void vc4_bo_dec_usecnt(struct vc4_bo *bo); 930b9f19259SBoris Brezillon void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); 931b9f19259SBoris Brezillon void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo); 932445b287eSMaxime Ripard int vc4_bo_debugfs_init(struct drm_minor *minor); 933c8b75bcaSEric Anholt 934c8b75bcaSEric Anholt /* vc4_crtc.c */ 935c8b75bcaSEric Anholt extern struct platform_driver vc4_crtc_driver; 936875a4d53SMaxime Ripard int vc4_crtc_disable_at_boot(struct drm_crtc *crtc); 937ee33ac27SMaxime Ripard int __vc4_crtc_init(struct drm_device *drm, struct platform_device *pdev, 938ee33ac27SMaxime Ripard struct vc4_crtc *vc4_crtc, const struct vc4_crtc_data *data, 939ee33ac27SMaxime Ripard struct drm_plane *primary_plane, 940ee33ac27SMaxime Ripard const struct drm_crtc_funcs *crtc_funcs, 941ee33ac27SMaxime Ripard const struct drm_crtc_helper_funcs *crtc_helper_funcs, 942ee33ac27SMaxime Ripard bool feeds_txp); 9433f98076fSMaxime Ripard int vc4_crtc_init(struct drm_device *drm, struct platform_device *pdev, 9443f98076fSMaxime Ripard struct vc4_crtc *vc4_crtc, const struct vc4_crtc_data *data, 9455fefc601SMaxime Ripard const struct drm_crtc_funcs *crtc_funcs, 9463f98076fSMaxime Ripard const struct drm_crtc_helper_funcs *crtc_helper_funcs, 9473f98076fSMaxime Ripard bool feeds_txp); 948bdd96472SMaxime Ripard int vc4_page_flip(struct drm_crtc *crtc, 949bdd96472SMaxime Ripard struct drm_framebuffer *fb, 950bdd96472SMaxime Ripard struct drm_pending_vblank_event *event, 951bdd96472SMaxime Ripard uint32_t flags, 952bdd96472SMaxime Ripard struct drm_modeset_acquire_ctx *ctx); 953f759f5b5SMaxime Ripard int vc4_crtc_atomic_check(struct drm_crtc *crtc, 954f759f5b5SMaxime Ripard struct drm_atomic_state *state); 955bdd96472SMaxime Ripard struct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc); 956bdd96472SMaxime Ripard void vc4_crtc_destroy_state(struct drm_crtc *crtc, 957bdd96472SMaxime Ripard struct drm_crtc_state *state); 958bdd96472SMaxime Ripard void vc4_crtc_reset(struct drm_crtc *crtc); 959008095e0SBoris Brezillon void vc4_crtc_handle_vblank(struct vc4_crtc *crtc); 96068e4a69aSMaxime Ripard void vc4_crtc_send_vblank(struct drm_crtc *crtc); 961445b287eSMaxime Ripard int vc4_crtc_late_register(struct drm_crtc *crtc); 962666e7358SBoris Brezillon void vc4_crtc_get_margins(struct drm_crtc_state *state, 963e590c2b0SDan Carpenter unsigned int *left, unsigned int *right, 964666e7358SBoris Brezillon unsigned int *top, unsigned int *bottom); 965c8b75bcaSEric Anholt 966c8b75bcaSEric Anholt /* vc4_debugfs.c */ 9677ce84471SWambui Karuga void vc4_debugfs_init(struct drm_minor *minor); 968c9be804cSEric Anholt #ifdef CONFIG_DEBUG_FS 969f2ede40eSMaíra Canal void vc4_debugfs_add_regset32(struct drm_device *drm, 970c9be804cSEric Anholt const char *filename, 971c9be804cSEric Anholt struct debugfs_regset32 *regset); 972c9be804cSEric Anholt #else 973c9be804cSEric Anholt 974f2ede40eSMaíra Canal static inline void vc4_debugfs_add_regset32(struct drm_device *drm, 975c9be804cSEric Anholt const char *filename, 976c9be804cSEric Anholt struct debugfs_regset32 *regset) 977f2ede40eSMaíra Canal {} 978c9be804cSEric Anholt #endif 979c8b75bcaSEric Anholt 980c8b75bcaSEric Anholt /* vc4_drv.c */ 981c8b75bcaSEric Anholt void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); 9823d763742SMaxime Ripard int vc4_dumb_fixup_args(struct drm_mode_create_dumb *args); 983c8b75bcaSEric Anholt 98408302c35SEric Anholt /* vc4_dpi.c */ 98508302c35SEric Anholt extern struct platform_driver vc4_dpi_driver; 98608302c35SEric Anholt 9874078f575SEric Anholt /* vc4_dsi.c */ 9884078f575SEric Anholt extern struct platform_driver vc4_dsi_driver; 9894078f575SEric Anholt 990cdec4d36SEric Anholt /* vc4_fence.c */ 991cdec4d36SEric Anholt extern const struct dma_fence_ops vc4_fence_ops; 992cdec4d36SEric Anholt 993d5b1a78aSEric Anholt /* vc4_gem.c */ 994171a072bSMaxime Ripard int vc4_gem_init(struct drm_device *dev); 995d5b1a78aSEric Anholt int vc4_submit_cl_ioctl(struct drm_device *dev, void *data, 996d5b1a78aSEric Anholt struct drm_file *file_priv); 997d5b1a78aSEric Anholt int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data, 998d5b1a78aSEric Anholt struct drm_file *file_priv); 999d5b1a78aSEric Anholt int vc4_wait_bo_ioctl(struct drm_device *dev, void *data, 1000d5b1a78aSEric Anholt struct drm_file *file_priv); 1001ca26d28bSVarad Gautam void vc4_submit_next_bin_job(struct drm_device *dev); 1002ca26d28bSVarad Gautam void vc4_submit_next_render_job(struct drm_device *dev); 1003ca26d28bSVarad Gautam void vc4_move_job_to_render(struct drm_device *dev, struct vc4_exec_info *exec); 1004d5b1a78aSEric Anholt int vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno, 1005d5b1a78aSEric Anholt uint64_t timeout_ns, bool interruptible); 1006d5b1a78aSEric Anholt void vc4_job_handle_completed(struct vc4_dev *vc4); 1007b501baccSEric Anholt int vc4_queue_seqno_cb(struct drm_device *dev, 1008b501baccSEric Anholt struct vc4_seqno_cb *cb, uint64_t seqno, 1009b501baccSEric Anholt void (*func)(struct vc4_seqno_cb *cb)); 1010b9f19259SBoris Brezillon int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data, 1011b9f19259SBoris Brezillon struct drm_file *file_priv); 1012d5b1a78aSEric Anholt 1013c8b75bcaSEric Anholt /* vc4_hdmi.c */ 1014c8b75bcaSEric Anholt extern struct platform_driver vc4_hdmi_driver; 1015c8b75bcaSEric Anholt 10169a8d5e4aSBoris Brezillon /* vc4_vec.c */ 1017e4b81f8cSBoris Brezillon extern struct platform_driver vc4_vec_driver; 1018e4b81f8cSBoris Brezillon 1019008095e0SBoris Brezillon /* vc4_txp.c */ 1020008095e0SBoris Brezillon extern struct platform_driver vc4_txp_driver; 1021008095e0SBoris Brezillon 1022d5b1a78aSEric Anholt /* vc4_irq.c */ 10235226711eSThomas Zimmermann void vc4_irq_enable(struct drm_device *dev); 10245226711eSThomas Zimmermann void vc4_irq_disable(struct drm_device *dev); 10255226711eSThomas Zimmermann int vc4_irq_install(struct drm_device *dev, int irq); 1026d5b1a78aSEric Anholt void vc4_irq_uninstall(struct drm_device *dev); 1027d5b1a78aSEric Anholt void vc4_irq_reset(struct drm_device *dev); 1028d5b1a78aSEric Anholt 1029c8b75bcaSEric Anholt /* vc4_hvs.c */ 1030c8b75bcaSEric Anholt extern struct platform_driver vc4_hvs_driver; 1031640dbcc9SMaxime Ripard struct vc4_hvs *__vc4_hvs_alloc(struct vc4_dev *vc4, struct platform_device *pdev); 10323454f01aSMaxime Ripard void vc4_hvs_stop_channel(struct vc4_hvs *hvs, unsigned int output); 10333454f01aSMaxime Ripard int vc4_hvs_get_fifo_from_output(struct vc4_hvs *hvs, unsigned int output); 10343454f01aSMaxime Ripard u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo); 1035ee6965c8SMaxime Ripard int vc4_hvs_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state); 1036eeb6ab46SMaxime Ripard void vc4_hvs_atomic_begin(struct drm_crtc *crtc, struct drm_atomic_state *state); 1037ee6965c8SMaxime Ripard void vc4_hvs_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_state *state); 1038ee6965c8SMaxime Ripard void vc4_hvs_atomic_disable(struct drm_crtc *crtc, struct drm_atomic_state *state); 1039ee6965c8SMaxime Ripard void vc4_hvs_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state); 10403454f01aSMaxime Ripard void vc4_hvs_dump_state(struct vc4_hvs *hvs); 10413454f01aSMaxime Ripard void vc4_hvs_unmask_underrun(struct vc4_hvs *hvs, int channel); 10423454f01aSMaxime Ripard void vc4_hvs_mask_underrun(struct vc4_hvs *hvs, int channel); 1043445b287eSMaxime Ripard int vc4_hvs_debugfs_init(struct drm_minor *minor); 1044c8b75bcaSEric Anholt 1045c8b75bcaSEric Anholt /* vc4_kms.c */ 1046c8b75bcaSEric Anholt int vc4_kms_load(struct drm_device *dev); 1047c8b75bcaSEric Anholt 1048c8b75bcaSEric Anholt /* vc4_plane.c */ 1049c8b75bcaSEric Anholt struct drm_plane *vc4_plane_init(struct drm_device *dev, 105077c5fb12SMaxime Ripard enum drm_plane_type type, 105177c5fb12SMaxime Ripard uint32_t possible_crtcs); 10520c2a50f1SMaxime Ripard int vc4_plane_create_additional_planes(struct drm_device *dev); 1053c8b75bcaSEric Anholt u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); 10542f196b7cSDaniel Vetter u32 vc4_plane_dlist_size(const struct drm_plane_state *state); 1055b501baccSEric Anholt void vc4_plane_async_set_fb(struct drm_plane *plane, 1056b501baccSEric Anholt struct drm_framebuffer *fb); 1057463873d5SEric Anholt 1058d3f5168aSEric Anholt /* vc4_v3d.c */ 1059d3f5168aSEric Anholt extern struct platform_driver vc4_v3d_driver; 1060ffc26740SEric Anholt extern const struct of_device_id vc4_v3d_dt_match[]; 1061553c942fSEric Anholt int vc4_v3d_get_bin_slot(struct vc4_dev *vc4); 106235c8b4b2SPaul Kocialkowski int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used); 106335c8b4b2SPaul Kocialkowski void vc4_v3d_bin_bo_put(struct vc4_dev *vc4); 1064cb74f6eeSEric Anholt int vc4_v3d_pm_get(struct vc4_dev *vc4); 1065cb74f6eeSEric Anholt void vc4_v3d_pm_put(struct vc4_dev *vc4); 1066445b287eSMaxime Ripard int vc4_v3d_debugfs_init(struct drm_minor *minor); 1067d5b1a78aSEric Anholt 1068d5b1a78aSEric Anholt /* vc4_validate.c */ 1069d5b1a78aSEric Anholt int 1070d5b1a78aSEric Anholt vc4_validate_bin_cl(struct drm_device *dev, 1071d5b1a78aSEric Anholt void *validated, 1072d5b1a78aSEric Anholt void *unvalidated, 1073d5b1a78aSEric Anholt struct vc4_exec_info *exec); 1074d5b1a78aSEric Anholt 1075d5b1a78aSEric Anholt int 1076d5b1a78aSEric Anholt vc4_validate_shader_recs(struct drm_device *dev, struct vc4_exec_info *exec); 1077d5b1a78aSEric Anholt 10784a83c26aSDanilo Krummrich struct drm_gem_dma_object *vc4_use_bo(struct vc4_exec_info *exec, 1079d5b1a78aSEric Anholt uint32_t hindex); 1080d5b1a78aSEric Anholt 1081d5b1a78aSEric Anholt int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec); 1082d5b1a78aSEric Anholt 1083d5b1a78aSEric Anholt bool vc4_check_tex_size(struct vc4_exec_info *exec, 10844a83c26aSDanilo Krummrich struct drm_gem_dma_object *fbo, 1085d5b1a78aSEric Anholt uint32_t offset, uint8_t tiling_format, 1086d5b1a78aSEric Anholt uint32_t width, uint32_t height, uint8_t cpp); 1087d3f5168aSEric Anholt 1088463873d5SEric Anholt /* vc4_validate_shader.c */ 1089463873d5SEric Anholt struct vc4_validated_shader_info * 10904a83c26aSDanilo Krummrich vc4_validate_shader(struct drm_gem_dma_object *shader_obj); 109165101d8cSBoris Brezillon 109265101d8cSBoris Brezillon /* vc4_perfmon.c */ 109365101d8cSBoris Brezillon void vc4_perfmon_get(struct vc4_perfmon *perfmon); 109465101d8cSBoris Brezillon void vc4_perfmon_put(struct vc4_perfmon *perfmon); 109565101d8cSBoris Brezillon void vc4_perfmon_start(struct vc4_dev *vc4, struct vc4_perfmon *perfmon); 109665101d8cSBoris Brezillon void vc4_perfmon_stop(struct vc4_dev *vc4, struct vc4_perfmon *perfmon, 109765101d8cSBoris Brezillon bool capture); 109865101d8cSBoris Brezillon struct vc4_perfmon *vc4_perfmon_find(struct vc4_file *vc4file, int id); 109965101d8cSBoris Brezillon void vc4_perfmon_open_file(struct vc4_file *vc4file); 110065101d8cSBoris Brezillon void vc4_perfmon_close_file(struct vc4_file *vc4file); 110165101d8cSBoris Brezillon int vc4_perfmon_create_ioctl(struct drm_device *dev, void *data, 110265101d8cSBoris Brezillon struct drm_file *file_priv); 110365101d8cSBoris Brezillon int vc4_perfmon_destroy_ioctl(struct drm_device *dev, void *data, 110465101d8cSBoris Brezillon struct drm_file *file_priv); 110565101d8cSBoris Brezillon int vc4_perfmon_get_values_ioctl(struct drm_device *dev, void *data, 110665101d8cSBoris Brezillon struct drm_file *file_priv); 11076a88752cSMaxime Ripard 11086a88752cSMaxime Ripard #endif /* _VC4_DRV_H_ */ 1109