Am 06.08.2014 22:33, schrieb Eric Anholt: > I'd like to start merging the VC4 driver. I've got a lot of things > working under sim (piglit's at 5212/6726 for a slightly-trimmed > quick.py), and once I find where I put my serial cable I hope to get the > kernel fixed up and passing even more than that on HW. > > I'm at 80 commits right now, with 3 initial huge commits then actual > incremental development. I don't think other people are going to want > to review all of this (45 files changed, 9277 insertions(+), 5 > deletions(-)), so I'm feeling ready to go ahead on my own. What I'll > throw out for (maybe) review, though, is the stuff outside of the > driver: > > diff --git a/configure.ac b/configure.ac > index a3b3abd..9679c4c 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -724,7 +724,7 @@ GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast" > AC_ARG_WITH([gallium-drivers], > [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@], > [comma delimited Gallium drivers list, e.g. > - "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast" > + "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,vc4" > @<:@default=r300,r600,svga,swrast@:>@])], > [with_gallium_drivers="$withval"], > [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"]) > @@ -2003,6 +2003,19 @@ if test -n "$with_gallium_drivers"; then > GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri/kms-swrast" > fi > ;; > + xvc4) > + HAVE_GALLIUM_VC4=yes > + gallium_require_drm_loader > + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS vc4" > + gallium_check_st "vc4/drm" "dri-vc4" "" "" "" > + DRICOMMON_NEED_LIBDRM=yes > + > + case "$host_cpu" in > + i?86 | x86_64 | amd64) > + USE_VC4_SIMULATOR=yes > + ;; > + esac > + ;; > *) > AC_MSG_ERROR([Unknown Gallium driver: $driver]) > ;; > @@ -2064,6 +2077,7 @@ AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test > "x$HAVE_GALLIUM_NOUVEAU" = xyes) > AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = > xyes) > AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes) > AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes) > +AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes) > > AM_CONDITIONAL(NEED_GALLIUM_SOFTPIPE_DRIVER, test "x$HAVE_GALLIUM_SVGA" = > xyes -o \ > "x$HAVE_GALLIUM_SOFTPIPE" > = xyes) > @@ -2129,6 +2143,7 @@ AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test > x$enable_gallium_loader = xyes) > AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = > xyes) > AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes) > AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1) > +AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes) > > AC_SUBST([ELF_LIB]) > > @@ -2201,6 +2216,7 @@ AC_CONFIG_FILES([Makefile > src/gallium/drivers/softpipe/Makefile > src/gallium/drivers/svga/Makefile > src/gallium/drivers/trace/Makefile > + src/gallium/drivers/vc4/Makefile > src/gallium/state_trackers/Makefile > src/gallium/state_trackers/clover/Makefile > src/gallium/state_trackers/dri/Makefile > @@ -2243,6 +2259,7 @@ AC_CONFIG_FILES([Makefile > src/gallium/winsys/sw/wayland/Makefile > src/gallium/winsys/sw/wrapper/Makefile > src/gallium/winsys/sw/xlib/Makefile > + src/gallium/winsys/vc4/drm/Makefile > src/gbm/Makefile > src/gbm/main/gbm.pc > src/glsl/Makefile > diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h > b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h > index 5d02da7..4ef94de 100644 > --- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h > +++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h > @@ -54,6 +54,10 @@ > #include "freedreno/drm/freedreno_drm_public.h" > #endif > > +#if GALLIUM_VC4 > +#include "vc4/drm/vc4_drm_public.h" > +#endif > + > static char* driver_name = NULL; > > /* XXX: We need to teardown the winsys if *screen_create() fails. */ > @@ -286,6 +290,48 @@ pipe_freedreno_create_screen(int fd) > } > #endif > > +#if defined(GALLIUM_VC4) > +#if defined(DRI_TARGET) > + > +const __DRIextension **__driDriverGetExtensions_vc4(void); > + > +PUBLIC const __DRIextension **__driDriverGetExtensions_vc4(void) > +{ > + globalDriverAPI = &galliumdrm_driver_api; > + return galliumdrm_driver_extensions; > +} > + > +#if defined(USE_VC4_SIMULATOR) > +const __DRIextension **__driDriverGetExtensions_i965(void); > + > +/** > + * When building using the simulator (on x86), we advertise ourselves as the > + * i965 driver so that you can just make a directory with a link from > + * i965_dri.so to the built vc4_dri.so, and point LIBGL_DRIVERS_PATH to that > + * on your i965-using host to run the driver under simulation. > + * > + * This is, of course, incompatible with building with the ilo driver, but > you > + * shouldn't be building that anyway. > + */ > +PUBLIC const __DRIextension **__driDriverGetExtensions_i965(void) > +{ > + globalDriverAPI = &galliumdrm_driver_api; > + return galliumdrm_driver_extensions; > +} > +#endif I have no idea how that simulator works, but this looks like a fairly gross hack to me. Couldn't you use something similar to how the software based drivers are loaded or anything like that?
> +#endif > + > +static struct pipe_screen * > +pipe_vc4_create_screen(int fd) > +{ > + struct pipe_screen *screen; > + > + screen = vc4_drm_screen_create(fd); > + return screen ? debug_screen_wrap(screen) : NULL; > +} > +#endif > + > inline struct pipe_screen * > dd_create_screen(int fd) > { > @@ -333,6 +379,16 @@ dd_create_screen(int fd) > return pipe_freedreno_create_screen(fd); > else > #endif > +#if defined(GALLIUM_VC4) > + if (strcmp(driver_name, "vc4") == 0) > + return pipe_vc4_create_screen(fd); > + else > +#if defined(USE_VC4_SIMULATOR) > + if (strcmp(driver_name, "i965") == 0) > + return pipe_vc4_create_screen(fd); > + else > +#endif > +#endif > return NULL; > } > > diff --git a/src/gallium/drivers/Makefile.am b/src/gallium/drivers/Makefile.am > index 3d53cad..bb943a0 100644 > --- a/src/gallium/drivers/Makefile.am > +++ b/src/gallium/drivers/Makefile.am > @@ -90,3 +90,11 @@ if NEED_GALLIUM_LLVMPIPE_DRIVER > SUBDIRS += llvmpipe > > endif > + > +################################################################################ > + > +if HAVE_GALLIUM_VC4 > + > +SUBDIRS += vc4 > + > +endif > diff --git a/src/gallium/targets/dri/Makefile.am > b/src/gallium/targets/dri/Makefile.am > index 6ab15d8..70b19b8 100644 > --- a/src/gallium/targets/dri/Makefile.am > +++ b/src/gallium/targets/dri/Makefile.am > @@ -141,6 +141,18 @@ STATIC_TARGET_LIB_DEPS += \ > > endif > > +if HAVE_GALLIUM_VC4 > +MEGADRIVERS += vc4 > +STATIC_TARGET_CPPFLAGS += -DGALLIUM_VC4 > +STATIC_TARGET_LIB_DEPS += \ > + $(top_builddir)/src/gallium/winsys/vc4/drm/libvc4drm.la \ > + $(top_builddir)/src/gallium/drivers/vc4/libvc4.la > + > +if USE_VC4_SIMULATOR > +STATIC_TARGET_CPPFLAGS += -DUSE_VC4_SIMULATOR > +endif > +endif > + > if HAVE_GALLIUM_SOFTPIPE > MEGADRIVERS += swrast > STATIC_TARGET_CPPFLAGS += -DGALLIUM_SOFTPIPE > diff --git a/src/gallium/winsys/Makefile.am b/src/gallium/winsys/Makefile.am > index 4c01afd..76d95b9 100644 > --- a/src/gallium/winsys/Makefile.am > +++ b/src/gallium/winsys/Makefile.am > @@ -70,4 +70,8 @@ endif > if HAVE_GALLIUM_SVGA > SUBDIRS += svga/drm > endif > + > +if HAVE_GALLIUM_VC4 > +SUBDIRS += vc4/drm > +endif > endif > diff --git a/src/gallium/winsys/vc4/drm/Makefile.am > b/src/gallium/winsys/vc4/drm/Makefile.am > new file mode 100644 > index 0000000..6f8fa7d > --- /dev/null > +++ b/src/gallium/winsys/vc4/drm/Makefile.am > @@ -0,0 +1,31 @@ > +# Copyright © 2014 Intel Corporation Sure about that Copyright Header ? > +# > +# 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 Makefile.sources > +include $(top_srcdir)/src/gallium/Automake.inc > + > +AM_CFLAGS = \ > + -I$(top_srcdir)/src/gallium/drivers \ > + $(GALLIUM_WINSYS_CFLAGS) > + > +noinst_LTLIBRARIES = libvc4drm.la > + > +libvc4drm_la_SOURCES = $(C_SOURCES) > diff --git a/src/gallium/winsys/vc4/drm/Makefile.sources > b/src/gallium/winsys/vc4/drm/Makefile.sources > new file mode 100644 > index 0000000..97cf2ea > --- /dev/null > +++ b/src/gallium/winsys/vc4/drm/Makefile.sources > @@ -0,0 +1,2 @@ > +C_SOURCES := \ > + vc4_drm_winsys.c > diff --git a/src/gallium/winsys/vc4/drm/vc4_drm_public.h > b/src/gallium/winsys/vc4/drm/vc4_drm_public.h > new file mode 100644 > index 0000000..f9d0585 > --- /dev/null > +++ b/src/gallium/winsys/vc4/drm/vc4_drm_public.h > @@ -0,0 +1,31 @@ > +/* > + * Copyright © 2014 Broadcom > + * > + * 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. > + */ > + > +#ifndef __VC4_DRM_PUBLIC_H__ > +#define __VC4_DRM_PUBLIC_H__ > + > +struct pipe_screen; > + > +struct pipe_screen *vc4_drm_screen_create(int drmFD); > + > +#endif /* __VC4_DRM_PUBLIC_H__ */ > diff --git a/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c > b/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c > new file mode 100644 > index 0000000..c5434ad > --- /dev/null > +++ b/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c > @@ -0,0 +1,34 @@ > +/* > + * Copyright © 2014 Broadcom > + * > + * 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 <unistd.h> > + > +#include "vc4_drm_public.h" > + > +#include "vc4/vc4_screen.h" > + > +struct pipe_screen * > +vc4_drm_screen_create(int fd) > +{ > + return vc4_screen_create(dup(fd)); > +} > > Otherwise this looks pretty good to me. Roland _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev