[PATCH 2/2] libdrm: add etnaviv tests

2016-09-06 Thread Christian Gmeiner
Hi Emil,

again thanks for the review.


2016-08-30 15:15 GMT+02:00 Emil Velikov :
> On 30 August 2016 at 10:08, Daniel Vetter  wrote:
>> On Tue, Aug 30, 2016 at 09:14:51AM +0200, Christian Gmeiner wrote:
>>> From: The etnaviv authors 
>>>
>>> This adds the following basic unit tests:
>>>
>>> - etnaviv_2d_test
>>>   Let the 2D core render a defined pattern into a bo
>>>   and store it as bmp.
>>>
>>> - etnaviv_bo_cache_test
>>>   Basic tests to validate the bo-cache behavior.
>>>
>>> - etnaviv_cmd_stream_test
>>>   Tests for the etna_cmd_stream API.
>>
>> igt (now at a new location at
>> https://cgit.freedesktop.org/drm/igt-gpu-tools/) would be a nice place for
>> these I think, if you want to participate there. vc4 has tests in there,
>> and collabora is porting a lot of the kms tests to be generic (so that
>> they can be run on any kms driver). Then you could just run those tests on
>> any driver and have a reasonable assurance you didn't break the world.
>>
> Having things in IGT might be better indeed. For the moment it might
> be better to land this as-is and move things in due time while add new
> tests directly in IGT ?
>
> Other than that - a couple of trivial questions/suggestions. Similar
> to the patch 1/2 ones - can be done as follow-up if needed.
>

Will send a v2 soon.

>>> --- /dev/null
>>> +++ b/tests/etnaviv/cmdstream.xml.h
>
>>> +The rules-ng-ng source files this header was generated from are:
>>> +- /home/orion/projects/etna_viv/rnndb/cmdstream.xml (  12589 bytes, from 
>>> 2013-09-01 10:53:22)
>>> +- /home/orion/projects/etna_viv/rnndb/common.xml(  18379 bytes, from 
>>> 2014-01-27 15:58:05)
> Always wondered about this - can we fix rnn to not print the full path
> but just files or rnndb/filename.xml ?
>
>>> +Copyright (C) 2013
> There is something funny here - currently we're not 2013 and the
> copyright holders are missing. Guess something went bonkers in rnn ?
>

Good catch - fixed in the source repo and will be corrected in v2.

>>> +int main(int argc, char *argv[])
>>> +{
>
>>> +fail:
>>> + if (stream)
>>> + etna_cmd_stream_del(stream);
>>> +
>>> + if (pipe)
>>> + etna_pipe_del(pipe);
>>> +
>>> + if (gpu)
>>> + etna_gpu_del(gpu);
>>> +
>>> + if (dev)
>>> + etna_device_del(dev);
>>> +
>>> + close(fd);
>>> +
> Feel free to ignore: you can use separate labels and drop all the if
> checks. Also s/fail/out/ since this is not an error path.
> Same comment goes the whole patch.
>

Sure why not.

thanks
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner


[PATCH 2/2] libdrm: add etnaviv tests

2016-09-06 Thread Christian Gmeiner
Hi Daniel,


2016-08-30 11:08 GMT+02:00 Daniel Vetter :
> On Tue, Aug 30, 2016 at 09:14:51AM +0200, Christian Gmeiner wrote:
>> From: The etnaviv authors 
>>
>> This adds the following basic unit tests:
>>
>> - etnaviv_2d_test
>>   Let the 2D core render a defined pattern into a bo
>>   and store it as bmp.
>>
>> - etnaviv_bo_cache_test
>>   Basic tests to validate the bo-cache behavior.
>>
>> - etnaviv_cmd_stream_test
>>   Tests for the etna_cmd_stream API.
>
> igt (now at a new location at
> https://cgit.freedesktop.org/drm/igt-gpu-tools/) would be a nice place for
> these I think, if you want to participate there. vc4 has tests in there,
> and collabora is porting a lot of the kms tests to be generic (so that
> they can be run on any kms driver). Then you could just run those tests on
> any driver and have a reasonable assurance you didn't break the world.
>
> But up to you really.

I will have a look at igt and see what can be done for etnaviv but for the
the moment I want to land the libdrm changes.

greets
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner


[PATCH 2/2] libdrm: add etnaviv tests

2016-08-30 Thread Daniel Vetter
On Tue, Aug 30, 2016 at 4:40 PM, Rob Clark  wrote:
> On Tue, Aug 30, 2016 at 5:08 AM, Daniel Vetter  wrote:
>> On Tue, Aug 30, 2016 at 09:14:51AM +0200, Christian Gmeiner wrote:
>>> From: The etnaviv authors 
>>>
>>> This adds the following basic unit tests:
>>>
>>> - etnaviv_2d_test
>>>   Let the 2D core render a defined pattern into a bo
>>>   and store it as bmp.
>>>
>>> - etnaviv_bo_cache_test
>>>   Basic tests to validate the bo-cache behavior.
>>>
>>> - etnaviv_cmd_stream_test
>>>   Tests for the etna_cmd_stream API.
>>
>> igt (now at a new location at
>> https://cgit.freedesktop.org/drm/igt-gpu-tools/) would be a nice place for
>> these I think, if you want to participate there. vc4 has tests in there,
>> and collabora is porting a lot of the kms tests to be generic (so that
>> they can be run on any kms driver). Then you could just run those tests on
>> any driver and have a reasonable assurance you didn't break the world.
>
> well, I guess you wouldn't run these tests on, for example radeon hw ;-)

The generic kms tests in igt should run perfectly fine on radeon. Not
that I've tried yet (I dont have a radeon throw-away box for testing).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH 2/2] libdrm: add etnaviv tests

2016-08-30 Thread Emil Velikov
On 30 August 2016 at 10:08, Daniel Vetter  wrote:
> On Tue, Aug 30, 2016 at 09:14:51AM +0200, Christian Gmeiner wrote:
>> From: The etnaviv authors 
>>
>> This adds the following basic unit tests:
>>
>> - etnaviv_2d_test
>>   Let the 2D core render a defined pattern into a bo
>>   and store it as bmp.
>>
>> - etnaviv_bo_cache_test
>>   Basic tests to validate the bo-cache behavior.
>>
>> - etnaviv_cmd_stream_test
>>   Tests for the etna_cmd_stream API.
>
> igt (now at a new location at
> https://cgit.freedesktop.org/drm/igt-gpu-tools/) would be a nice place for
> these I think, if you want to participate there. vc4 has tests in there,
> and collabora is porting a lot of the kms tests to be generic (so that
> they can be run on any kms driver). Then you could just run those tests on
> any driver and have a reasonable assurance you didn't break the world.
>
Having things in IGT might be better indeed. For the moment it might
be better to land this as-is and move things in due time while add new
tests directly in IGT ?

Other than that - a couple of trivial questions/suggestions. Similar
to the patch 1/2 ones - can be done as follow-up if needed.

>> --- /dev/null
>> +++ b/tests/etnaviv/cmdstream.xml.h

>> +The rules-ng-ng source files this header was generated from are:
>> +- /home/orion/projects/etna_viv/rnndb/cmdstream.xml (  12589 bytes, from 
>> 2013-09-01 10:53:22)
>> +- /home/orion/projects/etna_viv/rnndb/common.xml(  18379 bytes, from 
>> 2014-01-27 15:58:05)
Always wondered about this - can we fix rnn to not print the full path
but just files or rnndb/filename.xml ?

>> +Copyright (C) 2013
There is something funny here - currently we're not 2013 and the
copyright holders are missing. Guess something went bonkers in rnn ?

>> +int main(int argc, char *argv[])
>> +{

>> +fail:
>> + if (stream)
>> + etna_cmd_stream_del(stream);
>> +
>> + if (pipe)
>> + etna_pipe_del(pipe);
>> +
>> + if (gpu)
>> + etna_gpu_del(gpu);
>> +
>> + if (dev)
>> + etna_device_del(dev);
>> +
>> + close(fd);
>> +
Feel free to ignore: you can use separate labels and drop all the if
checks. Also s/fail/out/ since this is not an error path.
Same comment goes the whole patch.

Thanks
Emil


[PATCH 2/2] libdrm: add etnaviv tests

2016-08-30 Thread Daniel Vetter
On Tue, Aug 30, 2016 at 09:14:51AM +0200, Christian Gmeiner wrote:
> From: The etnaviv authors 
> 
> This adds the following basic unit tests:
> 
> - etnaviv_2d_test
>   Let the 2D core render a defined pattern into a bo
>   and store it as bmp.
> 
> - etnaviv_bo_cache_test
>   Basic tests to validate the bo-cache behavior.
> 
> - etnaviv_cmd_stream_test
>   Tests for the etna_cmd_stream API.

igt (now at a new location at
https://cgit.freedesktop.org/drm/igt-gpu-tools/) would be a nice place for
these I think, if you want to participate there. vc4 has tests in there,
and collabora is porting a lot of the kms tests to be generic (so that
they can be run on any kms driver). Then you could just run those tests on
any driver and have a reasonable assurance you didn't break the world.

But up to you really.
-Daniel
> 
> Signed-off-by: Christian Gmeiner 
> Signed-off-by: Lucas Stach 
> ---
>  .gitignore  |3 +
>  configure.ac|1 +
>  tests/Makefile.am   |4 +
>  tests/etnaviv/Makefile.am   |   41 +
>  tests/etnaviv/cmdstream.xml.h   |  218 +
>  tests/etnaviv/etnaviv_2d_test.c |  238 +
>  tests/etnaviv/etnaviv_bo_cache_test.c   |  122 +++
>  tests/etnaviv/etnaviv_cmd_stream_test.c |  123 +++
>  tests/etnaviv/state.xml.h   |  348 
>  tests/etnaviv/state_2d.xml.h| 1473 
> +++
>  tests/etnaviv/write_bmp.c   |  152 
>  tests/etnaviv/write_bmp.h   |   34 +
>  12 files changed, 2757 insertions(+)
>  create mode 100644 tests/etnaviv/Makefile.am
>  create mode 100644 tests/etnaviv/cmdstream.xml.h
>  create mode 100644 tests/etnaviv/etnaviv_2d_test.c
>  create mode 100644 tests/etnaviv/etnaviv_bo_cache_test.c
>  create mode 100644 tests/etnaviv/etnaviv_cmd_stream_test.c
>  create mode 100644 tests/etnaviv/state.xml.h
>  create mode 100644 tests/etnaviv/state_2d.xml.h
>  create mode 100644 tests/etnaviv/write_bmp.c
>  create mode 100644 tests/etnaviv/write_bmp.h
> 
> diff --git a/.gitignore b/.gitignore
> index 3226b3a..d51e619 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -102,4 +102,7 @@ tests/radeon/radeon_ttm
>  tests/exynos/exynos_fimg2d_event
>  tests/exynos/exynos_fimg2d_perf
>  tests/exynos/exynos_fimg2d_test
> +tests/etnaviv/etnaviv_2d_test
> +tests/etnaviv/etnaviv_cmd_stream_test
> +tests/etnaviv/etnaviv_bo_cache_test
>  man/*.3
> diff --git a/configure.ac b/configure.ac
> index 64f3e6c..330358a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -551,6 +551,7 @@ AC_CONFIG_FILES([
>   tests/exynos/Makefile
>   tests/tegra/Makefile
>   tests/nouveau/Makefile
> + tests/etnaviv/Makefile
>   tests/util/Makefile
>   man/Makefile
>   libdrm.pc])
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 58feb12..4a499e4 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -22,6 +22,10 @@ if HAVE_TEGRA
>  SUBDIRS += tegra
>  endif
>  
> +if HAVE_ETNAVIV
> +SUBDIRS += etnaviv
> +endif
> +
>  AM_CFLAGS = \
>   $(WARN_CFLAGS)\
>   -I $(top_srcdir)/include/drm \
> diff --git a/tests/etnaviv/Makefile.am b/tests/etnaviv/Makefile.am
> new file mode 100644
> index 000..0631864
> --- /dev/null
> +++ b/tests/etnaviv/Makefile.am
> @@ -0,0 +1,41 @@
> +AM_CFLAGS = \
> + -I $(top_srcdir)/include/drm \
> + -I $(top_srcdir)/etnaviv \
> + -I $(top_srcdir)
> +
> +if HAVE_INSTALL_TESTS
> +bin_PROGRAMS = \
> + etnaviv_2d_test \
> + etnaviv_cmd_stream_test \
> + etnaviv_bo_cache_test
> +else
> +noinst_PROGRAMS = \
> + etnaviv_2d_test \
> + etnaviv_cmd_stream_test \
> + etnaviv_bo_cache_test
> +endif
> +
> +etnaviv_2d_test_LDADD = \
> + $(top_builddir)/libdrm.la \
> + $(top_builddir)/etnaviv/libdrm_etnaviv.la
> +
> +etnaviv_2d_test_SOURCES = \
> + cmdstream.xml.h \
> + etnaviv_2d_test.c \
> + state.xml.h \
> + state_2d.xml.h \
> + write_bmp.c \
> + write_bmp.h
> +
> +etnaviv_cmd_stream_test_LDADD = \
> + $(top_builddir)/etnaviv/libdrm_etnaviv.la
> +
> +etnaviv_cmd_stream_test_SOURCES = \
> + etnaviv_cmd_stream_test.c
> +
> +etnaviv_bo_cache_test_LDADD = \
> + $(top_builddir)/libdrm.la \
> + $(top_builddir)/etnaviv/libdrm_etnaviv.la
> +
> +etnaviv_bo_cache_test_SOURCES = \
> + etnaviv_bo_cache_test.c
> diff --git a/tests/etnaviv/cmdstream.xml.h b/tests/etnaviv/cmdstream.xml.h
> new file mode 100644
> index 000..844f829
> --- /dev/null
> +++ b/tests/etnaviv/cmdstream.xml.h
> @@ -0,0 +1,218 @@
> +#ifndef CMDSTREAM_XML
> +#define CMDSTREAM_XML
> +
> +/* Autogenerated file, DO NOT EDIT manually!
> +
> +This file was generated by the rules-ng-ng headergen tool in this git 
> repository:
> +http://0x04.net/cgit/index.cgi/rules-ng-ng
> +git clone git://0x04.net/rules-ng-ng
> +
> +The rules-ng-ng source files this header was generated from are:
> +- 

[PATCH 2/2] libdrm: add etnaviv tests

2016-08-30 Thread Rob Clark
On Tue, Aug 30, 2016 at 5:08 AM, Daniel Vetter  wrote:
> On Tue, Aug 30, 2016 at 09:14:51AM +0200, Christian Gmeiner wrote:
>> From: The etnaviv authors 
>>
>> This adds the following basic unit tests:
>>
>> - etnaviv_2d_test
>>   Let the 2D core render a defined pattern into a bo
>>   and store it as bmp.
>>
>> - etnaviv_bo_cache_test
>>   Basic tests to validate the bo-cache behavior.
>>
>> - etnaviv_cmd_stream_test
>>   Tests for the etna_cmd_stream API.
>
> igt (now at a new location at
> https://cgit.freedesktop.org/drm/igt-gpu-tools/) would be a nice place for
> these I think, if you want to participate there. vc4 has tests in there,
> and collabora is porting a lot of the kms tests to be generic (so that
> they can be run on any kms driver). Then you could just run those tests on
> any driver and have a reasonable assurance you didn't break the world.

well, I guess you wouldn't run these tests on, for example radeon hw ;-)

but using common framework isn't a horrible idea..  one of these days
I'd like to move my few msmtest's to igt.. but, $bigger_fires ;-)

BR,
-R

> But up to you really.
> -Daniel
>>
>> Signed-off-by: Christian Gmeiner 
>> Signed-off-by: Lucas Stach 
>> ---
>>  .gitignore  |3 +
>>  configure.ac|1 +
>>  tests/Makefile.am   |4 +
>>  tests/etnaviv/Makefile.am   |   41 +
>>  tests/etnaviv/cmdstream.xml.h   |  218 +
>>  tests/etnaviv/etnaviv_2d_test.c |  238 +
>>  tests/etnaviv/etnaviv_bo_cache_test.c   |  122 +++
>>  tests/etnaviv/etnaviv_cmd_stream_test.c |  123 +++
>>  tests/etnaviv/state.xml.h   |  348 
>>  tests/etnaviv/state_2d.xml.h| 1473 
>> +++
>>  tests/etnaviv/write_bmp.c   |  152 
>>  tests/etnaviv/write_bmp.h   |   34 +
>>  12 files changed, 2757 insertions(+)
>>  create mode 100644 tests/etnaviv/Makefile.am
>>  create mode 100644 tests/etnaviv/cmdstream.xml.h
>>  create mode 100644 tests/etnaviv/etnaviv_2d_test.c
>>  create mode 100644 tests/etnaviv/etnaviv_bo_cache_test.c
>>  create mode 100644 tests/etnaviv/etnaviv_cmd_stream_test.c
>>  create mode 100644 tests/etnaviv/state.xml.h
>>  create mode 100644 tests/etnaviv/state_2d.xml.h
>>  create mode 100644 tests/etnaviv/write_bmp.c
>>  create mode 100644 tests/etnaviv/write_bmp.h
>>
>> diff --git a/.gitignore b/.gitignore
>> index 3226b3a..d51e619 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -102,4 +102,7 @@ tests/radeon/radeon_ttm
>>  tests/exynos/exynos_fimg2d_event
>>  tests/exynos/exynos_fimg2d_perf
>>  tests/exynos/exynos_fimg2d_test
>> +tests/etnaviv/etnaviv_2d_test
>> +tests/etnaviv/etnaviv_cmd_stream_test
>> +tests/etnaviv/etnaviv_bo_cache_test
>>  man/*.3
>> diff --git a/configure.ac b/configure.ac
>> index 64f3e6c..330358a 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -551,6 +551,7 @@ AC_CONFIG_FILES([
>>   tests/exynos/Makefile
>>   tests/tegra/Makefile
>>   tests/nouveau/Makefile
>> + tests/etnaviv/Makefile
>>   tests/util/Makefile
>>   man/Makefile
>>   libdrm.pc])
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index 58feb12..4a499e4 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -22,6 +22,10 @@ if HAVE_TEGRA
>>  SUBDIRS += tegra
>>  endif
>>
>> +if HAVE_ETNAVIV
>> +SUBDIRS += etnaviv
>> +endif
>> +
>>  AM_CFLAGS = \
>>   $(WARN_CFLAGS)\
>>   -I $(top_srcdir)/include/drm \
>> diff --git a/tests/etnaviv/Makefile.am b/tests/etnaviv/Makefile.am
>> new file mode 100644
>> index 000..0631864
>> --- /dev/null
>> +++ b/tests/etnaviv/Makefile.am
>> @@ -0,0 +1,41 @@
>> +AM_CFLAGS = \
>> + -I $(top_srcdir)/include/drm \
>> + -I $(top_srcdir)/etnaviv \
>> + -I $(top_srcdir)
>> +
>> +if HAVE_INSTALL_TESTS
>> +bin_PROGRAMS = \
>> + etnaviv_2d_test \
>> + etnaviv_cmd_stream_test \
>> + etnaviv_bo_cache_test
>> +else
>> +noinst_PROGRAMS = \
>> + etnaviv_2d_test \
>> + etnaviv_cmd_stream_test \
>> + etnaviv_bo_cache_test
>> +endif
>> +
>> +etnaviv_2d_test_LDADD = \
>> + $(top_builddir)/libdrm.la \
>> + $(top_builddir)/etnaviv/libdrm_etnaviv.la
>> +
>> +etnaviv_2d_test_SOURCES = \
>> + cmdstream.xml.h \
>> + etnaviv_2d_test.c \
>> + state.xml.h \
>> + state_2d.xml.h \
>> + write_bmp.c \
>> + write_bmp.h
>> +
>> +etnaviv_cmd_stream_test_LDADD = \
>> + $(top_builddir)/etnaviv/libdrm_etnaviv.la
>> +
>> +etnaviv_cmd_stream_test_SOURCES = \
>> + etnaviv_cmd_stream_test.c
>> +
>> +etnaviv_bo_cache_test_LDADD = \
>> + $(top_builddir)/libdrm.la \
>> + $(top_builddir)/etnaviv/libdrm_etnaviv.la
>> +
>> +etnaviv_bo_cache_test_SOURCES = \
>> + etnaviv_bo_cache_test.c
>> diff --git a/tests/etnaviv/cmdstream.xml.h b/tests/etnaviv/cmdstream.xml.h
>> new file mode 100644
>> index 000..844f829
>> --- /dev/null
>> +++ b/tests/etnaviv/cmdstream.xml.h
>> @@ 

[PATCH 2/2] libdrm: add etnaviv tests

2016-08-30 Thread Christian Gmeiner
From: The etnaviv authors 

This adds the following basic unit tests:

- etnaviv_2d_test
  Let the 2D core render a defined pattern into a bo
  and store it as bmp.

- etnaviv_bo_cache_test
  Basic tests to validate the bo-cache behavior.

- etnaviv_cmd_stream_test
  Tests for the etna_cmd_stream API.

Signed-off-by: Christian Gmeiner 
Signed-off-by: Lucas Stach 
---
 .gitignore  |3 +
 configure.ac|1 +
 tests/Makefile.am   |4 +
 tests/etnaviv/Makefile.am   |   41 +
 tests/etnaviv/cmdstream.xml.h   |  218 +
 tests/etnaviv/etnaviv_2d_test.c |  238 +
 tests/etnaviv/etnaviv_bo_cache_test.c   |  122 +++
 tests/etnaviv/etnaviv_cmd_stream_test.c |  123 +++
 tests/etnaviv/state.xml.h   |  348 
 tests/etnaviv/state_2d.xml.h| 1473 +++
 tests/etnaviv/write_bmp.c   |  152 
 tests/etnaviv/write_bmp.h   |   34 +
 12 files changed, 2757 insertions(+)
 create mode 100644 tests/etnaviv/Makefile.am
 create mode 100644 tests/etnaviv/cmdstream.xml.h
 create mode 100644 tests/etnaviv/etnaviv_2d_test.c
 create mode 100644 tests/etnaviv/etnaviv_bo_cache_test.c
 create mode 100644 tests/etnaviv/etnaviv_cmd_stream_test.c
 create mode 100644 tests/etnaviv/state.xml.h
 create mode 100644 tests/etnaviv/state_2d.xml.h
 create mode 100644 tests/etnaviv/write_bmp.c
 create mode 100644 tests/etnaviv/write_bmp.h

diff --git a/.gitignore b/.gitignore
index 3226b3a..d51e619 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,4 +102,7 @@ tests/radeon/radeon_ttm
 tests/exynos/exynos_fimg2d_event
 tests/exynos/exynos_fimg2d_perf
 tests/exynos/exynos_fimg2d_test
+tests/etnaviv/etnaviv_2d_test
+tests/etnaviv/etnaviv_cmd_stream_test
+tests/etnaviv/etnaviv_bo_cache_test
 man/*.3
diff --git a/configure.ac b/configure.ac
index 64f3e6c..330358a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -551,6 +551,7 @@ AC_CONFIG_FILES([
tests/exynos/Makefile
tests/tegra/Makefile
tests/nouveau/Makefile
+   tests/etnaviv/Makefile
tests/util/Makefile
man/Makefile
libdrm.pc])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 58feb12..4a499e4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,10 @@ if HAVE_TEGRA
 SUBDIRS += tegra
 endif

+if HAVE_ETNAVIV
+SUBDIRS += etnaviv
+endif
+
 AM_CFLAGS = \
$(WARN_CFLAGS)\
-I $(top_srcdir)/include/drm \
diff --git a/tests/etnaviv/Makefile.am b/tests/etnaviv/Makefile.am
new file mode 100644
index 000..0631864
--- /dev/null
+++ b/tests/etnaviv/Makefile.am
@@ -0,0 +1,41 @@
+AM_CFLAGS = \
+   -I $(top_srcdir)/include/drm \
+   -I $(top_srcdir)/etnaviv \
+   -I $(top_srcdir)
+
+if HAVE_INSTALL_TESTS
+bin_PROGRAMS = \
+   etnaviv_2d_test \
+   etnaviv_cmd_stream_test \
+   etnaviv_bo_cache_test
+else
+noinst_PROGRAMS = \
+   etnaviv_2d_test \
+   etnaviv_cmd_stream_test \
+   etnaviv_bo_cache_test
+endif
+
+etnaviv_2d_test_LDADD = \
+   $(top_builddir)/libdrm.la \
+   $(top_builddir)/etnaviv/libdrm_etnaviv.la
+
+etnaviv_2d_test_SOURCES = \
+   cmdstream.xml.h \
+   etnaviv_2d_test.c \
+   state.xml.h \
+   state_2d.xml.h \
+   write_bmp.c \
+   write_bmp.h
+
+etnaviv_cmd_stream_test_LDADD = \
+   $(top_builddir)/etnaviv/libdrm_etnaviv.la
+
+etnaviv_cmd_stream_test_SOURCES = \
+   etnaviv_cmd_stream_test.c
+
+etnaviv_bo_cache_test_LDADD = \
+   $(top_builddir)/libdrm.la \
+   $(top_builddir)/etnaviv/libdrm_etnaviv.la
+
+etnaviv_bo_cache_test_SOURCES = \
+   etnaviv_bo_cache_test.c
diff --git a/tests/etnaviv/cmdstream.xml.h b/tests/etnaviv/cmdstream.xml.h
new file mode 100644
index 000..844f829
--- /dev/null
+++ b/tests/etnaviv/cmdstream.xml.h
@@ -0,0 +1,218 @@
+#ifndef CMDSTREAM_XML
+#define CMDSTREAM_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git 
repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- /home/orion/projects/etna_viv/rnndb/cmdstream.xml (  12589 bytes, from 
2013-09-01 10:53:22)
+- /home/orion/projects/etna_viv/rnndb/common.xml(  18379 bytes, from 
2014-01-27 15:58:05)
+
+Copyright (C) 2013
+*/
+
+
+#define FE_OPCODE_LOAD_STATE   0x0001
+#define FE_OPCODE_END  0x0002
+#define FE_OPCODE_NOP  0x0003
+#define FE_OPCODE_DRAW_2D  0x0004
+#define FE_OPCODE_DRAW_PRIMITIVES  0x0005
+#define FE_OPCODE_DRAW_INDEXED_PRIMITIVES  0x0006
+#define FE_OPCODE_WAIT