driver: check for rebind of already bound shader objects

Skip the dirty bit if re-binding already bound shader object.
utils: include the correct header

Fixes build problem with 'dove' driver.
etnaviv: move fence handling to libetnaviv

This makes fence handles into globally increasing uint32_t's
and thus simplifies the handling in the driver, and makes it possible
to compare fence handles to see what happened before.
The scheme emulates a saner kernel API (closer to adreno drm driver)
driver: get rid of want_fence
driver: use u_minify for mipmap scaling
old demos: don't call etna_vidmem_unlock directly
driver/etnaviv: refactor etna_vidmem into etna_bo

First step towards making the libetnaviv API more like freedreno_drm.
Bo's are not yet fully emulated, but this is a step closer.
etnaviv: viv structure was not zeroed properly

Fixes hang bugs with new fence system.
fb: support YUY2 framebuffers using the FOURCC API

This is a bit of a hack. FOURCC support should be done properly if
more modes are ever added, but it's not worth it for just the one.
Merge pull request #15 from tchebb/yuvfb

fb: support YUY2 framebuffers using the FOURCC API
replay: some build fixes

Minimal fixes to get cube_etna2 and cube_etna2_gc2000 to compile again.
documentation update for RS
driver: get rid of caching of gpu/cpu pointers

No longer cache logical and GPU address for resource levels
but store offsets and query only when needed.
This is the first step toward submitting bo's with relocations
(just search for `etna_bo_gpu_address` to find all places where GPU
addresses are used).
fix compile of empty_screen_gc2000.c

root@linaro-ubuntu-desktop:~/etna_viv/src/replay# make gc2000
gcc -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -DLINUX -pthread  -O2 -g3 -ggdb3 -Wall -Wmissing-prototypes -DGCABI_imx6 -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -I../lib -I../include_imx6 -fPIC -I../minigallium/include -I../minigallium/auxiliary -I.. -fdiagnostics-show-option -Werror=missing-prototypes -Werror=missing-declarations -Werror=implicit-function-declaration -Werror=return-type -I../resources -I../driver -std=gnu99   -c -o cube_etna2_gc2000.o cube_etna2_gc2000.c
gcc -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -DLINUX -pthread  -O2 -g3 -ggdb3 -Wall -Wmissing-prototypes -DGCABI_imx6 -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -I../lib -I../include_imx6 -fPIC -I../minigallium/include -I../minigallium/auxiliary -I.. -fdiagnostics-show-option -Werror=missing-prototypes -Werror=missing-declarations -Werror=implicit-function-declaration -Werror=return-type -I../resources -I../driver -std=gnu99 -o cube_etna2_gc2000 cube_etna2_gc2000.o ../lib/write_bmp.o ../lib/esTransform.o ../lib/etna_bswap.o  -O2 -g3 -ggdb3 -Wall -Wmissing-prototypes -DGCABI_imx6 -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -I../lib -I../include_imx6 -fPIC -I../minigallium/include -I../minigallium/auxiliary -I.. -fdiagnostics-show-option -Werror=missing-prototypes -Werror=missing-declarations -Werror=implicit-function-declaration -Werror=return-type -I../resources -I../driver -lm -L../etnaviv -letnaviv
gcc -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -DLINUX -pthread  -O2 -g3 -ggdb3 -Wall -Wmissing-prototypes -DGCABI_imx6 -D_POSIX_C_SOURCE=200809 -D_GNU_SOURCE -I../lib -I../include_imx6 -fPIC -I../minigallium/include -I../minigallium/auxiliary -I.. -fdiagnostics-show-option -Werror=missing-prototypes -Werror=missing-declarations -Werror=implicit-function-declaration -Werror=return-type -I../resources -I../driver -std=gnu99   -c -o empty_screen_gc2000.o empty_screen_gc2000.c
In file included from ../etnaviv/etna.h:33:0,
                 from empty_screen_gc2000.c:16:
