Commit 16d55345 authored by Yusuf Khan's avatar Yusuf Khan
Browse files

nouveau: Support semaphores



Signed-off-by: Yusuf Khan's avatarYusuf Khan <yusisamerican@gmail.com>
parent ae76bba3
Pipeline #751171 waiting for manual action with stages
......@@ -202,6 +202,16 @@ _nouveau_fence_signalled(struct nouveau_fence *fence)
return fence->state == NOUVEAU_FENCE_STATE_SIGNALLED;
}
void
nouveau_fence_server_signal(struct pipe_context *pipe,
struct pipe_fence_handle *fence)
{
struct nouveau_fence *nvfence = (struct nouveau_fence *)fence;
if (nvfence)
nouveau_fence_signalled(nvfence);
}
static bool
nouveau_fence_kick(struct nouveau_fence *fence)
{
......@@ -389,3 +399,14 @@ nouveau_fence_signalled(struct nouveau_fence *fence)
simple_mtx_unlock(&fence->screen->fence.lock);
return ret;
}
void
nouveau_fence_server_sync(struct pipe_context *pipe,
struct pipe_fence_handle *fence)
{
struct nouveau_context *ctx = nouveau_context(pipe);
struct nouveau_fence *nvfence = (struct nouveau_fence *)fence;
if (nvfence)
nouveau_fence_wait(nvfence, &ctx->debug);
}
......@@ -67,6 +67,8 @@ void nouveau_fence_next(struct nouveau_context *);
bool nouveau_fence_wait(struct nouveau_fence *, struct util_debug_callback *);
bool nouveau_fence_signalled(struct nouveau_fence *);
void nouveau_fence_ref(struct nouveau_fence *, struct nouveau_fence **);
void nouveau_fence_server_sync(struct pipe_context *pipe, struct pipe_fence_handle *fence);
void nouveau_fence_server_signal(struct pipe_context *pipe, struct pipe_fence_handle *fence);
void nouveau_fence_unref_bo(void *data); /* generic unref bo callback */
......
......@@ -199,6 +199,7 @@ nv30_context_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
pipe->priv = priv;
pipe->destroy = nv30_context_destroy;
pipe->flush = nv30_context_flush;
/* XXX: Is this fine? pipe->fence_server_sync = nouveau_fence_server_sync; */
if (nouveau_context_init(&nv30->base, &screen->base)) {
nv30_context_destroy(pipe);
......
......@@ -344,6 +344,8 @@ nv50_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
pipe->launch_grid = nv50_launch_grid;
pipe->flush = nv50_flush;
pipe->fence_server_sync = nouveau_fence_server_sync;
pipe->fence_server_signal = nouveau_fence_server_signal;
pipe->texture_barrier = nv50_texture_barrier;
pipe->memory_barrier = nv50_memory_barrier;
pipe->get_sample_position = nv50_context_get_sample_position;
......
......@@ -231,6 +231,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_MULTISAMPLE:
case PIPE_CAP_FS_FINE_DERIVATIVE:
case PIPE_CAP_SAMPLER_VIEW_TARGET:
case PIPE_CAP_FENCE_SIGNAL:
case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
case PIPE_CAP_CLIP_HALFZ:
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
......@@ -354,7 +355,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
case PIPE_CAP_CONTEXT_PRIORITY_MASK:
case PIPE_CAP_FENCE_SIGNAL:
case PIPE_CAP_CONSTBUF0_FLAGS:
case PIPE_CAP_PACKED_UNIFORMS:
case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES:
......
......@@ -457,6 +457,8 @@ nvc0_create(struct pipe_screen *pscreen, void *priv, unsigned ctxflags)
pipe->svm_migrate = nvc0_svm_migrate;
pipe->flush = nvc0_flush;
pipe->fence_server_sync = nouveau_fence_server_sync;
pipe->fence_server_signal = nouveau_fence_server_signal;
pipe->texture_barrier = nvc0_texture_barrier;
pipe->memory_barrier = nvc0_memory_barrier;
pipe->get_sample_position = nvc0_context_get_sample_position;
......
......@@ -254,6 +254,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_START_INSTANCE:
case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
case PIPE_CAP_DRAW_INDIRECT:
case PIPE_CAP_FENCE_SIGNAL:
case PIPE_CAP_USER_VERTEX_BUFFERS:
case PIPE_CAP_TEXTURE_QUERY_LOD:
case PIPE_CAP_SAMPLE_SHADING:
......@@ -390,7 +391,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
case PIPE_CAP_CONTEXT_PRIORITY_MASK:
case PIPE_CAP_FENCE_SIGNAL:
case PIPE_CAP_CONSTBUF0_FLAGS:
case PIPE_CAP_PACKED_UNIFORMS:
case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment