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
fbdemos: use new way of passing fb

Pass buffer object here instead of raw physical address.
driver: clean up resource creation function
driver: fix cubemaps

Previous tiling changes broke cubemap support. This commit fixes the offsets
and makes the cubemap test work again.
etnaviv: support importing external vidmem nodes

Add support for importing external jgckVIDMEM nodes.
This could be used to experiment with transferring textures between
processes, at least until the new kernel driver.
replay: set hardwareType if needed

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
replay: make use of using2D and using3D

The imx6 kernel 1.1.0 makes use of these vars, so it is a good
idea to set them.

root@linaro-ubuntu-desktop:~/linux-imx6# grep using3D drivers/mxc/gpu-viv/ -R
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c:            if (Context->dirty || commandBufferObject->using3D)
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c:            if (Context->dirty || commandBufferObject->using3D)
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c:            if (commandBufferObject->using3D && Context->dirty3D)
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c:            if (commandBufferObject->using3D && Context->dirty3D)
drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h:    gctBOOL                     using3D;

root@linaro-ubuntu-desktop:~/linux-imx6# grep using2D drivers/mxc/gpu-viv/ -R
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c:        if (commandBufferObject->using2D && Context->dirty2D)
drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_kernel_buffer.h:    gctBOOL                     using2D;
root@linaro-ubuntu-desktop:~/linux-imx6#

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

small fixes for replay
src: raise error if GCABI is not defined

Defaulting to v2 (or any version, at that) is a bad idea.
etnaviv: fix build problem with GCABI=v2

GCABI_CONTEXT_HAS_PHYSICAL was still using the old ctx_info structure
which doesn't exist anymore.
rs: set pipe_offset
rs: update RS_WINDOW_SIZE for two pixel pipes

on a vivante gpu with only one pixel pipe the following gets used:

  0x08010588, /* LOAD_STATE (1) Base: 0x01620 Size: 1 Fixp: 0 */
  0x010001c0, /*   [01620] RS.WINDOW_SIZE := HEIGHT=256,WIDTH=448 */

with two pixel pipes the following gets used:

  0x008001c0, /*   [01620] RS.WINDOW_SIZE := HEIGHT=128,WIDTH=448 */
  0x080205c0, /* LOAD_STATE (1) Base: 0x01700 Size: 2 Fixp: 0 */
  0x00000000, /*   [01700] RS.PIPE[0].OFFSET := X=0,Y=0 */
  0x00800000, /*   [01704] RS.PIPE[1].OFFSET := X=0,Y=128 */
  0x00000000, /* PAD */