mirror of
https://github.com/torvalds/linux.git
synced 2024-12-06 11:01:43 +00:00
d223f98f02
The 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). v2: Fix excessive allocation for the clean_job (reported by Dan Carpenter). Keep refs on jobs until clean_job is finished, to avoid spurious MMU errors if the output BOs are freed by userspace before L2 cleaning is finished. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20190416225856.20264-4-eric@anholt.net Acked-by: Rob Clark <robdclark@gmail.com>
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/* Copyright (C) 2017-2018 Broadcom */
|
|
|
|
#include "v3d_drv.h"
|
|
|
|
struct dma_fence *v3d_fence_create(struct v3d_dev *v3d, enum v3d_queue queue)
|
|
{
|
|
struct v3d_fence *fence;
|
|
|
|
fence = kzalloc(sizeof(*fence), GFP_KERNEL);
|
|
if (!fence)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
fence->dev = &v3d->drm;
|
|
fence->queue = queue;
|
|
fence->seqno = ++v3d->queue[queue].emit_seqno;
|
|
dma_fence_init(&fence->base, &v3d_fence_ops, &v3d->job_lock,
|
|
v3d->queue[queue].fence_context, fence->seqno);
|
|
|
|
return &fence->base;
|
|
}
|
|
|
|
static const char *v3d_fence_get_driver_name(struct dma_fence *fence)
|
|
{
|
|
return "v3d";
|
|
}
|
|
|
|
static const char *v3d_fence_get_timeline_name(struct dma_fence *fence)
|
|
{
|
|
struct v3d_fence *f = to_v3d_fence(fence);
|
|
|
|
switch (f->queue) {
|
|
case V3D_BIN:
|
|
return "v3d-bin";
|
|
case V3D_RENDER:
|
|
return "v3d-render";
|
|
case V3D_TFU:
|
|
return "v3d-tfu";
|
|
case V3D_CSD:
|
|
return "v3d-csd";
|
|
default:
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
const struct dma_fence_ops v3d_fence_ops = {
|
|
.get_driver_name = v3d_fence_get_driver_name,
|
|
.get_timeline_name = v3d_fence_get_timeline_name,
|
|
};
|