Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-18 Thread Christian Gmeiner
Hi Emil,

2015-10-16 1:33 GMT+02:00 Emil Velikov :
> Hi Christian,
>
> Mostly minor suggestions I'm afraid. Things just look too good for
> anything serious.
>

:)

> On 11 October 2015 at 16:09, Christian Gmeiner
>  wrote:
>> This commit adds tegra support, which uses the renderonly driver
>> library.
>>
>> Signed-off-by: Christian Gmeiner 
>> ---
>>  configure.ac   | 19 +++-
>>  src/gallium/Makefile.am|  6 +++
>>  .../auxiliary/target-helpers/inline_drm_helper.h   | 29 
>>  src/gallium/drivers/tegra/Automake.inc | 10 +
>>  src/gallium/drivers/tegra/Makefile.am  |  9 
>>  src/gallium/targets/dri/Makefile.am|  2 +
>>  src/gallium/winsys/tegra/drm/Android.mk| 34 +++
>>  src/gallium/winsys/tegra/drm/Makefile.am   | 33 ++
>>  src/gallium/winsys/tegra/drm/Makefile.sources  |  3 ++
>>  src/gallium/winsys/tegra/drm/tegra_drm_public.h| 31 +
>>  src/gallium/winsys/tegra/drm/tegra_drm_winsys.c| 51 
>> ++
>>  11 files changed, 226 insertions(+), 1 deletion(-)
>>  create mode 100644 src/gallium/drivers/tegra/Automake.inc
>>  create mode 100644 src/gallium/drivers/tegra/Makefile.am
>>  create mode 100644 src/gallium/winsys/tegra/drm/Android.mk
>>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.am
>>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.sources
>>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_public.h
>>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
>>
>> diff --git a/configure.ac b/configure.ac
>> index ea485b1..9fb8244 100644
>> --- a/configure.ac
>> +++ b/configure.ac
> [snip]
>> @@ -2166,6 +2167,12 @@ if test -n "$with_gallium_drivers"; then
>>  HAVE_GALLIUM_LLVMPIPE=yes
>>  fi
>>  ;;
>> +xtegra)
>> +HAVE_GALLIUM_TEGRA=yes
> We need an extra NEED_GALLIUM_NOUVEAU conditional (set to yes here and
> in the xnouveau case).
> One will also need to duplicate (as a temporary workaround) the
> nouveau PKG_CHECK_MODULES here.
>
> Then update the src/gallium/Makefile.am to use it over HAVE_GALLIUM_NOUVEAU
>
> [snip]
>> +dnl We need to validate some needed dependencies for renderonly drivers.
>> +
>> +if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  
>> ; then
>> +AC_ERROR([Building with tegra requires that nouveau])
>> +fi
>> +
>> +
> And then you can drop this hunk.
>

I will give it a try.

>> --- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
>> +++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
>> @@ -59,6 +59,10 @@
>>  #include "vc4/drm/vc4_drm_public.h"
>>  #endif
>>
>> +#if GALLIUM_TEGRA
>> +#include "tegra/drm/tegra_drm_public.h"
>> +#endif
>> +
> FYI, I'm just testing some updates/rewrites of these target-helpers,
> so things might clash in the not so distant future.
>

Yeah I have seen your patch set and I am prepared to rework some parts.

> [snip]
>> --- /dev/null
>> +++ b/src/gallium/drivers/tegra/Automake.inc
>> @@ -0,0 +1,10 @@
>> +if HAVE_GALLIUM_TEGRA
>> +
>> +TARGET_DRIVERS += tegra
>> +TARGET_CPPFLAGS += -DGALLIUM_TEGRA
>> +TARGET_LIB_DEPS += \
>> +   $(top_builddir)/src/gallium/drivers/renderonly/librenderonly.la \
>> +   $(top_builddir)/src/gallium/winsys/tegra/drm/libtegradrm.la \
>> +   $(LIBDRM_LIBS)
> This, perhaps, should be TEGRA_LIBS, yet we're not using anything from
> libdrm_tegra so we should be safe.
>

