Select Git revision
v3d_drv.h 15.40 KiB
// SPDX-License-Identifier: GPL-2.0+
/* Copyright (C) 2015-2018 Broadcom */
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/spinlock_types.h>
#include <linux/workqueue.h>
#include <drm/drm_encoder.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/gpu_scheduler.h>
#include "v3d_performance_counters.h"
#include "uapi/drm/v3d_drm.h"
struct clk;
struct platform_device;
struct reset_control;
#define GMP_GRANULARITY (128 * 1024)
#define V3D_MMU_PAGE_SHIFT 12
#define V3D_MAX_QUEUES (V3D_CPU + 1)
static inline char *v3d_queue_to_string(enum v3d_queue queue)
{
switch (queue) {
case V3D_BIN: return "bin";
case V3D_RENDER: return "render";
case V3D_TFU: return "tfu";
case V3D_CSD: return "csd";
case V3D_CACHE_CLEAN: return "cache_clean";
case V3D_CPU: return "cpu";
}
return "UNKNOWN";
}
struct v3d_stats {
u64 start_ns;
u64 enabled_ns;
u64 jobs_completed;
/*
* This seqcount is used to protect the access to the GPU stats
* variables. It must be used as, while we are reading the stats,
* IRQs can happen and the stats can be updated.
*/
seqcount_t lock;
};
struct v3d_queue_state {
struct drm_gpu_scheduler sched;
u64 fence_context;
u64 emit_seqno;
/* Stores the GPU stats for this queue in the global context. */
struct v3d_stats stats;
};
/* Performance monitor object. The perform lifetime is controlled by userspace
* using perfmon related ioctls. A perfmon can be attached to a submit_cl
* request, and when this is the case, HW perf counters will be activated just
* before the submit_cl is submitted to the GPU and disabled when the job is
* done. This way, only events related to a specific job will be counted.
*/
struct v3d_perfmon {