diff options
-rw-r--r-- | doc/kernel_interface.md | 47 | ||||
-rw-r--r-- | native/etnaviv/common.xml.h | 6 | ||||
-rw-r--r-- | native/etnaviv/state.xml.h | 6 | ||||
-rw-r--r-- | native/etnaviv/state_2d.xml.h | 6 | ||||
-rw-r--r-- | native/etnaviv/state_3d.xml.h | 11 | ||||
-rw-r--r-- | native/etnaviv/state_hi.xml.h | 6 | ||||
-rw-r--r-- | native/etnaviv/state_vg.xml.h | 6 | ||||
-rw-r--r-- | native/utils/viv_gpu_top.c | 4 | ||||
-rw-r--r-- | native/utils/viv_registers.c | 10 | ||||
-rw-r--r-- | native/utils/viv_watch.c | 9 | ||||
-rw-r--r-- | rnndb/state.xml | 7 | ||||
-rw-r--r-- | rnndb/state_3d.xml | 3 |
12 files changed, 92 insertions, 29 deletions
diff --git a/doc/kernel_interface.md b/doc/kernel_interface.md index 9d56689..e24d151 100644 --- a/doc/kernel_interface.md +++ b/doc/kernel_interface.md @@ -802,4 +802,51 @@ The contents of the `IDLE_STATE`, `AXI_STATUS` and `DMA_ADDRESS` will be printed XXX how to trigger from user space? +State deltas +============= + +The v4 version has abandoned the user-space context approach of the v2 versions, and introduced a +new mechanism with state deltas. The kernel now maintains the current values +of all 3D states for the userspace-driver connection. + +A state delta (`gcsSTATE_DELTA`) structure contains new values for a subset of all GPU state +addresses defined in the kernel context. + +User space has to generate a state delta structure before (XXX or after?) every COMMIT to let the +kernel know of the changes made in the state buffer. + +State deltas have a refcount that tracks the number of contexts that are pending update by the state +delta. + +State deltas are not copied from user space until actually needed (due to a context switch). This +means that it is possible to keep updating the current state delta *until* the kernel increases it's +refcount. + +When the refcount reaches zero they can be freed. This happens from user space as well. + +State delta records form a doubly-linked list. They contains an array of modified states +(`_gcsSTATE_DELTA_RECORD`) in `recordArray` which are (address, mask, data) tuples. The mask is +normally 0xffffffff which means update the whole state, but partial updates are possible as well by +specifying a bitfield. + +The `vertexElementCount` of the state delta specifies how many vertex elements (state 00800) are +used. These need to be handled specifically because they must always all be written, in consecutive +order, up to the number of elements actually used (if they are all written, all vertex elements +would be enabled). + +Fields `mapEntryID`, `mapEntryIDSize` and `mapEntryIndex` are not used from kernel space. + +A context has multiple buffers to prevent (de)allocation overhead; these are stored in a +doubly-linked list and used in round-robin fashion. + +Pseudocode (simplified a lot): + + COMMIT(Ctx, CmdBuf, NewStateDelta) + - If context switch needed (Ctx.id != CurCtx.id) + - Get current context buffer CurBuf for context Ctx + - Merge pending state deltas for context Ctx into CurBuf, and reset pending deltas + - Append NewStateDelta to list of pending deltas of all buffers for context Ctx + - Send commands in CurBuf to GPU + - Send commands in CmdBuf to GPU + diff --git a/native/etnaviv/common.xml.h b/native/etnaviv/common.xml.h index 524f339..abe01e1 100644 --- a/native/etnaviv/common.xml.h +++ b/native/etnaviv/common.xml.h @@ -8,11 +8,11 @@ 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/state.xml ( 18253 bytes, from 2013-09-01 10:53:22) +- /home/orion/projects/etna_viv/rnndb/state.xml ( 18526 bytes, from 2013-09-11 16:52:32) - /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21682 bytes, from 2013-09-10 09:11:57) +- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37) - /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54159 bytes, from 2013-09-11 14:17:21) +- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59) - /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22) Copyright (C) 2013 diff --git a/native/etnaviv/state.xml.h b/native/etnaviv/state.xml.h index a9e5693..915ee82 100644 --- a/native/etnaviv/state.xml.h +++ b/native/etnaviv/state.xml.h @@ -8,11 +8,11 @@ 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/state.xml ( 18253 bytes, from 2013-09-01 10:53:22) +- /home/orion/projects/etna_viv/rnndb/state.xml ( 18526 bytes, from 2013-09-11 16:52:32) - /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21682 bytes, from 2013-09-10 09:11:57) +- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37) - /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54159 bytes, from 2013-09-11 14:17:21) +- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59) - /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22) Copyright (C) 2013 diff --git a/native/etnaviv/state_2d.xml.h b/native/etnaviv/state_2d.xml.h index 9de0637..28d17aa 100644 --- a/native/etnaviv/state_2d.xml.h +++ b/native/etnaviv/state_2d.xml.h @@ -8,11 +8,11 @@ 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/state.xml ( 18253 bytes, from 2013-09-01 10:53:22) +- /home/orion/projects/etna_viv/rnndb/state.xml ( 18526 bytes, from 2013-09-11 16:52:32) - /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21682 bytes, from 2013-09-10 09:11:57) +- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37) - /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54159 bytes, from 2013-09-11 14:17:21) +- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59) - /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22) Copyright (C) 2013 diff --git a/native/etnaviv/state_3d.xml.h b/native/etnaviv/state_3d.xml.h index 42353da..6c605de 100644 --- a/native/etnaviv/state_3d.xml.h +++ b/native/etnaviv/state_3d.xml.h @@ -8,11 +8,11 @@ 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/state.xml ( 18253 bytes, from 2013-09-01 10:53:22) +- /home/orion/projects/etna_viv/rnndb/state.xml ( 18526 bytes, from 2013-09-11 16:52:32) - /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21682 bytes, from 2013-09-10 09:11:57) +- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37) - /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54159 bytes, from 2013-09-11 14:17:21) +- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59) - /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22) Copyright (C) 2013 @@ -858,9 +858,8 @@ Copyright (C) 2013 #define VIVS_TS_MEM_CONFIG_MSAA_FORMAT_R5G6B5 0x00000200 #define VIVS_TS_MEM_CONFIG_MSAA_FORMAT_A8R8G8B8 0x00000300 #define VIVS_TS_MEM_CONFIG_MSAA_FORMAT_X8R8G8B8 0x00000400 -#define VIVS_TS_MEM_CONFIG_HDEPTH__MASK 0x00003000 -#define VIVS_TS_MEM_CONFIG_HDEPTH__SHIFT 12 -#define VIVS_TS_MEM_CONFIG_HDEPTH(x) (((x) << VIVS_TS_MEM_CONFIG_HDEPTH__SHIFT) & VIVS_TS_MEM_CONFIG_HDEPTH__MASK) +#define VIVS_TS_MEM_CONFIG_UNK12 0x00001000 +#define VIVS_TS_MEM_CONFIG_HDEPTH_AUTO_DISABLE 0x00002000 #define VIVS_TS_COLOR_STATUS_BASE 0x00001658 diff --git a/native/etnaviv/state_hi.xml.h b/native/etnaviv/state_hi.xml.h index fd67ff9..863ac0b 100644 --- a/native/etnaviv/state_hi.xml.h +++ b/native/etnaviv/state_hi.xml.h @@ -8,11 +8,11 @@ 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/state.xml ( 18253 bytes, from 2013-09-01 10:53:22) +- /home/orion/projects/etna_viv/rnndb/state.xml ( 18526 bytes, from 2013-09-11 16:52:32) - /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21682 bytes, from 2013-09-10 09:11:57) +- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37) - /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54159 bytes, from 2013-09-11 14:17:21) +- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59) - /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22) Copyright (C) 2013 diff --git a/native/etnaviv/state_vg.xml.h b/native/etnaviv/state_vg.xml.h index e4183dd..9e0965a 100644 --- a/native/etnaviv/state_vg.xml.h +++ b/native/etnaviv/state_vg.xml.h @@ -8,11 +8,11 @@ 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/state.xml ( 18253 bytes, from 2013-09-01 10:53:22) +- /home/orion/projects/etna_viv/rnndb/state.xml ( 18526 bytes, from 2013-09-11 16:52:32) - /home/orion/projects/etna_viv/rnndb/common.xml ( 16543 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21682 bytes, from 2013-09-10 09:11:57) +- /home/orion/projects/etna_viv/rnndb/state_hi.xml ( 21834 bytes, from 2013-09-11 15:58:37) - /home/orion/projects/etna_viv/rnndb/state_2d.xml ( 51058 bytes, from 2013-09-01 10:53:22) -- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54159 bytes, from 2013-09-11 14:17:21) +- /home/orion/projects/etna_viv/rnndb/state_3d.xml ( 54251 bytes, from 2013-09-11 16:55:59) - /home/orion/projects/etna_viv/rnndb/state_vg.xml ( 5942 bytes, from 2013-09-01 10:53:22) Copyright (C) 2013 diff --git a/native/utils/viv_gpu_top.c b/native/utils/viv_gpu_top.c index 97ee3a6..995d170 100644 --- a/native/utils/viv_gpu_top.c +++ b/native/utils/viv_gpu_top.c @@ -252,7 +252,7 @@ int main() if(color) printf("%s", color_reset); printf(" "); - printf("%-30.30s", info->name); + printf("%-30.30s", info->description); printf("\n"); } } else if(mode == MODE_ALL) @@ -272,7 +272,7 @@ int main() if(color) printf("%s", color_reset); printf(" "); - printf("%-30.30s", info->name); + printf("%-30.30s", info->description); printf(" "); c += max_lines; } diff --git a/native/utils/viv_registers.c b/native/utils/viv_registers.c index 2e295e9..afb2d65 100644 --- a/native/utils/viv_registers.c +++ b/native/utils/viv_registers.c @@ -25,6 +25,16 @@ * Important: Needs kernel module compiled with user space register access * (gcdREGISTER_ACCESS_FROM_USER=1) */ +/* + * Warning: this utility can result in crashes inside the kernel such as (on ARM), + * + * Unhandled fault: external abort on non-linefetch (0x1028) at 0xfe641000 + * Internal error: : 1028 [#1] PREEMPT ARM + * + * It looks as if the actually accessible registers differ per SoC. + * When a non-accessible register is loaded, a fault happens. So expect crashes + * when using this utility. + */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> diff --git a/native/utils/viv_watch.c b/native/utils/viv_watch.c index 9a12d39..32516ef 100644 --- a/native/utils/viv_watch.c +++ b/native/utils/viv_watch.c @@ -48,6 +48,7 @@ static const char clear_screen[] = {0x1b, '[', 'H', 0x0}; static const char color_num_zero[] = "\x1b[1;30m"; static const char color_num[] = "\x1b[1;33m"; +static const char color_head[] = "\x1b[1;37;100m"; static const char color_reset[] = "\x1b[0m"; static void write_register(uint32_t address, uint32_t data) @@ -140,15 +141,15 @@ int main() write_register(debug_registers[rid].select_reg, 0 << rdesc->select_shift); } - printf(" "); + printf("%s ", color_head); for(unsigned int rid=0; rid<NUM_MODULES; ++rid) { - printf("%-8s ", debug_registers[rid].module); + printf(" %-2s ", debug_registers[rid].module); } - printf("\n"); + printf("%s\n",color_reset); for(unsigned int sid=0; sid<MAX_COUNT ; ++sid) { - printf("%01x ", sid); + printf("%s%01x%s ", color_head, sid, color_reset); for(unsigned int rid=0; rid<NUM_MODULES; ++rid) { const char *color = ""; diff --git a/rnndb/state.xml b/rnndb/state.xml index be19ec1..45ff248 100644 --- a/rnndb/state.xml +++ b/rnndb/state.xml @@ -302,7 +302,12 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd"> <value value="1" name="OPENVG"/> <value value="2" name="OPENCL"/> </reg32> - <reg32 offset="0x03850" name="CONTEXT_POINTER"/> <!-- DEBUG --> + <reg32 offset="0x03850" name="CONTEXT_POINTER" brief="Context token"> <!-- DEBUG --> + <doc> + The current context pointer is stored here by the v4 kernel driver if debugging is enabled. + Likely this register is not used by the hardware, but only by debugging software. + </doc> + </reg32> <reg32 offset="0x03A00" name="UNK03A00"/> <reg32 offset="0x03C00" name="STALL_TOKEN"> <bitfield high="4" low="0" name="FROM" type="SYNC_RECIPIENT"/> diff --git a/rnndb/state_3d.xml b/rnndb/state_3d.xml index 3a2175c..844f14b 100644 --- a/rnndb/state_3d.xml +++ b/rnndb/state_3d.xml @@ -746,7 +746,8 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd"> <value value="3" name="A8R8G8B8"/> <value value="4" name="X8R8G8B8"/> </bitfield> - <bitfield high="13" low="12" name="HDEPTH"/> <!-- likely has to do with hdepth --> + <bitfield pos="12" name="UNK12"/> <!-- likely has to do with hdepth --> + <bitfield pos="13" name="HDEPTH_AUTO_DISABLE" brief="Auto disable fast clear for hdepth"/> </reg32> <reg32 offset="0x01658" name="COLOR_STATUS_BASE" brief="Color tile status base address" value="0x00000000" type="VIVM"/> <reg32 offset="0x0165C" name="COLOR_SURFACE_BASE" brief="Color surface base address" value="0x00000000" type="VIVM"/> |