I think I have tried that but linking fails due duplicate symbols.

> [snip]
>> --- /dev/null
>> +++ b/src/gallium/winsys/tegra/drm/Android.mk
> I think we can drop this file for now. Android + tegra is quite
> incomplete as is.
>

Great.

> [snip]
>> --- /dev/null
>> +++ b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
> [snip]
>> +#include "renderonly/renderonly_screen.h"
>> +#include "../winsys/tegra/drm/tegra_drm_public.h"
>> +#include "../winsys/nouveau/drm/nouveau_drm_public.h"
>> +
> Please rework things to avoid the ../'s
>

Okay.

>> +#include 
> (as mentioned before) Please drop the path from the include.
>
>> +#include 
>> +
> Flip these two and move them to the top ?
>

Sure.

>> +static int tegra_tiling(int fd, uint32_t handle)
>> +{
>> +   struct drm_tegra_gem_set_tiling args;
>> +
>> +   memset(, 0, sizeof(args));
>> +   args.handle = handle;
>> +   args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK;
>> +   args.value = 4;
> Worth adding a note wrt the magic number ?
>

Yes, magic numbers are bad - will fix it.

greets
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-15 Thread Emil Velikov
Hi Christian,

Mostly minor suggestions I'm afraid. Things just look too good for
anything serious.

On 11 October 2015 at 16:09, Christian Gmeiner
 wrote:
> This commit adds tegra support, which uses the renderonly driver
> library.
>
> Signed-off-by: Christian Gmeiner 
> ---
>  configure.ac   | 19 +++-
>  src/gallium/Makefile.am|  6 +++
>  .../auxiliary/target-helpers/inline_drm_helper.h   | 29 
>  src/gallium/drivers/tegra/Automake.inc | 10 +
>  src/gallium/drivers/tegra/Makefile.am  |  9 
>  src/gallium/targets/dri/Makefile.am|  2 +
>  src/gallium/winsys/tegra/drm/Android.mk| 34 +++
>  src/gallium/winsys/tegra/drm/Makefile.am   | 33 ++
>  src/gallium/winsys/tegra/drm/Makefile.sources  |  3 ++
>  src/gallium/winsys/tegra/drm/tegra_drm_public.h| 31 +
>  src/gallium/winsys/tegra/drm/tegra_drm_winsys.c| 51 
> ++
>  11 files changed, 226 insertions(+), 1 deletion(-)
>  create mode 100644 src/gallium/drivers/tegra/Automake.inc
>  create mode 100644 src/gallium/drivers/tegra/Makefile.am
>  create mode 100644 src/gallium/winsys/tegra/drm/Android.mk
>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.am
>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.sources
>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_public.h
>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
>
> diff --git a/configure.ac b/configure.ac
> index ea485b1..9fb8244 100644
> --- a/configure.ac
> +++ b/configure.ac
[snip]
> @@ -2166,6 +2167,12 @@ if test -n "$with_gallium_drivers"; then
>  HAVE_GALLIUM_LLVMPIPE=yes
>  fi
>  ;;
> +xtegra)
> +HAVE_GALLIUM_TEGRA=yes
We need an extra NEED_GALLIUM_NOUVEAU conditional (set to yes here and
in the xnouveau case).
One will also need to duplicate (as a temporary workaround) the
nouveau PKG_CHECK_MODULES here.

Then update the src/gallium/Makefile.am to use it over HAVE_GALLIUM_NOUVEAU

[snip]
> +dnl We need to validate some needed dependencies for renderonly drivers.
> +
> +if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  
> ; then
> +AC_ERROR([Building with tegra requires that nouveau])
> +fi
> +
> +
And then you can drop this hunk.

