From patchwork Wed May 25 22:08:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foss X-Patchwork-Id: 9136277 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 161746075C for ; Wed, 25 May 2016 22:08:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 068BF282EA for ; Wed, 25 May 2016 22:08:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED688282E8; Wed, 25 May 2016 22:08:48 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 718D5282EA for ; Wed, 25 May 2016 22:08:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 978D76E9FD; Wed, 25 May 2016 22:08:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id CE5B66E9FD for ; Wed, 25 May 2016 22:08:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id 8E2F82608E5 References: <25df-57460a80-11-795d2b00@204872346> To: "intel-gfx@lists.freedesktop.org >> Intel Graphics Development" From: Robert Foss X-Forwarded-Message-Id: <25df-57460a80-11-795d2b00@204872346> Message-ID: <57462268.4030102@collabora.com> Date: Wed, 25 May 2016 18:08:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <25df-57460a80-11-795d2b00@204872346> Subject: [Intel-gfx] Fwd: Re: [RFC i-g-t 7/7] lib/stubs: Add stubs for intel_bufmgr. 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Forward to ML. On Wednesday, May 25, 2016 19:18 BST, robert.foss@collabora.com wrote: > From: Robert Foss > > This patch provides stubs for functionality otherwise provided by intel_bufmgr. > > The stubbed functions all fail with a call to igt_require_f(false,""). > Defines and enums have been copied from libdrm_intel. > > Due to the stubbed tests failing with an igt_require_f() call, these stubs are > not well suited for non-tests, since tools/benchmarks/etc 'skipping' > execution is unhelpful. > > Signed-off-by: Robert Foss > --- > lib/Makefile.am | 7 + > lib/stubs/drm/intel_bufmgr.c | 275 +++++++++++++++++++++++++++ > lib/stubs/drm/intel_bufmgr.h | 430 +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 712 insertions(+) > create mode 100644 lib/stubs/drm/intel_bufmgr.c > create mode 100644 lib/stubs/drm/intel_bufmgr.h > And now the final piece... > diff --git a/lib/Makefile.am b/lib/Makefile.am > index d2ae98d..3e12f25 100644 > --- a/lib/Makefile.am > +++ b/lib/Makefile.am > @@ -14,6 +14,13 @@ if HAVE_LIBDRM_VC4 > igt_vc4.h > endif > Not sure how one can do this gradually so here's the overall result... Actually we can do it with a lot less churn props to the following. I should comment on 1/7 though as it's missing some bits. > +if HAVE_LIBDRM_INTEL > +else Just drop the conditional ? The if guard within the source file is enough. > + libintel_tools_la_SOURCES += \ > + stubs/drm/intel_bufmgr.c \ > + stubs/drm/intel_bufmgr.h > +endif > + > AM_CPPFLAGS = -I$(top_srcdir) > AM_CFLAGS = $(CWARNFLAGS) $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(LIBUNWIND_CFLAGS) $(DEBUG_CFLAGS) \ > -DIGT_SRCDIR=\""$(abs_top_srcdir)/tests"\" \ > diff --git a/lib/stubs/drm/intel_bufmgr.c b/lib/stubs/drm/intel_bufmgr.c > new file mode 100644 > index 0000000..eaf1b3e > --- /dev/null > +++ b/lib/stubs/drm/intel_bufmgr.c > @@ -0,0 +1,275 @@ > +#ifndef HAVE_LIBDRM_INTEL > + > +#include > +#include > +#include > +#include > + > +#include "igt_core.h" > +#include "intel_bufmgr.h" > + Not sure if we need all those includes. I'm leaning that at least stdint and stdbool should do. Please double-check. > + > +drm_intel_bufmgr *drm_intel_bufmgr_gem_init(int fd, int batch_size) > +{ > + igt_require_f(false, "Not compiled with libdrm_intel support\n"); Ideally you want something like (you might get away without the "%s") igt_require_f(false, "%s", compiled_without_libdrm_intel_msg); And declare the variable at the top static const char *compiled_without_libdrm_intel_msg = "Not compiled with libdrm_intel support\n"; Otherwise you'll end up with dozens of instances of the exact same string. > +} > + > +#endif//HAVE_LIBDRM_INTEL Space around // > diff --git a/lib/stubs/drm/intel_bufmgr.h b/lib/stubs/drm/intel_bufmgr.h > new file mode 100644 > index 0000000..12bce60 > --- /dev/null > +++ b/lib/stubs/drm/intel_bufmgr.h > @@ -0,0 +1,430 @@ > +#ifndef INTEL_DRM_STUBS_H > +#define INTEL_DRM_STUBS_H > + This file should be an exact copy of the one provided by libdrm_intel. You want to add a README here and/or update the RELEASING document to remind people to check/resync the file before release. Ideally as a follow up commit. -Emil --- a/configure.ac +++ b/configure.ac @@ -155,6 +155,9 @@ PKG_CHECK_MODULES(GLIB, glib-2.0) if test "x$INTEL" = xyes; then PKG_CHECK_MODULES(DRM_INTEL, [libdrm_intel >= 2.4.64]) AC_DEFINE(HAVE_LIBDRM_INTEL, 1, [Have intel support]) +else + DRM_INTEL_CFLAGS=$(top_srcdir)/lib/stubs/drm/ + AC_SUBST([DRM_INTEL_CFLAGS]) fi AM_CONDITIONAL(HAVE_LIBDRM_INTEL, [test "x$INTEL" = xyes])