All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Ben Skeggs <bskeggs@redhat.com>
Cc: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: [PATCH] nouveau: add support for setting engine on nve0
Date: Fri, 11 Jan 2013 16:04:00 +0100	[thread overview]
Message-ID: <50F029E0.5070102@canonical.com> (raw)

When a specific engine is needed that's not GR, struct nve0_fifo should be used,
and the engine member should be used to select the engine.

This will fail on kernels before 3.8, since no support for such engines has been added yet.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>

---
Can you review/test this libdrm patch?

diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index a67fbc1..f8b51c1 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -70,6 +70,29 @@ abi16_chan_nvc0(struct nouveau_object *obj)
 }
 
 int
+abi16_chan_nve0(struct nouveau_object *obj)
+{
+	struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
+	struct nve0_fifo *nve0 = obj->data;
+	struct nvc0_fifo *nvc0 = &nve0->base;
+	struct drm_nouveau_channel_alloc req = { ~0, nve0->engine };
+	int ret;
+
+	ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC,
+				  &req, sizeof(req));
+	if (ret)
+		return ret;
+
+	nvc0->base.channel = req.channel;
+	nvc0->base.pushbuf = req.pushbuf_domains;
+	nvc0->notify = req.notifier_handle;
+	nvc0->base.object->handle = req.channel;
+	nvc0->base.object->length = sizeof(*nve0);
+	return 0;
+}
+
+
+int
 abi16_engobj(struct nouveau_object *obj)
 {
 	struct drm_nouveau_grobj_alloc req = {
diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c
index 940d933..24b4639 100644
--- a/nouveau/nouveau.c
+++ b/nouveau/nouveau.c
@@ -246,8 +246,11 @@ nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
 		{
 			if (dev->chipset < 0xc0)
 				ret = abi16_chan_nv04(obj);
-			else
+			else if (dev->chipset < 0xe0 ||
+				 length < sizeof(struct nve0_fifo))
 				ret = abi16_chan_nvc0(obj);
+			else
+				ret = abi16_chan_nve0(obj);
 		}
 			break;
 		default:
diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
index c42eea7..e088de5 100644
--- a/nouveau/nouveau.h
+++ b/nouveau/nouveau.h
@@ -41,6 +41,19 @@ struct nvc0_fifo {
 	uint32_t notify;
 };
 
+struct nve0_fifo {
+	struct nvc0_fifo base;
+	uint32_t engine;
+
+#define NVE0_CHANNEL_IND_ENGINE_GR                                   0x00000001
+#define NVE0_CHANNEL_IND_ENGINE_VP                                   0x00000002
+#define NVE0_CHANNEL_IND_ENGINE_PPP                                  0x00000004
+#define NVE0_CHANNEL_IND_ENGINE_BSP                                  0x00000008
+#define NVE0_CHANNEL_IND_ENGINE_CE0                                  0x00000010
+#define NVE0_CHANNEL_IND_ENGINE_CE1                                  0x00000020
+#define NVE0_CHANNEL_IND_ENGINE_ENC                                  0x00000040
+};
+
 struct nv04_notify {
 	struct nouveau_object *object;
 	uint32_t offset;
diff --git a/nouveau/private.h b/nouveau/private.h
index b409cc8..8a5cb26 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);
 /* abi16.c */
 int  abi16_chan_nv04(struct nouveau_object *);
 int  abi16_chan_nvc0(struct nouveau_object *);
+int  abi16_chan_nve0(struct nouveau_object *);
 int  abi16_engobj(struct nouveau_object *);
 int  abi16_ntfy(struct nouveau_object *);
 void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *);

             reply	other threads:[~2013-01-11 15:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11 15:04 Maarten Lankhorst [this message]
2013-01-14  5:25 ` [PATCH] nouveau: add support for setting engine on nve0 Ben Skeggs
2013-01-14 10:06   ` Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F029E0.5070102@canonical.com \
    --to=maarten.lankhorst@canonical.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.