From patchwork Thu Aug 10 01:32:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9892483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C2EF60350 for ; Thu, 10 Aug 2017 01:32:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17CB528A02 for ; Thu, 10 Aug 2017 01:32:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CB5D28A05; Thu, 10 Aug 2017 01:32:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C018D28A02 for ; Thu, 10 Aug 2017 01:32:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A39B16E535; Thu, 10 Aug 2017 01:32:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A4176E52E for ; Thu, 10 Aug 2017 01:32:35 +0000 (UTC) Received: by mail-pg0-x244.google.com with SMTP id l64so7203964pge.2 for ; Wed, 09 Aug 2017 18:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nFgjiqYCNW0umhMouLU4O60QsJvLUf12fH5ZVZ0Boc4=; b=ypWyTnIDWtUO5QXxzzOAThgl6mkBdOiS0UCSGwPiFjPksHlFonOj9+w9fNpyOyb96F kEk2eR/n9UbeMH1pL/c8Rxry7RbpKXfSz1gIdpVvinjZ459PBL6FW2+w1rez/kAoTpWM 3Bk2eq0rOYnqlRL+ONWclhT5+ThaKFnSd/HSoEwQxq6YaJ1hEVCfXLUquEqQ54QVQZXX 2y4nfrGq55gFV35du3srTEBdZ8N9k09Z00xn5FOtsDoNfVm7RFoDAOUm/gmL/f8kNy8e SS2Vt8CJPQ5SMAgyxzZFZc7jGxprmTTTNUPP5On548qY0y0efaGjJ6CgWtERe+nhtLAZ Chfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nFgjiqYCNW0umhMouLU4O60QsJvLUf12fH5ZVZ0Boc4=; b=WiQ/d9A2BWZ5ROcQ6P1kYbKEJLYNnyfRgWJMclwLrxo5dQP5Cc40qzR7y4wHLLYd3F qv+K5wWr96Q7+Avz4qUVQXjHTc2CL67xtc9GiRVB6v6SXThR24GDb7JWMH7+9vQ7y4za raZbpoj62kANORg60qAMb0lNM77E2KlwFGMkkPeAOPRyDdg3zHpdP53WXFELyOYR7AVG 6/fWXFme8Gj9GRupIwaJGwIsgkNAMV3X+XZHMMR4VqvuyhlQUgT246MV11zA8gvsA4rT e95PDwvIgzAKCVxDFbG2f4T7920cPC5EAT2XGjtb25s29JLvaBGZBXeWF5iNGObCiJLy Kk2A== X-Gm-Message-State: AHYfb5jup3pqYbOXpIZ+XFS8YOgY5DE/yeRoePr1rID6G6hGqSUKdpfy 5DA79xQsFWJTb8cwZHCrrw== X-Received: by 10.98.214.145 with SMTP id a17mr10375836pfl.148.1502328754554; Wed, 09 Aug 2017 18:32:34 -0700 (PDT) Received: from omlet.ak.intel.com ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id t80sm4710656pfk.151.2017.08.09.18.32.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Aug 2017 18:32:33 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: intel-gfx@lists.freedesktop.org Date: Wed, 9 Aug 2017 18:32:24 -0700 Message-Id: <1502328745-10663-3-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf In-Reply-To: <1502328745-10663-1-git-send-email-jason.ekstrand@intel.com> References: <1502304574-12189-1-git-send-email-jason.ekstrand@intel.com> <1502328745-10663-1-git-send-email-jason.ekstrand@intel.com> Cc: Jason Ekstrand Subject: [Intel-gfx] [PATCH 3/4] lib/igt_vgem: Add a syncobj attach helper X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jason Ekstrand --- lib/igt_vgem.c | 25 ++++++++++++++++++++++++- lib/igt_vgem.h | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c index 21cccb3..069c6dd 100644 --- a/lib/igt_vgem.c +++ b/lib/igt_vgem.c @@ -101,8 +101,9 @@ void *vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot) struct local_vgem_fence_attach { uint32_t handle; uint32_t flags; +#define LOCAL_VGEM_FENCE_SYNCOBJ 0x2 uint32_t out_fence; - uint32_t pad; + uint32_t syncobj; }; struct local_vgem_fence_signal { @@ -167,6 +168,28 @@ uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags) return arg.out_fence; } +uint32_t vgem_fence_attach_syncobj(int fd, uint32_t syncobj) +{ + struct local_vgem_fence_attach arg; + struct vgem_bo bo; + + /* Create a dummy BO so the import works */ + bo.width = 1; + bo.height = 1; + bo.bpp = 4; + vgem_create(fd, &bo); + + memset(&arg, 0, sizeof(arg)); + arg.handle = bo.handle; + arg.syncobj = syncobj; + arg.flags = LOCAL_VGEM_FENCE_SYNCOBJ; + igt_assert_eq(__vgem_fence_attach(fd, &arg), 0); + + gem_close(fd, bo.handle); + + return arg.out_fence; +} + static int ioctl_vgem_fence_signal(int fd, struct local_vgem_fence_signal *arg) { int err = 0; diff --git a/lib/igt_vgem.h b/lib/igt_vgem.h index 002ad7f..555674b 100644 --- a/lib/igt_vgem.h +++ b/lib/igt_vgem.h @@ -44,6 +44,7 @@ bool vgem_fence_has_flag(int fd, unsigned flags); uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags); #define VGEM_FENCE_WRITE 0x1 #define WIP_VGEM_FENCE_NOTIMEOUT 0x2 +uint32_t vgem_fence_attach_syncobj(int fd, uint32_t syncobj); int __vgem_fence_signal(int fd, uint32_t fence); void vgem_fence_signal(int fd, uint32_t fence);