From patchwork Fri Jan 11 15:04:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 1966461 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 381A4DF2A2 for ; Fri, 11 Jan 2013 15:04:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F13E54B95D for ; Fri, 11 Jan 2013 07:04:13 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by gabe.freedesktop.org (Postfix) with ESMTP id E10D3E6BD1 for ; Fri, 11 Jan 2013 07:04:02 -0800 (PST) Received: from 5ed48cef.cm-7-5c.dynamic.ziggo.nl ([94.212.140.239] helo=[192.168.1.128]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Ttg9I-0003Bi-QO; Fri, 11 Jan 2013 15:04:00 +0000 Message-ID: <50F029E0.5070102@canonical.com> Date: Fri, 11 Jan 2013 16:04:00 +0100 From: Maarten Lankhorst User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: Ben Skeggs Subject: [PATCH] nouveau: add support for setting engine on nve0 Cc: "dri-devel@lists.freedesktop.org" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org 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 --- 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 *);