> --- a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
> +++ b/src/gallium/auxiliary/target-helpers/inline_drm_helper.h
> @@ -59,6 +59,10 @@
>  #include "vc4/drm/vc4_drm_public.h"
>  #endif
>
> +#if GALLIUM_TEGRA
> +#include "tegra/drm/tegra_drm_public.h"
> +#endif
> +
FYI, I'm just testing some updates/rewrites of these target-helpers,
so things might clash in the not so distant future.

[snip]
> --- /dev/null
> +++ b/src/gallium/drivers/tegra/Automake.inc
> @@ -0,0 +1,10 @@
> +if HAVE_GALLIUM_TEGRA
> +
> +TARGET_DRIVERS += tegra
> +TARGET_CPPFLAGS += -DGALLIUM_TEGRA
> +TARGET_LIB_DEPS += \
> +   $(top_builddir)/src/gallium/drivers/renderonly/librenderonly.la \
> +   $(top_builddir)/src/gallium/winsys/tegra/drm/libtegradrm.la \
> +   $(LIBDRM_LIBS)
This, perhaps, should be TEGRA_LIBS, yet we're not using anything from
libdrm_tegra so we should be safe.

[snip]
> --- /dev/null
> +++ b/src/gallium/winsys/tegra/drm/Android.mk
I think we can drop this file for now. Android + tegra is quite
incomplete as is.

[snip]
> --- /dev/null
> +++ b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
[snip]
> +#include "renderonly/renderonly_screen.h"
> +#include "../winsys/tegra/drm/tegra_drm_public.h"
> +#include "../winsys/nouveau/drm/nouveau_drm_public.h"
> +
Please rework things to avoid the ../'s

> +#include 
(as mentioned before) Please drop the path from the include.

> +#include 
> +
Flip these two and move them to the top ?

