aboutsummaryrefslogtreecommitdiffstats
path: root/src/etnaviv/drm
diff options
context:
space:
mode:
authorLucas Stach <[email protected]>2019-08-09 17:11:23 +0200
committerLucas Stach <[email protected]>2019-10-18 17:03:25 +0000
commit1194afdfe3524de686735de7ff25c77dc435fa54 (patch)
treef3b5001239147f9039838c7a0a4e246ee268c2c6 /src/etnaviv/drm
parent1864fcd8c770e172fc6b4c5b4e79d9323e901f32 (diff)
etnaviv: rework the stream flush to always go through the context flush
This way we can ensure that the pipe driver tracking of pending resources stays in sync with the actual command buffer state, even if a space reservation triggers a forced flush. Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Jonathan Marek <[email protected]>
Diffstat (limited to 'src/etnaviv/drm')
-rw-r--r--src/etnaviv/drm/etnaviv_cmd_stream.c40
-rw-r--r--src/etnaviv/drm/etnaviv_drmif.h6
-rw-r--r--src/etnaviv/drm/etnaviv_priv.h4
3 files changed, 18 insertions, 32 deletions
diff --git a/src/etnaviv/drm/etnaviv_cmd_stream.c b/src/etnaviv/drm/etnaviv_cmd_stream.c
index a38aebf282c..6a218ad0bf2 100644
--- a/src/etnaviv/drm/etnaviv_cmd_stream.c
+++ b/src/etnaviv/drm/etnaviv_cmd_stream.c
@@ -57,7 +57,7 @@ etna_cmd_stream_priv(struct etna_cmd_stream *stream)
struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe,
uint32_t size,
- void (*reset_notify)(struct etna_cmd_stream *stream, void *priv),
+ void (*force_flush)(struct etna_cmd_stream *stream, void *priv),
void *priv)
{
struct etna_cmd_stream_priv *stream = NULL;
@@ -84,8 +84,8 @@ struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe,
stream->base.size = size;
stream->pipe = pipe;
- stream->reset_notify = reset_notify;
- stream->reset_notify_priv = priv;
+ stream->force_flush = force_flush;
+ stream->force_flush_priv = priv;
return &stream->base;
@@ -106,18 +106,12 @@ void etna_cmd_stream_del(struct etna_cmd_stream *stream)
free(priv);
}
-static void reset_buffer(struct etna_cmd_stream *stream)
+void etna_cmd_stream_force_flush(struct etna_cmd_stream *stream)
{
struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
- stream->offset = 0;
- priv->submit.nr_bos = 0;
- priv->submit.nr_relocs = 0;
- priv->submit.nr_pmrs = 0;
- priv->nr_bos = 0;
-
- if (priv->reset_notify)
- priv->reset_notify(stream, priv->reset_notify_priv);
+ if (priv->force_flush)
+ priv->force_flush(stream, priv->force_flush_priv);
}
uint32_t etna_cmd_stream_timestamp(struct etna_cmd_stream *stream)
@@ -180,8 +174,8 @@ static uint32_t bo2idx(struct etna_cmd_stream *stream, struct etna_bo *bo,
return idx;
}
-static void flush(struct etna_cmd_stream *stream, int in_fence_fd,
- int *out_fence_fd)
+void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
+ int *out_fence_fd)
{
struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
int ret, id = priv->pipe->id;
@@ -230,20 +224,12 @@ static void flush(struct etna_cmd_stream *stream, int in_fence_fd,
if (out_fence_fd)
*out_fence_fd = req.fence_fd;
-}
-
-void etna_cmd_stream_flush(struct etna_cmd_stream *stream)
-{
- flush(stream, -1, NULL);
- reset_buffer(stream);
-}
-void etna_cmd_stream_flush2(struct etna_cmd_stream *stream,
- int in_fence_fd,
- int *out_fence_fd)
-{
- flush(stream, in_fence_fd, out_fence_fd);
- reset_buffer(stream);
+ stream->offset = 0;
+ priv->submit.nr_bos = 0;
+ priv->submit.nr_relocs = 0;
+ priv->submit.nr_pmrs = 0;
+ priv->nr_bos = 0;
}
void etna_cmd_stream_reloc(struct etna_cmd_stream *stream,
diff --git a/src/etnaviv/drm/etnaviv_drmif.h b/src/etnaviv/drm/etnaviv_drmif.h
index 150eaff1943..7fb01c8a654 100644
--- a/src/etnaviv/drm/etnaviv_drmif.h
+++ b/src/etnaviv/drm/etnaviv_drmif.h
@@ -143,9 +143,9 @@ struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe, uint32_t siz
void *priv);
void etna_cmd_stream_del(struct etna_cmd_stream *stream);
uint32_t etna_cmd_stream_timestamp(struct etna_cmd_stream *stream);
-void etna_cmd_stream_flush(struct etna_cmd_stream *stream);
-void etna_cmd_stream_flush2(struct etna_cmd_stream *stream, int in_fence_fd,
+void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
int *out_fence_fd);
+void etna_cmd_stream_force_flush(struct etna_cmd_stream *stream);
static inline uint32_t etna_cmd_stream_avail(struct etna_cmd_stream *stream)
{
@@ -157,7 +157,7 @@ static inline uint32_t etna_cmd_stream_avail(struct etna_cmd_stream *stream)
static inline void etna_cmd_stream_reserve(struct etna_cmd_stream *stream, size_t n)
{
if (etna_cmd_stream_avail(stream) < n)
- etna_cmd_stream_flush(stream);
+ etna_cmd_stream_force_flush(stream);
}
static inline void etna_cmd_stream_emit(struct etna_cmd_stream *stream, uint32_t data)
diff --git a/src/etnaviv/drm/etnaviv_priv.h b/src/etnaviv/drm/etnaviv_priv.h
index 0c770f70540..a4b6a9df254 100644
--- a/src/etnaviv/drm/etnaviv_priv.h
+++ b/src/etnaviv/drm/etnaviv_priv.h
@@ -150,8 +150,8 @@ struct etna_cmd_stream_priv {
uint32_t nr_bos, max_bos;
/* notify callback if buffer reset happened */
- void (*reset_notify)(struct etna_cmd_stream *stream, void *priv);
- void *reset_notify_priv;
+ void (*force_flush)(struct etna_cmd_stream *stream, void *priv);
+ void *force_flush_priv;
void *bo_table;
};