../etnaviv/viv.h:43:6: error: nested redefinition of ‘enum viv_features_word’
../etnaviv/viv.h:43:6: error: redeclaration of ‘enum viv_features_word’
viv_raw.h:35:6: note: originally defined here
../etnaviv/viv.h:45:5: error: redeclaration of enumerator ‘viv_chipFeatures’
viv_raw.h:37:5: note: previous definition of ‘viv_chipFeatures’ was here
../etnaviv/viv.h:46:5: error: redeclaration of enumerator ‘viv_chipMinorFeatures0’
viv_raw.h:38:5: note: previous definition of ‘viv_chipMinorFeatures0’ was here
../etnaviv/viv.h:47:5: error: redeclaration of enumerator ‘viv_chipMinorFeatures1’
viv_raw.h:39:5: note: previous definition of ‘viv_chipMinorFeatures1’ was here
../etnaviv/viv.h:48:5: error: redeclaration of enumerator ‘viv_chipMinorFeatures2’
viv_raw.h:40:5: note: previous definition of ‘viv_chipMinorFeatures2’ was here
../etnaviv/viv.h:49:5: error: redeclaration of enumerator ‘viv_chipMinorFeatures3’
viv_raw.h:41:5: note: previous definition of ‘viv_chipMinorFeatures3’ was here
../etnaviv/viv.h:50:5: error: redeclaration of enumerator ‘VIV_FEATURES_WORD_COUNT’
viv_raw.h:42:5: note: previous definition of ‘VIV_FEATURES_WORD_COUNT’ was here
../etnaviv/viv.h:55:6: error: nested redefinition of ‘enum viv_hw_type’
../etnaviv/viv.h:55:6: error: redeclaration of ‘enum viv_hw_type’
viv_raw.h:46:6: note: originally defined here
../etnaviv/viv.h:57:5: error: redeclaration of enumerator ‘VIV_HW_3D’
viv_raw.h:48:5: note: previous definition of ‘VIV_HW_3D’ was here
../etnaviv/viv.h:58:5: error: redeclaration of enumerator ‘VIV_HW_2D’
viv_raw.h:49:5: note: previous definition of ‘VIV_HW_2D’ was here
../etnaviv/viv.h:59:5: error: redeclaration of enumerator ‘VIV_HW_VG’
viv_raw.h:50:5: note: previous definition of ‘VIV_HW_VG’ was here
../etnaviv/viv.h:61:5: error: redeclaration of enumerator ‘VIV_HW_2D3D’
viv_raw.h:52:5: note: previous definition of ‘VIV_HW_2D3D’ was here
../etnaviv/viv.h:163:8: error: redefinition of ‘struct viv_specs’
viv_raw.h:61:8: note: originally defined here
../etnaviv/viv.h:186:8: error: redefinition of ‘struct viv_conn’
viv_raw.h:78:8: note: originally defined here
../etnaviv/viv.h:215:5: error: conflicting types for ‘viv_open’
viv_raw.h:91:5: note: previous declaration of ‘viv_open’ was here
../etnaviv/viv.h:220:5: error: conflicting types for ‘viv_invoke’
viv_raw.h:96:5: note: previous declaration of ‘viv_invoke’ was here
../etnaviv/viv.h:225:5: error: conflicting types for ‘viv_close’
viv_raw.h:100:5: note: previous declaration of ‘viv_close’ was here
../etnaviv/viv.h:228:5: error: conflicting types for ‘viv_alloc_contiguous’
viv_raw.h:103:5: note: previous declaration of ‘viv_alloc_contiguous’ was here
../etnaviv/viv.h:233:5: error: conflicting types for ‘viv_alloc_linear_vidmem’
viv_raw.h:108:5: note: previous declaration of ‘viv_alloc_linear_vidmem’ was here
In file included from ../etnaviv/etna.h:33:0,
                 from empty_screen_gc2000.c:16:
