aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs2012-11-22 20:40:30 -0600
committerBen Skeggs2013-01-16 03:48:49 -0600
commitc41b494c47f8e514e69cb8c2f2ace41d5fa17c94 (patch)
tree1563deb3f0f957dba19cf5328ce4fe15e5f5923d
parent9e6f96a579fc2ed241e9a31a35a5995129ee8f7a (diff)
downloadlibdrm-c41b494c47f8e514e69cb8c2f2ace41d5fa17c94.tar.gz
libdrm-c41b494c47f8e514e69cb8c2f2ace41d5fa17c94.tar.xz
libdrm-c41b494c47f8e514e69cb8c2f2ace41d5fa17c94.zip
nouveau: expose channel engine selection on kepler chipsets
v2: Take Maarten Lankhorst's suggestion of nesting the struct to prevent sizeof() issues due to padding on older revisions. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
-rw-r--r--nouveau/abi16.c28
-rw-r--r--nouveau/nouveau.c3
-rw-r--r--nouveau/nouveau.h16
-rw-r--r--nouveau/private.h1
4 files changed, 48 insertions, 0 deletions
diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index a67fbc12..f34175e0 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -24,9 +24,11 @@
24 24
25#include <stdlib.h> 25#include <stdlib.h>
26#include <stdint.h> 26#include <stdint.h>
27#include <stddef.h>
27 28
28#include "private.h" 29#include "private.h"
29 30
31
30int 32int
31abi16_chan_nv04(struct nouveau_object *obj) 33abi16_chan_nv04(struct nouveau_object *obj)
32{ 34{
@@ -70,6 +72,32 @@ abi16_chan_nvc0(struct nouveau_object *obj)
70} 72}
71 73
72int 74int
75abi16_chan_nve0(struct nouveau_object *obj)
76{
77 struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
78 struct drm_nouveau_channel_alloc req = {};
79 struct nve0_fifo *nve0 = obj->data;
80 int ret;
81
82 if (obj->length > offsetof(struct nve0_fifo, engine)) {
83 req.fb_ctxdma_handle = 0xffffffff;
84 req.tt_ctxdma_handle = nve0->engine;
85 }
86
87 ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
88 &req, sizeof(req));
89 if (ret)
90 return ret;
91
92 nve0->base.channel = req.channel;
93 nve0->base.pushbuf = req.pushbuf_domains;
94 nve0->notify = req.notifier_handle;
95 nve0->base.object->handle = req.channel;
96 nve0->base.object->length = sizeof(*nve0);
97 return 0;
98}
99
100int
73abi16_engobj(struct nouveau_object *obj) 101abi16_engobj(struct nouveau_object *obj)
74{ 102{
75 struct drm_nouveau_grobj_alloc req = { 103 struct drm_nouveau_grobj_alloc req = {
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 940d9339..9b32e319 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -247,7 +247,10 @@ nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
247 if (dev->chipset < 0xc0) 247 if (dev->chipset < 0xc0)
248 ret = abi16_chan_nv04(obj); 248 ret = abi16_chan_nv04(obj);
249 else 249 else
250 if (dev->chipset < 0xe0)
250 ret = abi16_chan_nvc0(obj); 251 ret = abi16_chan_nvc0(obj);
252 else
253 ret = abi16_chan_nve0(obj);
251 } 254 }
252 break; 255 break;
253 default: 256 default:
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index c42eea7a..a55e2b02 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -41,6 +41,22 @@ struct nvc0_fifo {
41 uint32_t notify; 41 uint32_t notify;
42}; 42};
43 43
44#define NVE0_FIFO_ENGINE_GR 0x00000001
45#define NVE0_FIFO_ENGINE_VP 0x00000002
46#define NVE0_FIFO_ENGINE_PPP 0x00000004
47#define NVE0_FIFO_ENGINE_BSP 0x00000008
48#define NVE0_FIFO_ENGINE_CE0 0x00000010
49#define NVE0_FIFO_ENGINE_CE1 0x00000020
50#define NVE0_FIFO_ENGINE_ENC 0x00000040
51
52struct nve0_fifo {
53 struct {
54 struct nouveau_fifo base;
55 uint32_t notify;
56 };
57 uint32_t engine;
58};
59
44struct nv04_notify { 60struct nv04_notify {
45 struct nouveau_object *object; 61 struct nouveau_object *object;
46 uint32_t offset; 62 uint32_t offset;
diff --git a/nouveau/private.h b/nouveau/private.h
index b409cc8d..8a5cb261 100644
--- a/nouveau/private.h
+++ b/nouveau/private.h
@@ -113,6 +113,7 @@ nouveau_device_open_existing(struct nouveau_device **, int, int, drm_context_t);
113/* abi16.c */ 113/* abi16.c */
114int abi16_chan_nv04(struct nouveau_object *); 114int abi16_chan_nv04(struct nouveau_object *);
115int abi16_chan_nvc0(struct nouveau_object *); 115int abi16_chan_nvc0(struct nouveau_object *);
116int abi16_chan_nve0(struct nouveau_object *);
116int abi16_engobj(struct nouveau_object *); 117int abi16_engobj(struct nouveau_object *);
117int abi16_ntfy(struct nouveau_object *); 118int abi16_ntfy(struct nouveau_object *);
118void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *); 119void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *);