Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'origin/gdev-axe'

  • Loading branch information...
commit 8a821f2c53365d79dc0bbf67cf53b86057316791 2 parents 8eb541c + 17c8f19
@shinpei0208 shinpei0208 authored
View
12 common/gdev_nvidia.h
@@ -153,7 +153,9 @@ struct gdev_ctx {
uint32_t pb_pos;
uint32_t pb_put;
uint32_t pb_get;
+ void (*space)(struct gdev_ctx *, uint32_t);
void (*push)(struct gdev_ctx *, uint64_t, uint32_t, int);
+ void (*kick)(struct gdev_ctx *);
void (*update_get)(struct gdev_ctx *);
} fifo; /* command FIFO queue struct. */
struct gdev_fence { /* fence objects (for compute and dma). */
@@ -265,6 +267,8 @@ static inline void __gdev_fire_ring(struct gdev_ctx *ctx)
if (len > 0)
ctx->fifo.push(ctx, base, len, 0);
ctx->fifo.pb_put = ctx->fifo.pb_pos;
+ if (ctx->fifo.kick)
+ ctx->fifo.kick(ctx);
}
}
@@ -272,7 +276,7 @@ static inline void __gdev_out_ring(struct gdev_ctx *ctx, uint32_t word)
{
while (((ctx->fifo.pb_pos + 4) & ctx->fifo.pb_mask) == ctx->fifo.pb_get) {
uint32_t old = ctx->fifo.pb_get;
- __gdev_fire_ring(ctx);
+ //__gdev_fire_ring(ctx);
ctx->fifo.update_get(ctx);
if (old == ctx->fifo.pb_get) {
SCHED_YIELD();
@@ -283,6 +287,12 @@ static inline void __gdev_out_ring(struct gdev_ctx *ctx, uint32_t word)
ctx->fifo.pb_pos &= ctx->fifo.pb_mask;
}
+static inline void __gdev_ring_space(struct gdev_ctx *ctx, uint32_t word)
+{
+ if (ctx->fifo.space)
+ ctx->fifo.space(ctx, word);
+}
+
static inline void __gdev_begin_ring_nv50(struct gdev_ctx *ctx, int subc, int mthd, int len)
{
__gdev_out_ring(ctx, mthd | (subc<<13) | (len<<18));
View
23 lib/user/nouveau/nouveau_gdev.c
@@ -42,27 +42,40 @@ struct gdev_nouveau_ctx_objects {
struct nouveau_object *m2mf;
};
-void __nouveau_fifo_push(struct gdev_ctx *ctx, uint64_t base, uint32_t len, int flags)
+void __nouveau_fifo_space(struct gdev_ctx *ctx, uint32_t len)
{
struct nouveau_pushbuf *push = (struct nouveau_pushbuf *)ctx->pctx;
+ nouveau_pushbuf_space(push, len, 0, 0);
+}
+void __nouveau_fifo_push(struct gdev_ctx *ctx, uint64_t base, uint32_t len, int flags)
+{
+ struct nouveau_pushbuf *push = (struct nouveau_pushbuf *)ctx->pctx;
int dwords = len / 4;
int p = ctx->fifo.pb_put / 4;
int max = ctx->fifo.pb_size / 4;
- nouveau_pushbuf_space(push, dwords, 1, 0);
+
+ nouveau_pushbuf_space(push, dwords, 0, 0);
for (;dwords > 0; dwords--) {
*push->cur++ = ctx->fifo.pb_map[p++];
if (p >= max) p = 0;
}
ctx->fifo.pb_put += len;
ctx->fifo.pb_put &= ctx->fifo.pb_mask;
+ //nouveau_pushbuf_kick(push, push->channel);
+}
+
+void __nouveau_fifo_kick(struct gdev_ctx *ctx)
+{
+ struct nouveau_pushbuf *push = (struct nouveau_pushbuf *)ctx->pctx;
nouveau_pushbuf_kick(push, push->channel);
}
void __nouveau_fifo_update_get(struct gdev_ctx *ctx)
{
- printf("FIXME: need to update FIFO GET in a safe manner.");
- ctx->fifo.pb_get = 0; /* FIXME */
+ //printf("FIXME: need to update FIFO GET in a safe manner.");
+ //ctx->fifo.pb_get = 0; /* FIXME */
+ ctx->fifo.pb_get = ctx->fifo.pb_put;
}
/* query a piece of the device-specific information. */
@@ -297,7 +310,9 @@ struct gdev_ctx *gdev_raw_ctx_new(struct gdev_device *gdev, struct gdev_vas *vas
ctx->fifo.pb_mask = (1 << ctx->fifo.pb_order) - 1;
ctx->fifo.pb_size = (1 << ctx->fifo.pb_order);
ctx->fifo.pb_pos = ctx->fifo.pb_put = ctx->fifo.pb_get = 0;
+ ctx->fifo.space = __nouveau_fifo_space;
ctx->fifo.push = __nouveau_fifo_push;
+ ctx->fifo.kick = __nouveau_fifo_kick;
ctx->fifo.update_get = __nouveau_fifo_update_get;
/* FIFO index buffer setup. */
View
1  lib/user/nvrm/nvrm_gdev.c
@@ -195,6 +195,7 @@ struct gdev_ctx *gdev_raw_ctx_new
if (!(ctx = malloc(sizeof(*ctx))))
goto fail_ctx;
+ memset(ctx, 0, sizeof(*ctx));
/* FIFO indirect buffer setup. */
ctx->fifo.ib_order = 10;
View
1  lib/user/pscnv/pscnv_gdev.c
@@ -173,6 +173,7 @@ struct gdev_ctx *gdev_raw_ctx_new
if (!(ctx = malloc(sizeof(*ctx))))
goto fail_ctx;
+ memset(ctx, 0, sizeof(*ctx));
/* FIFO indirect buffer setup. */
ctx->fifo.ib_order = chan->ib_order;
Please sign in to comment.
Something went wrong with that request. Please try again.