> +static int tegra_tiling(int fd, uint32_t handle)
> +{
> +   struct drm_tegra_gem_set_tiling args;
> +
> +   memset(, 0, sizeof(args));
> +   args.handle = handle;
> +   args.mode = DRM_TEGRA_GEM_TILING_MODE_BLOCK;
> +   args.value = 4;
Worth adding a note wrt the magic number ?

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-14 Thread Christian Gmeiner
2015-10-14 5:58 GMT+02:00 Michel Dänzer :
> On 13.10.2015 12:44, Alexandre Courbot wrote:
>> On Mon, Oct 12, 2015 at 12:09 AM, Christian Gmeiner
>>  wrote:
>>>
>>> diff --git a/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c 
>>> b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
>>> new file mode 100644
>>> index 000..e172407
>>> --- /dev/null
>>> +++ b/src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
>>> @@ -0,0 +1,51 @@
>>> +/*
>>> + * Copyright © 2014 NVIDIA Corporation
>>> + *
>>> + * 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 "renderonly/renderonly_screen.h"
>>> +#include "../winsys/tegra/drm/tegra_drm_public.h"
>>> +#include "../winsys/nouveau/drm/nouveau_drm_public.h"
>>> +
>>> +#include 
>>
>> I had to change this line to
>>
>> #include 
>>
>> on my system for it to compile (drm's master installs tegra_drm.h in
>> $PREFIX/include/libdrm)
>
> #include 
>
> should work either way.
>

Will give it a try.

thanks
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-14 Thread Christian Gmeiner
2015-10-14 14:51 GMT+02:00 Erik Faye-Lund :
> On Sun, Oct 11, 2015 at 5:09 PM, Christian Gmeiner
>  wrote:
>> @@ -2181,6 +2188,13 @@ if test -n "$with_gallium_drivers"; then
>>  done
>>  fi
>>
>> +dnl We need to validate some needed dependencies for renderonly drivers.
>> +
>> +if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  
>> ; then
>> +AC_ERROR([Building with tegra requires that nouveau])
>
> Requires that nouveau what? :)

Yeah will improve working for V2.

thanks
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-14 Thread Christian Gmeiner
Hi

2015-10-13 5:44 GMT+02:00 Alexandre Courbot :
> On Mon, Oct 12, 2015 at 12:09 AM, Christian Gmeiner
>  wrote:
>> This commit adds tegra support, which uses the renderonly driver
>> library.
>>
>> Signed-off-by: Christian Gmeiner 
>> ---
>>  configure.ac   | 19 +++-
>>  src/gallium/Makefile.am|  6 +++
>>  .../auxiliary/target-helpers/inline_drm_helper.h   | 29 
>>  src/gallium/drivers/tegra/Automake.inc | 10 +
>>  src/gallium/drivers/tegra/Makefile.am  |  9 
>>  src/gallium/targets/dri/Makefile.am|  2 +
>>  src/gallium/winsys/tegra/drm/Android.mk| 34 +++
>>  src/gallium/winsys/tegra/drm/Makefile.am   | 33 ++
>>  src/gallium/winsys/tegra/drm/Makefile.sources  |  3 ++
>>  src/gallium/winsys/tegra/drm/tegra_drm_public.h| 31 +
>>  src/gallium/winsys/tegra/drm/tegra_drm_winsys.c| 51 
>> ++
>>  11 files changed, 226 insertions(+), 1 deletion(-)
>>  create mode 100644 src/gallium/drivers/tegra/Automake.inc
>>  create mode 100644 src/gallium/drivers/tegra/Makefile.am
>>  create mode 100644 src/gallium/winsys/tegra/drm/Android.mk
>>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.am
>>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.sources
>>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_public.h
>>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
>>
>> diff --git a/configure.ac b/configure.ac
>> index ea485b1..9fb8244 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -75,6 +75,7 @@ LIBDRM_INTEL_REQUIRED=2.4.61
>>  LIBDRM_NVVIEUX_REQUIRED=2.4.33
>>  LIBDRM_NOUVEAU_REQUIRED=2.4.62
>>  LIBDRM_FREEDRENO_REQUIRED=2.4.65
>> +LIBDRM_TEGRA_REQUIRED=2.4.58
>>  DRI2PROTO_REQUIRED=2.6
>>  DRI3PROTO_REQUIRED=1.0
>>  PRESENTPROTO_REQUIRED=1.0
>> @@ -864,7 +865,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,vc4"
>> +
>> "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,tegra,vc4"
>>  @<:@default=r300,r600,svga,swrast@:>@])],
>>  [with_gallium_drivers="$withval"],
>>  [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
>> @@ -2166,6 +2167,12 @@ if test -n "$with_gallium_drivers"; then
>>  HAVE_GALLIUM_LLVMPIPE=yes
>>  fi
>>  ;;
>> +xtegra)
>> +HAVE_GALLIUM_TEGRA=yes
>> +PKG_CHECK_MODULES([TEGRA], [libdrm_tegra >= 
>> $LIBDRM_TEGRA_REQUIRED])
>> +gallium_require_drm "tegra"
>> +gallium_require_drm_loader
>> +;;
>>  xvc4)
>>  HAVE_GALLIUM_VC4=yes
>>  gallium_require_drm "vc4"
>> @@ -2181,6 +2188,13 @@ if test -n "$with_gallium_drivers"; then
>>  done
>>  fi
>>
>> +dnl We need to validate some needed dependencies for renderonly drivers.
>> +
>> +if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  
>> ; then
>> +AC_ERROR([Building with tegra requires that nouveau])
>> +fi
>> +
>> +
>>  dnl Set LLVM_LIBS - This is done after the driver configuration so
>>  dnl that drivers can add additional components to LLVM_COMPONENTS.
>>  dnl Previously, gallium drivers were updating LLVM_LIBS directly
>> @@ -2245,6 +2259,7 @@ 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(HAVE_GALLIUM_TEGRA, test "x$HAVE_GALLIUM_TEGRA" = xyes)
>>
>>  AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test 
>> "x$enable_shared_pipe_drivers" = xno)
>>
>> @@ -2364,6 +2379,7 @@ AC_CONFIG_FILES([Makefile
>> src/gallium/drivers/renderonly/Makefile
>> src/gallium/drivers/softpipe/Makefile
>> src/gallium/drivers/svga/Makefile
>> +   src/gallium/drivers/tegra/Makefile
>> src/gallium/drivers/trace/Makefile
>> src/gallium/drivers/vc4/Makefile
>> src/gallium/state_trackers/clover/Makefile
>> @@ -2406,6 +2422,7 @@ AC_CONFIG_FILES([Makefile
>> src/gallium/winsys/sw/wrapper/Makefile
>> src/gallium/winsys/sw/xlib/Makefile
>> src/gallium/winsys/vc4/drm/Makefile
>> +   src/gallium/winsys/tegra/drm/Makefile
>> src/gbm/Makefile
>> src/gbm/main/gbm.pc
>> src/glsl/Makefile
>> diff --git a/src/gallium/Makefile.am 

Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-14 Thread Erik Faye-Lund
On Sun, Oct 11, 2015 at 5:09 PM, Christian Gmeiner
 wrote:
> @@ -2181,6 +2188,13 @@ if test -n "$with_gallium_drivers"; then
>  done
>  fi
>
> +dnl We need to validate some needed dependencies for renderonly drivers.
> +
> +if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  
> ; then
> +AC_ERROR([Building with tegra requires that nouveau])

Requires that nouveau what? :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-13 Thread Alexandre Courbot
On Mon, Oct 12, 2015 at 12:09 AM, Christian Gmeiner
 wrote:
> This commit adds tegra support, which uses the renderonly driver
> library.
>
> Signed-off-by: Christian Gmeiner 
> ---
>  configure.ac   | 19 +++-
>  src/gallium/Makefile.am|  6 +++
>  .../auxiliary/target-helpers/inline_drm_helper.h   | 29 
>  src/gallium/drivers/tegra/Automake.inc | 10 +
>  src/gallium/drivers/tegra/Makefile.am  |  9 
>  src/gallium/targets/dri/Makefile.am|  2 +
>  src/gallium/winsys/tegra/drm/Android.mk| 34 +++
>  src/gallium/winsys/tegra/drm/Makefile.am   | 33 ++
>  src/gallium/winsys/tegra/drm/Makefile.sources  |  3 ++
>  src/gallium/winsys/tegra/drm/tegra_drm_public.h| 31 +
>  src/gallium/winsys/tegra/drm/tegra_drm_winsys.c| 51 
> ++
>  11 files changed, 226 insertions(+), 1 deletion(-)
>  create mode 100644 src/gallium/drivers/tegra/Automake.inc
>  create mode 100644 src/gallium/drivers/tegra/Makefile.am
>  create mode 100644 src/gallium/winsys/tegra/drm/Android.mk
>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.am
>  create mode 100644 src/gallium/winsys/tegra/drm/Makefile.sources
>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_public.h
>  create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_winsys.c
>
> diff --git a/configure.ac b/configure.ac
> index ea485b1..9fb8244 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -75,6 +75,7 @@ LIBDRM_INTEL_REQUIRED=2.4.61
>  LIBDRM_NVVIEUX_REQUIRED=2.4.33
>  LIBDRM_NOUVEAU_REQUIRED=2.4.62
>  LIBDRM_FREEDRENO_REQUIRED=2.4.65
> +LIBDRM_TEGRA_REQUIRED=2.4.58
>  DRI2PROTO_REQUIRED=2.6
>  DRI3PROTO_REQUIRED=1.0
>  PRESENTPROTO_REQUIRED=1.0
> @@ -864,7 +865,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,vc4"
> +"i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,tegra,vc4"
>  @<:@default=r300,r600,svga,swrast@:>@])],
>  [with_gallium_drivers="$withval"],
>  [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
> @@ -2166,6 +2167,12 @@ if test -n "$with_gallium_drivers"; then
>  HAVE_GALLIUM_LLVMPIPE=yes
>  fi
>  ;;
> +xtegra)
> +HAVE_GALLIUM_TEGRA=yes
> +PKG_CHECK_MODULES([TEGRA], [libdrm_tegra >= 
> $LIBDRM_TEGRA_REQUIRED])
> +gallium_require_drm "tegra"
> +gallium_require_drm_loader
> +;;
>  xvc4)
>  HAVE_GALLIUM_VC4=yes
>  gallium_require_drm "vc4"
> @@ -2181,6 +2188,13 @@ if test -n "$with_gallium_drivers"; then
>  done
>  fi
>
> +dnl We need to validate some needed dependencies for renderonly drivers.
> +
> +if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  
> ; then
> +AC_ERROR([Building with tegra requires that nouveau])
> +fi
> +
> +
>  dnl Set LLVM_LIBS - This is done after the driver configuration so
>  dnl that drivers can add additional components to LLVM_COMPONENTS.
>  dnl Previously, gallium drivers were updating LLVM_LIBS directly
> @@ -2245,6 +2259,7 @@ 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(HAVE_GALLIUM_TEGRA, test "x$HAVE_GALLIUM_TEGRA" = xyes)
>
>  AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test 
> "x$enable_shared_pipe_drivers" = xno)
>
> @@ -2364,6 +2379,7 @@ AC_CONFIG_FILES([Makefile
> src/gallium/drivers/renderonly/Makefile
> src/gallium/drivers/softpipe/Makefile
> src/gallium/drivers/svga/Makefile
> +   src/gallium/drivers/tegra/Makefile
> src/gallium/drivers/trace/Makefile
> src/gallium/drivers/vc4/Makefile
> src/gallium/state_trackers/clover/Makefile
> @@ -2406,6 +2422,7 @@ AC_CONFIG_FILES([Makefile
> src/gallium/winsys/sw/wrapper/Makefile
> src/gallium/winsys/sw/xlib/Makefile
> src/gallium/winsys/vc4/drm/Makefile
> +   src/gallium/winsys/tegra/drm/Makefile
> src/gbm/Makefile
> src/gbm/main/gbm.pc
> src/glsl/Makefile
> diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
> index a7c3606..7278300 100644
> --- a/src/gallium/Makefile.am
> +++ b/src/gallium/Makefile.am
> @@ -82,6 +82,12 @@ if HAVE_GALLIUM_VC4
>  SUBDIRS += 

[Mesa-dev] [RFC 2/2] gallium: add tegra support

2015-10-11 Thread Christian Gmeiner
This commit adds tegra support, which uses the renderonly driver
library.

Signed-off-by: Christian Gmeiner 
---
 configure.ac   | 19 +++-
 src/gallium/Makefile.am|  6 +++
 .../auxiliary/target-helpers/inline_drm_helper.h   | 29 
 src/gallium/drivers/tegra/Automake.inc | 10 +
 src/gallium/drivers/tegra/Makefile.am  |  9 
 src/gallium/targets/dri/Makefile.am|  2 +
 src/gallium/winsys/tegra/drm/Android.mk| 34 +++
 src/gallium/winsys/tegra/drm/Makefile.am   | 33 ++
 src/gallium/winsys/tegra/drm/Makefile.sources  |  3 ++
 src/gallium/winsys/tegra/drm/tegra_drm_public.h| 31 +
 src/gallium/winsys/tegra/drm/tegra_drm_winsys.c| 51 ++
 11 files changed, 226 insertions(+), 1 deletion(-)
 create mode 100644 src/gallium/drivers/tegra/Automake.inc
 create mode 100644 src/gallium/drivers/tegra/Makefile.am
 create mode 100644 src/gallium/winsys/tegra/drm/Android.mk
 create mode 100644 src/gallium/winsys/tegra/drm/Makefile.am
 create mode 100644 src/gallium/winsys/tegra/drm/Makefile.sources
 create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_public.h
 create mode 100644 src/gallium/winsys/tegra/drm/tegra_drm_winsys.c

diff --git a/configure.ac b/configure.ac
index ea485b1..9fb8244 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,7 @@ LIBDRM_INTEL_REQUIRED=2.4.61
 LIBDRM_NVVIEUX_REQUIRED=2.4.33
 LIBDRM_NOUVEAU_REQUIRED=2.4.62
 LIBDRM_FREEDRENO_REQUIRED=2.4.65
+LIBDRM_TEGRA_REQUIRED=2.4.58
 DRI2PROTO_REQUIRED=2.6
 DRI3PROTO_REQUIRED=1.0
 PRESENTPROTO_REQUIRED=1.0
@@ -864,7 +865,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,vc4"
+"i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,tegra,vc4"
 @<:@default=r300,r600,svga,swrast@:>@])],
 [with_gallium_drivers="$withval"],
 [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
@@ -2166,6 +2167,12 @@ if test -n "$with_gallium_drivers"; then
 HAVE_GALLIUM_LLVMPIPE=yes
 fi
 ;;
+xtegra)
+HAVE_GALLIUM_TEGRA=yes
+PKG_CHECK_MODULES([TEGRA], [libdrm_tegra >= 
$LIBDRM_TEGRA_REQUIRED])
+gallium_require_drm "tegra"
+gallium_require_drm_loader
+;;
 xvc4)
 HAVE_GALLIUM_VC4=yes
 gallium_require_drm "vc4"
@@ -2181,6 +2188,13 @@ if test -n "$with_gallium_drivers"; then
 done
 fi
 
+dnl We need to validate some needed dependencies for renderonly drivers.
+
+if test "x$HAVE_GALLIUM_NOUVEAU" != xyes -a "x$HAVE_GALLIUM_TEGRA" == xyes  ; 
then
+AC_ERROR([Building with tegra requires that nouveau])
+fi
+
+
 dnl Set LLVM_LIBS - This is done after the driver configuration so
 dnl that drivers can add additional components to LLVM_COMPONENTS.
 dnl Previously, gallium drivers were updating LLVM_LIBS directly
@@ -2245,6 +2259,7 @@ 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(HAVE_GALLIUM_TEGRA, test "x$HAVE_GALLIUM_TEGRA" = xyes)
 
 AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test 
"x$enable_shared_pipe_drivers" = xno)
 
@@ -2364,6 +2379,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/drivers/renderonly/Makefile
src/gallium/drivers/softpipe/Makefile
src/gallium/drivers/svga/Makefile
+   src/gallium/drivers/tegra/Makefile
src/gallium/drivers/trace/Makefile
src/gallium/drivers/vc4/Makefile
src/gallium/state_trackers/clover/Makefile
@@ -2406,6 +2422,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/winsys/sw/wrapper/Makefile
src/gallium/winsys/sw/xlib/Makefile
src/gallium/winsys/vc4/drm/Makefile
+   src/gallium/winsys/tegra/drm/Makefile
src/gbm/Makefile
src/gbm/main/gbm.pc
src/glsl/Makefile
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index a7c3606..7278300 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -82,6 +82,12 @@ if HAVE_GALLIUM_VC4
 SUBDIRS += drivers/vc4 winsys/vc4/drm
 endif
 
+## tegra
+if HAVE_GALLIUM_TEGRA
+SUBDIRS += drivers/tegra winsys/tegra/drm
+SUBDIRS += drivers/renderonly
+endif
+
 ## the sw winsys'
 SUBDIRS += winsys/sw/null
 
diff --git a/src/gallium/auxiliary/target-helpers/inline_drm_helper.h