[igt-dev] [PATCH i-g-t 3/5] lib/panfrost: Add panfrost helpers

Daniel Vetter daniel at ffwll.ch
Thu Apr 25 07:41:13 UTC 2019


On Wed, Apr 24, 2019 at 10:37:58AM -0500, Rob Herring wrote:
> On Wed, Apr 24, 2019 at 10:25 AM Tomeu Vizoso
> <tomeu.vizoso at collabora.com> wrote:
> >
> > I also needed to copy two headers from Mesa so we have the struct
> > definitions involved in a trivial clear job. These headers were
> > unchanged.
> >
> > Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
> > ---
> >  lib/igt_panfrost.c  |  244 +++++++
> >  lib/igt_panfrost.h  |   60 ++
> >  lib/meson.build     |    1 +
> >  lib/panfrost-job.h  | 1516 +++++++++++++++++++++++++++++++++++++++++++
> >  lib/panfrost-misc.h |   47 ++
> >  5 files changed, 1868 insertions(+)
> >  create mode 100644 lib/igt_panfrost.c
> >  create mode 100644 lib/igt_panfrost.h
> >  create mode 100644 lib/panfrost-job.h
> >  create mode 100644 lib/panfrost-misc.h
> >
> > diff --git a/lib/igt_panfrost.c b/lib/igt_panfrost.c
> > new file mode 100644
> > index 000000000000..df7ebc4f7c9b
> > --- /dev/null
> > +++ b/lib/igt_panfrost.c
> > @@ -0,0 +1,244 @@
> > +/*
> > + * Copyright © 2016 Broadcom
> > + * Copyright © 2019 Collabora, Ltd.
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the next
> > + * paragraph) shall be included in all copies or substantial portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> > + * IN THE SOFTWARE.
> > + */
> > +
> > +#include <assert.h>
> > +#include <string.h>
> > +#include <signal.h>
> > +#include <errno.h>
> > +#include <sys/mman.h>
> > +#include <sys/types.h>
> > +#include <sys/stat.h>
> > +#include <sys/ioctl.h>
> > +#include <fcntl.h>
> > +
> > +#include "drmtest.h"
> > +#include "igt_aux.h"
> > +#include "igt_core.h"
> > +#include "igt_panfrost.h"
> > +#include "ioctl_wrappers.h"
> > +#include "intel_reg.h"
> > +#include "intel_chipset.h"
> > +#include "panfrost_drm.h"
> > +#include "panfrost-job.h"
> > +
> > +/**
> > + * SECTION:igt_panfrost
> > + * @short_description: PANFROST support library
> > + * @title: PANFROST
> > + * @include: igt.h
> > + *
> > + * This library provides various auxiliary helper functions for writing PANFROST
> > + * tests.
> > + */
> > +
> > +struct panfrost_bo *
> > +igt_panfrost_gem_new(int fd, size_t size)
> > +{
> 
> For the record, I really hate this pattern of propagating the ioctl
> differences and driver name in the api. It would be nice if the ioctl
> wrappers implemented a common api so at least simple tests like alloc
> and mmap buffers and prime import/export tests work just by
> implementing the wrappers. Otherwise, we're stuck with the 10 out of
> 6000 tests running. Not asking you to do that now though.

Is there really that much common tests for basic gem features that would
benefit from a common dumb gem allocator wrapper?

For kms we obviously need it, but for kms we already have the igt_fb
library (plus the option to fall back to dumb alloc as the least common
option).

But if there's really a good use for this I guess we could make a
simple_gem library happen in igt ... I wouldn't put it terribly high on
the wishlist though.
-Daniel

> However, we have these wrappers, but they aren't used by patch 5.
> 
> Rob
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the igt-dev mailing list