diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-09 14:10:29 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-09 15:28:14 -0400 |
commit | 694c6caf92615828dbfd3fc30e937c8f54d2ac93 (patch) | |
tree | ae85bc8db4563a2ec07865b021700a36a3f438b7 /drivers/gpu/drm | |
parent | ac9738bb3e5374495908ad236285f69cfd405f8e (diff) |
drm/gf100-/gr: improve initial context patch list helpers
Removes need for fixed buffer indices, and allows the functions
utilising them to also be run outside of context generation.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
4 files changed, 51 insertions, 20 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c index 6a2a288dc253..a0514d3de615 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c | |||
@@ -982,6 +982,44 @@ nvc0_grctx_pack_tpc[] = { | |||
982 | * PGRAPH context implementation | 982 | * PGRAPH context implementation |
983 | ******************************************************************************/ | 983 | ******************************************************************************/ |
984 | 984 | ||
985 | int | ||
986 | nvc0_grctx_mmio_data(struct nvc0_grctx *info, u32 size, u32 align, u32 access) | ||
987 | { | ||
988 | if (info->data) { | ||
989 | info->buffer[info->buffer_nr] = round_up(info->addr, align); | ||
990 | info->addr = info->buffer[info->buffer_nr] + size; | ||
991 | info->data->size = size; | ||
992 | info->data->align = align; | ||
993 | info->data->access = access; | ||
994 | info->data++; | ||
995 | return info->buffer_nr++; | ||
996 | } | ||
997 | return -1; | ||
998 | } | ||
999 | |||
1000 | void | ||
1001 | nvc0_grctx_mmio_item(struct nvc0_grctx *info, u32 addr, u32 data, | ||
1002 | int shift, int buffer) | ||
1003 | { | ||
1004 | if (info->data) { | ||
1005 | if (shift >= 0) { | ||
1006 | info->mmio->addr = addr; | ||
1007 | info->mmio->data = data; | ||
1008 | info->mmio->shift = shift; | ||
1009 | info->mmio->buffer = buffer; | ||
1010 | if (buffer >= 0) | ||
1011 | data |= info->buffer[buffer] >> shift; | ||
1012 | info->mmio++; | ||
1013 | } else | ||
1014 | return; | ||
1015 | } else { | ||
1016 | if (buffer >= 0) | ||
1017 | return; | ||
1018 | } | ||
1019 | |||
1020 | nv_wr32(info->priv, addr, data); | ||
1021 | } | ||
1022 | |||
985 | void | 1023 | void |
986 | nvc0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) | 1024 | nvc0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) |
987 | { | 1025 | { |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h index 03a934457c26..0579542cde3a 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h | |||
@@ -12,6 +12,17 @@ struct nvc0_grctx { | |||
12 | u64 addr; | 12 | u64 addr; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | int nvc0_grctx_mmio_data(struct nvc0_grctx *, u32 size, u32 align, u32 access); | ||
16 | void nvc0_grctx_mmio_item(struct nvc0_grctx *, u32 addr, u32 data, int s, int); | ||
17 | |||
18 | #define mmio_data(a,b,c) nvc0_grctx_mmio_data(info, (a), (b), (c)) | ||
19 | #define mmio_list(a,b,c,d) nvc0_grctx_mmio_item(info, (a), (b), (c), (d)) | ||
20 | |||
21 | #define mmio_vram(a,b,c,d) nvc0_grctx_mmio_data((a), (b), (c), (d)) | ||
22 | #define mmio_refn(a,b,c,d,e) nvc0_grctx_mmio_item((a), (b), (c), (d), (e)) | ||
23 | #define mmio_skip(a,b,c) mmio_refn((a), (b), (c), -1, -1) | ||
24 | #define mmio_wr32(a,b,c) mmio_refn((a), (b), (c), 0, -1) | ||
25 | |||
15 | struct nvc0_grctx_oclass { | 26 | struct nvc0_grctx_oclass { |
16 | struct nouveau_oclass base; | 27 | struct nouveau_oclass base; |
17 | /* main context generation function */ | 28 | /* main context generation function */ |
@@ -30,24 +41,6 @@ struct nvc0_grctx_oclass { | |||
30 | const struct nvc0_graph_pack *mthd; | 41 | const struct nvc0_graph_pack *mthd; |
31 | }; | 42 | }; |
32 | 43 | ||
33 | #define mmio_data(s,a,p) do { \ | ||
34 | info->buffer[info->buffer_nr] = round_up(info->addr, (a)); \ | ||
35 | info->addr = info->buffer[info->buffer_nr++] + (s); \ | ||
36 | info->data->size = (s); \ | ||
37 | info->data->align = (a); \ | ||
38 | info->data->access = (p); \ | ||
39 | info->data++; \ | ||
40 | } while(0) | ||
41 | |||
42 | #define mmio_list(r,d,s,b) do { \ | ||
43 | info->mmio->addr = (r); \ | ||
44 | info->mmio->data = (d); \ | ||
45 | info->mmio->shift = (s); \ | ||
46 | info->mmio->buffer = (b); \ | ||
47 | info->mmio++; \ | ||
48 | nv_wr32(priv, (r), (d) | ((s) ? (info->buffer[(b)] >> (s)) : 0)); \ | ||
49 | } while(0) | ||
50 | |||
51 | extern struct nouveau_oclass *nvc0_grctx_oclass; | 44 | extern struct nouveau_oclass *nvc0_grctx_oclass; |
52 | int nvc0_grctx_generate(struct nvc0_graph_priv *); | 45 | int nvc0_grctx_generate(struct nvc0_graph_priv *); |
53 | void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *); | 46 | void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c index 0156862fb34d..0f9847237347 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | |||
@@ -283,7 +283,7 @@ nvc0_graph_context_ctor(struct nouveau_object *parent, | |||
283 | u32 addr = mmio->addr; | 283 | u32 addr = mmio->addr; |
284 | u32 data = mmio->data; | 284 | u32 data = mmio->data; |
285 | 285 | ||
286 | if (mmio->shift) { | 286 | if (mmio->buffer >= 0) { |
287 | u64 info = chan->data[mmio->buffer].vma.offset; | 287 | u64 info = chan->data[mmio->buffer].vma.offset; |
288 | data |= info >> mmio->shift; | 288 | data |= info >> mmio->shift; |
289 | } | 289 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h index bfe9bdddbec8..fde401017556 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | |||
@@ -65,7 +65,7 @@ struct nvc0_graph_mmio { | |||
65 | u32 addr; | 65 | u32 addr; |
66 | u32 data; | 66 | u32 data; |
67 | u32 shift; | 67 | u32 shift; |
68 | u32 buffer; | 68 | int buffer; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | struct nvc0_graph_fuc { | 71 | struct nvc0_graph_fuc { |