../etnaviv/viv.h:238:5: error: conflicting types for ‘viv_lock_vidmem’
viv_raw.h:112:5: note: previous declaration of ‘viv_lock_vidmem’ was here
../etnaviv/viv.h:242:5: error: conflicting types for ‘viv_commit’
viv_raw.h:119:5: note: previous declaration of ‘viv_commit’ was here
../etnaviv/viv.h:251:5: error: conflicting types for ‘viv_unlock_vidmem’
viv_raw.h:124:5: note: previous declaration of ‘viv_unlock_vidmem’ was here
../etnaviv/viv.h:255:5: error: conflicting types for ‘viv_free_vidmem’
viv_raw.h:128:5: note: previous declaration of ‘viv_free_vidmem’ was here
../etnaviv/viv.h:263:5: error: conflicting types for ‘viv_map_user_memory’
viv_raw.h:132:5: note: previous declaration of ‘viv_map_user_memory’ was here
../etnaviv/viv.h:267:5: error: conflicting types for ‘viv_unmap_user_memory’
viv_raw.h:136:5: note: previous declaration of ‘viv_unmap_user_memory’ was here
../etnaviv/viv.h:271:5: error: conflicting types for ‘viv_event_commit’
viv_raw.h:140:5: note: previous declaration of ‘viv_event_commit’ was here
../etnaviv/viv.h:277:5: error: conflicting types for ‘viv_user_signal_create’
viv_raw.h:146:5: note: previous declaration of ‘viv_user_signal_create’ was here
../etnaviv/viv.h:281:5: error: conflicting types for ‘viv_user_signal_signal’
viv_raw.h:150:5: note: previous declaration of ‘viv_user_signal_signal’ was here
../etnaviv/viv.h:286:5: error: conflicting types for ‘viv_user_signal_wait’
viv_raw.h:154:5: note: previous declaration of ‘viv_user_signal_wait’ was here
../etnaviv/viv.h:290:5: error: conflicting types for ‘viv_user_signal_destroy’
viv_raw.h:158:5: note: previous declaration of ‘viv_user_signal_destroy’ was here
../etnaviv/viv.h:292:6: error: conflicting types for ‘viv_show_chip_info’
viv_raw.h:164:6: note: previous declaration of ‘viv_show_chip_info’ was here
../etnaviv/viv.h:297:5: error: conflicting types for ‘viv_reset’
viv_raw.h:168:5: note: previous declaration of ‘viv_reset’ was here
empty_screen_gc2000.c: In function ‘main’:
empty_screen_gc2000.c:51:5: warning: passing argument 6 of ‘viv_alloc_linear_vidmem’ from incompatible pointer type [enabled by default]
../etnaviv/viv.h:233:5: note: expected ‘viv_node_t *’ but argument is of type ‘union _gcuVIDMEM_NODE **’
empty_screen_gc2000.c:60:5: warning: passing argument 2 of ‘viv_lock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:238:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:69:5: warning: passing argument 6 of ‘viv_alloc_linear_vidmem’ from incompatible pointer type [enabled by default]
../etnaviv/viv.h:233:5: note: expected ‘viv_node_t *’ but argument is of type ‘union _gcuVIDMEM_NODE **’
empty_screen_gc2000.c:78:5: warning: passing argument 2 of ‘viv_lock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:238:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:87:5: warning: passing argument 6 of ‘viv_alloc_linear_vidmem’ from incompatible pointer type [enabled by default]
../etnaviv/viv.h:233:5: note: expected ‘viv_node_t *’ but argument is of type ‘union _gcuVIDMEM_NODE **’
empty_screen_gc2000.c:96:5: warning: passing argument 2 of ‘viv_lock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:238:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:105:5: warning: passing argument 6 of ‘viv_alloc_linear_vidmem’ from incompatible pointer type [enabled by default]
../etnaviv/viv.h:233:5: note: expected ‘viv_node_t *’ but argument is of type ‘union _gcuVIDMEM_NODE **’
empty_screen_gc2000.c:114:5: warning: passing argument 2 of ‘viv_lock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:238:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:123:5: warning: passing argument 6 of ‘viv_alloc_linear_vidmem’ from incompatible pointer type [enabled by default]
../etnaviv/viv.h:233:5: note: expected ‘viv_node_t *’ but argument is of type ‘union _gcuVIDMEM_NODE **’
empty_screen_gc2000.c:132:5: warning: passing argument 2 of ‘viv_lock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:238:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:188:5: warning: passing argument 3 of ‘viv_commit’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:242:5: note: expected ‘viv_context_t’ but argument is of type ‘gckCONTEXT’
empty_screen_gc2000.c:188:5: error: too few arguments to function ‘viv_commit’
../etnaviv/viv.h:242:5: note: declared here
empty_screen_gc2000.c:206:5: warning: passing argument 3 of ‘viv_commit’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:242:5: note: expected ‘viv_context_t’ but argument is of type ‘gckCONTEXT’
empty_screen_gc2000.c:206:5: error: too few arguments to function ‘viv_commit’
../etnaviv/viv.h:242:5: note: declared here
empty_screen_gc2000.c:224:5: warning: passing argument 1 of ‘viv_event_queue_signal’ from incompatible pointer type [enabled by default]
viv_raw.h:162:5: note: expected ‘struct viv_conn *’ but argument is of type ‘struct viv_conn *’
empty_screen_gc2000.c:239:5: warning: passing argument 6 of ‘viv_alloc_linear_vidmem’ from incompatible pointer type [enabled by default]
../etnaviv/viv.h:233:5: note: expected ‘viv_node_t *’ but argument is of type ‘union _gcuVIDMEM_NODE **’
empty_screen_gc2000.c:248:5: warning: passing argument 2 of ‘viv_lock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:238:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:268:5: warning: passing argument 3 of ‘viv_commit’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:242:5: note: expected ‘viv_context_t’ but argument is of type ‘gckCONTEXT’
empty_screen_gc2000.c:268:5: error: too few arguments to function ‘viv_commit’
../etnaviv/viv.h:242:5: note: declared here
empty_screen_gc2000.c:275:5: warning: passing argument 1 of ‘viv_event_queue_signal’ from incompatible pointer type [enabled by default]
viv_raw.h:162:5: note: expected ‘struct viv_conn *’ but argument is of type ‘struct viv_conn *’
empty_screen_gc2000.c:289:5: warning: passing argument 2 of ‘viv_unlock_vidmem’ makes integer from pointer without a cast [enabled by default]
../etnaviv/viv.h:251:5: note: expected ‘viv_node_t’ but argument is of type ‘gcuVIDMEM_NODE_PTR’
empty_screen_gc2000.c:289:5: error: too few arguments to function ‘viv_unlock_vidmem’
../etnaviv/viv.h:251:5: note: declared here
make: *** [empty_screen_gc2000.o] Error 1
root@linaro-ubuntu-desktop:~/etna_viv/src/replay#

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
fix compile of cube_etna_gc2000.c

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
current gc2000 replay stuff is gc880 specific

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Merge pull request #16 from austriancoder/master

fix make gc2000 in src/replay
etnaviv: fix compile with v2
driver: use etna_bo_from_fbdev to get at framebuffer

etna_screen can now render to any buffer object