From patchwork Thu Aug 10 23:34:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 9894721 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 7AF4B60348 for ; Thu, 10 Aug 2017 23:35:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DFBF28BA3 for ; Thu, 10 Aug 2017 23:35:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 630FC28BB7; Thu, 10 Aug 2017 23:35:13 +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 23CCF28BA3 for ; Thu, 10 Aug 2017 23:35:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DA496E63B; Thu, 10 Aug 2017 23:35:12 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC2266E638 for ; Thu, 10 Aug 2017 23:35:10 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id h75so1906810pfh.5 for ; Thu, 10 Aug 2017 16:35:10 -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=a/jWILHEcgkQ8AbFXYRpRiTnG9FyEz5UXjgzF9SbRtwYdEn1ORvnBkeerzTJK6oaJb I42yIPaZevqYM1Wm8GtGoEZlzO5RI4ZvKyUBIbEJOEZ/pA4jhPYuQguMVNbWyO/G70BQ z6zvJPaP/W1sn/UKlWHsImpvBZ7o8SyKGqr2fSrV62oOP4a1iqK6df6BsOY3sBJZzk0T BEc015TBAM8cjxA0r+0XK5/cU51833NNTarTQ+oAWjRxB4zMHJOTRdZDuVujJJCuw1Wg Zb4omWSU8l4yld1qmIb2cR/FolYTIF9uNN6EG8Q+aADe/1U0fIJWmHRmZrY3pJbyLUF/ bkig== 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=eZTG/Z84+3P5Z+/F8edp5cako+ygUyv0JGEdp07A4Uy/qMGuWor3cLplGULIAGbYAh IBarxmnbEuMOq7GcYhzII9D1IOaiM3JAdLWfLFQfjUGoEmUFrZEjZxg6vOY6Ywf8xdUK 2lNHtLeMszx0BzkP+7J7N6r9BACzgTz0wcVjjgkv7caYF0K2WCJvpd2K4ryJtAmTGGzP 2LzcKdnCsNuzz5USBczXlQ2ng45+lr4R6hxVHkgjarWx24FTe9jwXG87IXmn7D81Z4ni 7n01im9Qq2jn7zWiGMKO77HW1q+j6VKE/jTRI5hsxQOByZSqGcIFqIuEsEhNSu8vjq1W oWKw== X-Gm-Message-State: AHYfb5isarFEgCHSiSYZvSlGSn08J12Rp+c9d9ca/1ep2hHraHpbb+8T PFO527IDU2Bw5RJHgvqqdQ== X-Received: by 10.98.224.73 with SMTP id f70mr13977359pfh.12.1502408109888; Thu, 10 Aug 2017 16:35:09 -0700 (PDT) Received: from omlet.ak.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by smtp.gmail.com with ESMTPSA id i90sm14409074pfi.106.2017.08.10.16.35.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 Aug 2017 16:35:09 -0700 (PDT) From: Jason Ekstrand X-Google-Original-From: Jason Ekstrand To: intel-gfx@lists.freedesktop.org Date: Thu, 10 Aug 2017 16:34:59 -0700 Message-Id: <1502408100-7660-3-git-send-email-jason.ekstrand@intel.com> X-Mailer: git-send-email 2.5.0.400.gff86faf In-Reply-To: <1502408100-7660-1-git-send-email-jason.ekstrand@intel.com> References: <1502408100-7660-1-git-send-email-jason.ekstrand@intel.com> Cc: Jason Ekstrand Subject: [Intel-gfx] [PATCH i-g-t 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);