drm/v3d: Add a note about OOM vs FRDONE, which may be racing on v3.3.
Subsystems (3)
PATCH 1/4 drm/v3d: Add a note about OOM vs FRDONE, which may be racing on v3.3.
We deref v3d->bin_job in the work handler, but v3d->bin_job doesn't actually hold a ref on the job.
--- drivers/gpu/drm/v3d/v3d_irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/v3d/v3d_irq.c +2 -1
@@ -87,7 +87,8 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_OUTOMEM ) {/* Note that the OOM status is edge signaled, so the * interrupt won't happen again until the we actually -* add more memory. +* add more memory. Also, as of V3D 4.1, FRDONE won't +* be reported until any OOM state has been cleared. */ schedule_work (&v3d->overflow_mem_work); status =IRQ_HANDLED ;
Signature · 1 line
2.20.1
PATCH 2/4 drm/v3d: Rename the fence signaled from IRQs to "irq_fence".
We have another thing called the "done fence" that tracks when the scheduler considers the job done, and having the shared name was confusing.
--- drivers/gpu/drm/v3d/v3d_drv.h | 4 ++-- drivers/gpu/drm/v3d/v3d_gem.c | 6 +++--- drivers/gpu/drm/v3d/v3d_irq.c | 6 +++--- drivers/gpu/drm/v3d/v3d_sched.c | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.h +2 -2
@@ -169,7 +169,7 @@ struct v3d_job {struct dma_fence *in_fence;/* v3d fence to be signaled by IRQ handler when the job is complete. */ -struct dma_fence *done_fence; +struct dma_fence *irq_fence;/* GPU virtual addresses of the start/end of the CL job. */ u32 start, end;
@@ -216,7 +216,7 @@ struct v3d_tfu_job {struct dma_fence *in_fence;/* v3d fence to be signaled by IRQ handler when the job is complete. */ -struct dma_fence *done_fence; +struct dma_fence *irq_fence;struct v3d_dev *v3d;
drivers/gpu/drm/v3d/v3d_gem.c +3 -3
@@ -339,8 +339,8 @@ v3d_exec_cleanup(struct kref *ref)dma_fence_put (exec->bin.in_fence);dma_fence_put (exec->render.in_fence); -dma_fence_put (exec->bin.done_fence); -dma_fence_put (exec->render.done_fence); +dma_fence_put (exec->bin.irq_fence); +dma_fence_put (exec->render.irq_fence);dma_fence_put (exec->bin_done_fence);dma_fence_put (exec->render_done_fence);
@@ -373,7 +373,7 @@ v3d_tfu_job_cleanup(struct kref *ref)unsigned int i;dma_fence_put (job->in_fence); -dma_fence_put (job->done_fence); +dma_fence_put (job->irq_fence);for (i =0 ; i <ARRAY_SIZE (job->bo); i++) {if (job->bo[i])
drivers/gpu/drm/v3d/v3d_irq.c +3 -3
@@ -96,7 +96,7 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_FLDONE ) {struct v3d_fence *fence = -to_v3d_fence (v3d->bin_job->bin.done_fence); +to_v3d_fence (v3d->bin_job->bin.irq_fence);trace_v3d_bcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);
@@ -105,7 +105,7 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_FRDONE ) {struct v3d_fence *fence = -to_v3d_fence (v3d->render_job->render.done_fence); +to_v3d_fence (v3d->render_job->render.irq_fence);trace_v3d_rcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);
@@ -141,7 +141,7 @@ v3d_hub_irq(int irq, void *arg)if (intsts &V3D_HUB_INT_TFUC ) {struct v3d_fence *fence = -to_v3d_fence (v3d->tfu_job->done_fence); +to_v3d_fence (v3d->tfu_job->irq_fence);trace_v3d_tfu_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);
drivers/gpu/drm/v3d/v3d_sched.c +6 -6
@@ -156,9 +156,9 @@ static struct dma_fence *v3d_job_run(struct drm_sched_job *sched_job)if (IS_ERR (fence))return NULL ; -if (job->done_fence) -dma_fence_put (job->done_fence); - job->done_fence =dma_fence_get (fence); +if (job->irq_fence) +dma_fence_put (job->irq_fence); + job->irq_fence =dma_fence_get (fence);trace_v3d_submit_cl (dev, q ==V3D_RENDER ,to_v3d_fence (fence)->seqno, job->start, job->end);
@@ -199,9 +199,9 @@ v3d_tfu_job_run(struct drm_sched_job *sched_job)return NULL ; v3d->tfu_job = job; -if (job->done_fence) -dma_fence_put (job->done_fence); - job->done_fence =dma_fence_get (fence); +if (job->irq_fence) +dma_fence_put (job->irq_fence); + job->irq_fence =dma_fence_get (fence);trace_v3d_submit_tfu (dev,to_v3d_fence (fence)->seqno);
Signature · 1 line
2.20.1
Re: [PATCH 2/4] drm/v3d: Rename the fence signaled from IRQs to "irq_fence".
Quoted 6 lines · Eric Anholt
We have another thing called the "done fence" that tracks when the scheduler considers the job done, and having the shared name was confusing.
Signed-off-by Eric Anholt <[email protected]>
Quoted 117 lines
--- drivers/gpu/drm/v3d/v3d_drv.h | 4 ++-- drivers/gpu/drm/v3d/v3d_gem.c | 6 +++--- drivers/gpu/drm/v3d/v3d_irq.c | 6 +++--- drivers/gpu/drm/v3d/v3d_sched.c | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-)drivers/gpu/drm/v3d/v3d_drv.h +2
-2@@ -169,7 +169,7 @@ struct v3d_job {struct dma_fence *in_fence;/* v3d fence to be signaled by IRQ handler when the job is complete. */ -struct dma_fence *done_fence; +struct dma_fence *irq_fence;/* GPU virtual addresses of the start/end of the CL job. */ u32 start, end;@@ -216,7 +216,7 @@ struct v3d_tfu_job {struct dma_fence *in_fence;/* v3d fence to be signaled by IRQ handler when the job is complete. */ -struct dma_fence *done_fence; +struct dma_fence *irq_fence;struct v3d_dev *v3d;drivers/gpu/drm/v3d/v3d_gem.c +3
-3@@ -339,8 +339,8 @@ v3d_exec_cleanup(struct kref *ref)dma_fence_put (exec->bin.in_fence);dma_fence_put (exec->render.in_fence); -dma_fence_put (exec->bin.done_fence); -dma_fence_put (exec->render.done_fence); +dma_fence_put (exec->bin.irq_fence); +dma_fence_put (exec->render.irq_fence);dma_fence_put (exec->bin_done_fence);dma_fence_put (exec->render_done_fence);@@ -373,7 +373,7 @@ v3d_tfu_job_cleanup(struct kref *ref)unsigned int i;dma_fence_put (job->in_fence); -dma_fence_put (job->done_fence); +dma_fence_put (job->irq_fence);for (i =0 ; i <ARRAY_SIZE (job->bo); i++) {if (job->bo[i])drivers/gpu/drm/v3d/v3d_irq.c +3
-3@@ -96,7 +96,7 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_FLDONE ) {struct v3d_fence *fence = -to_v3d_fence (v3d->bin_job->bin.done_fence); +to_v3d_fence (v3d->bin_job->bin.irq_fence);trace_v3d_bcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);@@ -105,7 +105,7 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_FRDONE ) {struct v3d_fence *fence = -to_v3d_fence (v3d->render_job->render.done_fence); +to_v3d_fence (v3d->render_job->render.irq_fence);trace_v3d_rcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);@@ -141,7 +141,7 @@ v3d_hub_irq(int irq, void *arg)if (intsts &V3D_HUB_INT_TFUC ) {struct v3d_fence *fence = -to_v3d_fence (v3d->tfu_job->done_fence); +to_v3d_fence (v3d->tfu_job->irq_fence);trace_v3d_tfu_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);drivers/gpu/drm/v3d/v3d_sched.c +6
-7@@ -156,9 +156,9 @@ static struct dma_fence *v3d_job_run(struct drm_sched_job *sched_job)if (IS_ERR (fence))return NULL ; -if (job->done_fence) -dma_fence_put (job->done_fence); - job->done_fence =dma_fence_get (fence); +if (job->irq_fence) +dma_fence_put (job->irq_fence); + job->irq_fence =dma_fence_get (fence);trace_v3d_submit_cl (dev, q ==V3D_RENDER ,to_v3d_fence (fence)->seqno, job->start, job->end);@@ -199,9 +199,9 @@ v3d_tfu_job_run(struct drm_sched_job *sched_job)return NULL ; v3d->tfu_job = job; -if (job->done_fence) -dma_fence_put (job->done_fence); - job->done_fence =dma_fence_get (fence); +if (job->irq_fence) +dma_fence_put (job->irq_fence); + job->irq_fence =dma_fence_get (fence);trace_v3d_submit_tfu (dev,to_v3d_fence (fence)->seqno); --2.20.1
PATCH 3/4 drm/v3d: Refactor job management.
In reply to Eric AnholtThe CL submission had two jobs embedded in an exec struct. When I added TFU support, I had to replicate some of the exec stuff and some of the job stuff. As I went to add CSD, it became clear that actually what was in exec should just be in the two CL jobs, and it would let us share a lot more code between the 4 queues.
--- drivers/gpu/drm/v3d/v3d_drv.h | 77 +++---- drivers/gpu/drm/v3d/v3d_gem.c | 344 ++++++++++++++++---------------- drivers/gpu/drm/v3d/v3d_irq.c | 8 +- drivers/gpu/drm/v3d/v3d_sched.c | 259 ++++++++++++++---------- 4 files changed, 370 insertions(+), 318 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.h +39 -38
@@ -73,8 +73,8 @@ struct v3d_dev {struct work_struct overflow_mem_work; -struct v3d_exec_info *bin_job; -struct v3d_exec_info *render_job; +struct v3d_bin_job *bin_job; +struct v3d_render_job *render_job;struct v3d_tfu_job *tfu_job;struct v3d_queue_state queue[V3D_MAX_QUEUES ];
@@ -123,7 +123,7 @@ struct v3d_bo {struct drm_mm_node node;/* List entry for the BO's position in -* v3d_exec_info->unref_list +* v3d_render_job->unref_list */ struct list_head unref_head; };
@@ -163,7 +163,15 @@ to_v3d_fence(struct dma_fence *fence)struct v3d_job {struct drm_sched_job base; -struct v3d_exec_info *exec; +struct kref refcount; + +struct v3d_dev *v3d; + +/* This is the array of BOs that were looked up at the start +* of submission. +*/ +struct v3d_bo **bo; +u32 bo_count;/* An optional fence userspace can pass in for the job to depend on. */ struct dma_fence *in_fence;
@@ -171,59 +179,53 @@ struct v3d_job {/* v3d fence to be signaled by IRQ handler when the job is complete. */ struct dma_fence *irq_fence; +/* scheduler fence for when the job is considered complete and +* the BO reservations can be released. +*/ +struct dma_fence *done_fence; + +/* Callback for the freeing of the job on refcount going to 0. */ +void (*free)(struct kref *ref); +}; + +struct v3d_bin_job { +struct v3d_job base; +/* GPU virtual addresses of the start/end of the CL job. */ u32 start, end;u32 timedout_ctca, timedout_ctra; -}; -struct v3d_exec_info { -struct v3d_dev *v3d; +/* Corresponding render job, for attaching our overflow memory. */ +struct v3d_render_job *render; + +/* Submitted tile memory allocation start/size, tile state. */ +u32 qma, qms, qts; +}; -struct v3d_job bin, render; +struct v3d_render_job { +struct v3d_job base; -/* Fence for when the scheduler considers the binner to be -* done, for render to depend on. +/* Optional fence for the binner, to depend on before starting +* our job. */ struct dma_fence *bin_done_fence; -/* Fence for when the scheduler considers the render to be -* done, for when the BOs reservations should be complete. -*/ -struct dma_fence *render_done_fence; - -struct kref refcount; +/* GPU virtual addresses of the start/end of the CL job. */ +u32 start, end; -/* This is the array of BOs that were looked up at the start of exec. */ -struct v3d_bo **bo; -u32 bo_count; +u32 timedout_ctca, timedout_ctra;/* List of overflow BOs used in the job that need to be * released once the job is complete. */ struct list_head unref_list; - -/* Submitted tile memory allocation start/size, tile state. */ -u32 qma, qms, qts; };struct v3d_tfu_job { -struct drm_sched_job base; +struct v3d_job base;struct drm_v3d_submit_tfu args; - -/* An optional fence userspace can pass in for the job to depend on. */ -struct dma_fence *in_fence; - -/* v3d fence to be signaled by IRQ handler when the job is complete. */ -struct dma_fence *irq_fence; - -struct v3d_dev *v3d; - -struct kref refcount; - -/* This is the array of BOs that were looked up at the start of exec. */ -struct v3d_bo *bo[4 ]; };/**
@@ -289,8 +291,7 @@ int v3d_submit_tfu_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);int v3d_wait_bo_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); -void v3d_exec_put (struct v3d_exec_info *exec); -void v3d_tfu_job_put (struct v3d_tfu_job *exec); +void v3d_job_put (struct v3d_job *job);void v3d_reset (struct v3d_dev *v3d);void v3d_invalidate_caches (struct v3d_dev *v3d);
drivers/gpu/drm/v3d/v3d_gem.c +176 -168
522 lines not on this page · raw message
drivers/gpu/drm/v3d/v3d_irq.c +4 -4
@@ -62,7 +62,7 @@ v3d_overflow_mem_work(struct work_struct *work) }drm_gem_object_get (obj); -list_add_tail (&bo->unref_head, &v3d->bin_job->unref_list); +list_add_tail (&bo->unref_head, &v3d->bin_job->render->unref_list);spin_unlock_irqrestore (&v3d->job_lock, irqflags);V3D_CORE_WRITE (0 ,V3D_PTB_BPOA , bo->node.start <<PAGE_SHIFT );
@@ -96,7 +96,7 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_FLDONE ) {struct v3d_fence *fence = -to_v3d_fence (v3d->bin_job->bin.irq_fence); +to_v3d_fence (v3d->bin_job->base.irq_fence);trace_v3d_bcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);
@@ -105,7 +105,7 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_FRDONE ) {struct v3d_fence *fence = -to_v3d_fence (v3d->render_job->render.irq_fence); +to_v3d_fence (v3d->render_job->base.irq_fence);trace_v3d_rcl_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);
@@ -141,7 +141,7 @@ v3d_hub_irq(int irq, void *arg)if (intsts &V3D_HUB_INT_TFUC ) {struct v3d_fence *fence = -to_v3d_fence (v3d->tfu_job->irq_fence); +to_v3d_fence (v3d->tfu_job->base.irq_fence);trace_v3d_tfu_irq (&v3d->drm, fence->seqno);dma_fence_signal (&fence->base);
drivers/gpu/drm/v3d/v3d_sched.c +151 -108
388 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/4 drm/v3d: Add support for compute shader dispatch.
In reply to Eric AnholtThe compute shader dispatch interface is pretty simple -- just pass in the regs that userspace has passed us, with no CLs to run. However, with no CL to run it means that we need to do manual cache flushing of the L2 after the HW execution completes (for SSBO, atomic, and image_load_store writes that are the output of compute shaders).
This doesn't yet expose the L2 cache's ability to have a region of the address space not write back to memory (which could be used for shared_var storage).
So far, the Mesa side has been tested on V3D v4.2 simpenrose (passing the ES31 tests), and on the kernel side on 7278 (failing atomic compswap tests in a way that doesn't reproduce on simpenrose).
--- drivers/gpu/drm/v3d/v3d_debugfs.c | 22 +++++ drivers/gpu/drm/v3d/v3d_drv.c | 10 +- drivers/gpu/drm/v3d/v3d_drv.h | 28 +++++- drivers/gpu/drm/v3d/v3d_fence.c | 2 + drivers/gpu/drm/v3d/v3d_gem.c | 157 ++++++++++++++++++++++++++++-- drivers/gpu/drm/v3d/v3d_irq.c | 16 ++- drivers/gpu/drm/v3d/v3d_regs.h | 73 ++++++++++++++ drivers/gpu/drm/v3d/v3d_sched.c | 121 +++++++++++++++++++++-- drivers/gpu/drm/v3d/v3d_trace.h | 94 ++++++++++++++++++ include/uapi/drm/v3d_drm.h | 28 ++++++ 10 files changed, 531 insertions(+), 20 deletions(-)
drivers/gpu/drm/v3d/v3d_debugfs.c +22 -0
@@ -58,6 +58,17 @@ static const struct v3d_reg_def v3d_core_reg_defs[] = { REGDEF(V3D_GMP_VIO_ADDR), }; +static const struct v3d_reg_def v3d_csd_reg_defs[] = { +REGDEF (V3D_CSD_STATUS ), +REGDEF (V3D_CSD_CURRENT_CFG0 ), +REGDEF (V3D_CSD_CURRENT_CFG1 ), +REGDEF (V3D_CSD_CURRENT_CFG2 ), +REGDEF (V3D_CSD_CURRENT_CFG3 ), +REGDEF (V3D_CSD_CURRENT_CFG4 ), +REGDEF (V3D_CSD_CURRENT_CFG5 ), +REGDEF (V3D_CSD_CURRENT_CFG6 ), +}; +static int v3d_v3d_debugfs_regs (struct seq_file *m,void *unused) {struct drm_info_node *node = (struct drm_info_node *)m->private;
@@ -89,6 +100,17 @@ static int v3d_v3d_debugfs_regs(struct seq_file *m, void *unused)V3D_CORE_READ (core, v3d_core_reg_defs[i].reg)); } + +if (v3d_has_csd (v3d)) { +for (i =0 ; i <ARRAY_SIZE (v3d_csd_reg_defs); i++) { +seq_printf (m,"core %d %s (0x%04x): 0x%08x\n" , + core, + v3d_csd_reg_defs[i].name, + v3d_csd_reg_defs[i].reg, +V3D_CORE_READ (core, + v3d_csd_reg_defs[i].reg)); + } + } }return 0 ;
drivers/gpu/drm/v3d/v3d_drv.c +7 -3
@@ -7,9 +7,9 @@* This driver supports the Broadcom V3D 3.3 and 4.1 OpenGL ES GPUs. * For V3D 2.x support, see the VC4 driver. * -* Currently only single-core rendering using the binner and renderer, -* along with TFU (texture formatting unit) rendering is supported. -* V3D 4.x's CSD (compute shader dispatch) is not yet supported. +* The V3D GPU includes a tiled render (composed of a bin and render +* pipelines), the TFU (texture formatting unit), and the CSD (compute +* shader dispatch). */ #include <linux/clk.h>
@@ -191,6 +191,9 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data,case DRM_V3D_PARAM_SUPPORTS_TFU : args->value =1 ;return 0 ; +case DRM_V3D_PARAM_SUPPORTS_CSD : + args->value =v3d_has_csd (v3d); +return 0 ;default :DRM_DEBUG ("Unknown parameter %d\n" , args->param);return -EINVAL ;
@@ -250,6 +253,7 @@ static const struct drm_ioctl_desc v3d_drm_ioctls[] = {DRM_IOCTL_DEF_DRV (V3D_GET_PARAM , v3d_get_param_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (V3D_GET_BO_OFFSET , v3d_get_bo_offset_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (V3D_SUBMIT_TFU , v3d_submit_tfu_ioctl,DRM_RENDER_ALLOW |DRM_AUTH ), + DRM_IOCTL_DEF_DRV(V3D_SUBMIT_CSD, v3d_submit_csd_ioctl, DRM_RENDER_ALLOW | DRM_AUTH), }; static int v3d_dumb_create(struct drm_file *file_priv,
drivers/gpu/drm/v3d/v3d_drv.h +27 -1
@@ -17,9 +17,11 @@ enum v3d_queue { V3D_BIN,V3D_RENDER ,V3D_TFU , +V3D_CSD , + V3D_CACHE_CLEAN, }; -#define V3D_MAX_QUEUES (V3D_TFU + 1) +#define V3D_MAX_QUEUES (V3D_CACHE_CLEAN + 1)struct v3d_queue_state {struct drm_gpu_scheduler sched;
@@ -76,6 +78,7 @@ struct v3d_dev {struct v3d_bin_job *bin_job;struct v3d_render_job *render_job;struct v3d_tfu_job *tfu_job; +struct v3d_csd_job *csd_job;struct v3d_queue_state queue[V3D_MAX_QUEUES ];
@@ -98,6 +101,12 @@ struct v3d_dev {*/ struct mutex sched_lock; +/* Lock taken during a cache clean and when initiating an L2 +* flush, to keep L2 flushes from interfering with the +* synchronous L2 cleans. +*/ +struct mutex cache_clean_lock; +struct {u32 num_allocated;u32 pages_allocated;
@@ -110,6 +119,12 @@ to_v3d_dev(struct drm_device *dev)return (struct v3d_dev *)dev->dev_private; } +static inline bool +v3d_has_csd (struct v3d_dev *v3d) +{ +return v3d->ver >=41 ; +} +/* The per-fd struct, which tracks the MMU mappings. */ struct v3d_file_priv {struct v3d_dev *v3d;
@@ -228,6 +243,14 @@ struct v3d_tfu_job {struct drm_v3d_submit_tfu args; }; +struct v3d_csd_job { +struct v3d_job base; + +u32 timedout_batches; + +struct drm_v3d_submit_csd args; +}; +/** * _wait_for - magic (register) wait macro *
@@ -289,11 +312,14 @@ int v3d_submit_cl_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);int v3d_submit_tfu_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); +int v3d_submit_csd_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_priv);int v3d_wait_bo_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv);void v3d_job_put (struct v3d_job *job);void v3d_reset (struct v3d_dev *v3d);void v3d_invalidate_caches (struct v3d_dev *v3d); +void v3d_clean_caches (struct v3d_dev *v3d);/* v3d_irq.c */ int v3d_irq_init (struct v3d_dev *v3d);
drivers/gpu/drm/v3d/v3d_fence.c +2 -0
@@ -36,6 +36,8 @@ static const char *v3d_fence_get_timeline_name(struct dma_fence *fence)return "v3d-render" ;case V3D_TFU :return "v3d-tfu" ; +case V3D_CSD : +return "v3d-csd" ;default :return NULL ; }
drivers/gpu/drm/v3d/v3d_gem.c +151 -6
207 lines not on this page · raw message
drivers/gpu/drm/v3d/v3d_irq.c +13 -3
@@ -4,9 +4,9 @@/** * DOC: Interrupt management for the V3D engine * -* When we take a bin, render, or TFU done interrupt, we need to -* signal the fence for that job so that the scheduler can queue up -* the next one and unblock any waiters. +* When we take a bin, render, TFU done, or CSD done interrupt, we +* need to signal the fence for that job so that the scheduler can +* queue up the next one and unblock any waiters. * * When we take the binner out of memory interrupt, we need to * allocate some new memory and pass it to the binner so that the
@@ -20,6 +20,7 @@#define V3D_CORE_IRQS ((u32)(V3D_INT_OUTOMEM | \ V3D_INT_FLDONE | \ V3D_INT_FRDONE | \ + V3D_INT_CSDDONE | \ V3D_INT_GMPV))#define V3D_HUB_IRQS ((u32)(V3D_HUB_INT_MMU_WRV | \
@@ -112,6 +113,15 @@ v3d_irq(int irq, void *arg) status =IRQ_HANDLED ; } +if (intsts &V3D_INT_CSDDONE ) { +struct v3d_fence *fence = +to_v3d_fence (v3d->csd_job->base.irq_fence); + +trace_v3d_csd_irq (&v3d->drm, fence->seqno); +dma_fence_signal (&fence->base); + status =IRQ_HANDLED ; + } +/* We shouldn't be triggering these if we have GMP in * always-allowed mode. */
drivers/gpu/drm/v3d/v3d_regs.h +73 -0
91 lines not on this page · raw message
drivers/gpu/drm/v3d/v3d_sched.c +114 -7
173 lines not on this page · raw message
drivers/gpu/drm/v3d/v3d_trace.h +94 -0
106 lines not on this page · raw message
include/uapi/drm/v3d_drm.h +28 -0
@@ -37,6 +37,7 @@ extern "C" {#define DRM_V3D_GET_PARAM 0x04#define DRM_V3D_GET_BO_OFFSET 0x05#define DRM_V3D_SUBMIT_TFU 0x06 +#define DRM_V3D_SUBMIT_CSD 0x07#define DRM_IOCTL_V3D_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CL, struct drm_v3d_submit_cl)#define DRM_IOCTL_V3D_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_WAIT_BO, struct drm_v3d_wait_bo)
@@ -45,6 +46,7 @@ extern "C" {#define DRM_IOCTL_V3D_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_PARAM, struct drm_v3d_get_param)#define DRM_IOCTL_V3D_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_V3D_GET_BO_OFFSET, struct drm_v3d_get_bo_offset)#define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu) +#define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)/** * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D
@@ -190,6 +192,7 @@ enum drm_v3d_param {DRM_V3D_PARAM_V3D_CORE0_IDENT1 ,DRM_V3D_PARAM_V3D_CORE0_IDENT2 ,DRM_V3D_PARAM_SUPPORTS_TFU , + DRM_V3D_PARAM_SUPPORTS_CSD, }; struct drm_v3d_get_param {
@@ -230,6 +233,31 @@ struct drm_v3d_submit_tfu {__u32 out_sync; }; +/* Submits a compute shader for dispatch. This job will block on any +* previous compute shaders submitted on this fd, and any other +* synchronization must be performed with in_sync/out_sync. +*/ +struct drm_v3d_submit_csd { +__u32 cfg[7 ]; +__u32 coef[4 ]; + +/* Pointer to a u32 array of the BOs that are referenced by the job. +*/ +__u64 bo_handles; + +/* Number of BO handles passed in (size is that times 4). */ +__u32 bo_handle_count; + +/* sync object to block on before running the CSD job. Each +* CSD job will execute in the order submitted to its FD. +* Synchronization against rendering/TFU jobs or CSD from +* other fds requires using sync objects. +*/ +__u32 in_sync; +/* Sync object to signal when the CSD job is done. */ +__u32 out_sync; +}; +#if defined(__cplusplus) }#endif
Signature · 1 line
2.20.1
Quoted 5 lines · Eric Anholt
We deref
v3d->bin_jobin the work handler, butv3d->bin_jobdoesn't actually hold a ref on the job.Signed-off-by Eric Anholt <[email protected]>
Quoted 9 lines
--- drivers/gpu/drm/v3d/v3d_irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/v3d/v3d_irq.c +0
-0
drivers/gpu/drm/v3d/v3d_irq.c v3d_irq(int irq, void *arg) · line 91
Quoted 6 lines
drivers/gpu/drm/v3d/v3d_irq.c +2
-1@@ -87,7 +87,8 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_OUTOMEM ) {/* Note that the OOM status is edge signaled, so the * interrupt won't happen again until the we actually -* add more memory. +* add more memory. Also, as of V3D 4.1, FRDONE won't +* be reported until any OOM state has been cleared.
Strictly speaking it's FLDONE for bins.
Quoted 6 lines
drivers/gpu/drm/v3d/v3d_irq.c +0
-1*/ schedule_work (&v3d->overflow_mem_work); status =IRQ_HANDLED ; --2.20.1
Quoted 12 lines · Dave Emett
Quoted 5 lines · Eric Anholt
We deref
v3d->bin_jobin the work handler, butv3d->bin_jobdoesn't actually hold a ref on the job.Signed-off-by Eric Anholt <[email protected]>Reviewed-by Dave Emett <[email protected]>Quoted 4 lines
--- drivers/gpu/drm/v3d/v3d_irq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines
drivers/gpu/drm/v3d/v3d_irq.c v3d_irq(int irq, void *arg) · line 91
Quoted 11 lines
drivers/gpu/drm/v3d/v3d_irq.c +2
-1@@ -87,7 +87,8 @@ v3d_irq(int irq, void *arg)if (intsts &V3D_INT_OUTOMEM ) {/* Note that the OOM status is edge signaled, so the * interrupt won't happen again until the we actually -* add more memory. +* add more memory. Also, as of V3D 4.1, FRDONE won't +* be reported until any OOM state has been cleared. Strictly speaking it's FLDONE for bins.
Fixed, thanks.
I'm applying the first 2 of the series for now.