This is terrible you can now have 1500 32x32 bullets flying around you. Must be a very hard game .p.s.: This reminds me: After DSP hell, now I really have to code a bullet hell shoot-em-up. Always wanted to do that
Let's recreate Sega Saturn's Radiant Silvergun on the Pandora!This is terrible you can now have 1500 32x32 bullets flying around you. Must be a very hard game .p.s.: This reminds me: After DSP hell, now I really have to code a bullet hell shoot-em-up. Always wanted to do that
you should see my previous games. That one game (3d wipeout-style racer) ..10% of the users absolutely loved it, 90% struggled with the first level. In my book that's a win, better than 50% liking it "somehow / in a way".This is terrible you can now have 1500 32x32 bullets flying around you. Must be a very hard game .
heh, if you take care of the graphics. I am thinking of sth along the lines of TUMIKI fighters (lots of 'particles').Let's recreate Sega Saturn's Radiant Silvergun on the Pandora!
I can say that the overdraw is the worst bottlenecks I've found on pandora's SGX.I really do not know about GLES on the Pandora, still did not get around to trying it. I also did not find any reliable fill rate and power consumption figures about the SGX530 on the web so I really cannot do any comparisons, yet.
Also great!p.s.: This reminds me: After DSP hell, now I really have to code a bullet hell shoot-em-up. Always wanted to do that
25-Oct-2013
- fixed: DSP build dependencies
- changed: DSP overlays can now be compiled w/o installing DSP/BIOS
- changed: build versioned libc64.so.1
- changed: renamed c64_msg_t to dsp_msg_t
- changed: renamed dsp_shm_init()/exit() to dsp_shm_alloc()/free()
- added: dsp_shm_alloc() memory attributes DSP_CACHE_NONE, DSP_CACHE_R (write-through), DSP_CACHE_RW
- added: dsp_fshm_alloc() and free() (and associated ioctls). Used for L1DSRAM mem. allocation in userspace.
The allocation granularity is 64 bytes (one cacheline).
- added: malloc()/free() style memory allocator for e.g. shared memory. Uses Doug Lea's "dl_malloc".
New API functions: dsp_mspace_create()/malloc()/memalign()/free()/destroy()
- fixed: terminate fastcall-sequence in kmod/dev.c in case client forgot to
- fixed: multiprocess overlay load race condition
- added: dsp_virt_to_phys() and dsp_phys_to_virt() API calls
- added: dsp_cache_wbinvall() API call
- added: DSP ringbuffer for printf(). New DSP syscalls puts()/printf()/vprintf(). New API call dsp_logbuf_print()
- added: new DSP syscalls qdma_init()/wait()/copy1d()/copy2d()
- added: new DSP example components test_logbuf, test_qdma, dsprite
- added: new GPP examples "c64_minimal" and "c64_dsprite"
- added: new "tests/c64_tc.c" testcases:
11: TC_SHM_CACHE_NONE
12: TC_SHM_CACHE_RW
13: TC_SHM_CACHE_R
14: TC_FSHM_ALLOCATOR
15: TC_SHM_MSPACE
16: TC_CTRLC
17: TC_FASTCALL_CTRLC
18: TC_LOGBUF
19: TC_LOGBUF_MANY
20: TC_LOGBUF_SPLITLINE
21: TC_LOGBUF_NO_LF
22: TC_QDMA_COPY1D
23: TC_QDMA_COPY2D
Good, I'll try to roll it out over the weekend (I'm slow, I know..)@notaz: Today's release should be good enough for firmware integration (the incremental update we talked about)
thanks! (and man, you gotta work on your reaction time.. 15 minutes..c'mon.. )Good, I'll try to roll it out over the weekend (I'm slow, I know..)
whoopsie daisy.. fixed it, thanks for noticing!@bsp incorrect link posted on your post ....correct link to download is http://tkscript.de/c..._dist.tar.gz
I don't know, maybe wait for further feedback ? My guts tell me this is good but I have not compared it to GPU/NEON, yet.Maybe time for new video about it ?
NEON vs DSP? Epic fight! Fight of the Pandora Milleniumwhoopsie daisy.. fixed it, thanks for noticing!@bsp incorrect link posted on your post ....correct link to download is http://tkscript.de/c..._dist.tar.gz
I don't know, maybe wait for further feedback ? My guts tell me this is good but I have not compared it to GPU/NEON, yet.Maybe time for new video about it ?
relax, this is not a GPP vs DSP fight, this is about whether it is advantageous, in terms of power efficiency, to use the DSP in addition to the GPP.NEON vs DSP? Epic fight! Fight of the Pandora Millenium
I was just joking... Sorryrelax, this is not a GPP vs DSP fight, this is about whether it is advantageous, in terms of power efficiency, to use the DSP in addition to the GPP.NEON vs DSP? Epic fight! Fight of the Pandora Millenium
ok that makes sense. As you can read in the source comments and the release notes, the cache inv/wb code is borrowed from TI's CMEM kernel module, so I hoped it would just work. Since it did not, the code is not compiled in (#if 0 block). I also was not aware of the VIPT synonym issue.I've been looking at cache clean/invalidate code, and I can tell you why it doesn't work. You first allocate those CMA buffers to kernel virtual address space with dma_alloc_attrs(), and then remap that mapping to userspace (different VA) with remap_pfn_range() in fops__mmap(). Now the program accesses memory through it's user mapping, but you do cache operations on the kernel mapping (different addresses). As Cortex-A8 has VIPT (virtually indexed physically tagged) caches, the caches are associated with virtual address, so your operations had no effect.
I do not know, either. Cache invalidates/writebacks should be harmless resp. just cause unnecessary cache refills which might slow things down a little bit (depending on which memory region is invalidated). Why they would crash is beyond me, and it is hard to debug since the system freezes so there's no way to look at the klog.I'm not sure why you get crashes though, maybe remap_pfn_range() actually removes the kernel mapping and you end up invalidating kernels other data that gets allocated there?
I have not seen any general issue with remapping the address range to userspace. cmem/dspbridge/.. do the same thing, otherwise there would be no way to access the shared memory in userspace.In either case you should only use dma_alloc_attrs() return as a handle for dma_free_attrs() and nothing else.
Unfortunately these kind of Linux kernel functions are not documented and I had to assume that the naming of these functions is in accordance with ARM's terminology where the term "inner cache" refers to L1 and "outer cache" to L2 (see Cortex-A8 TRM).I can also say outer_inv_range() does nothing because it's meant for external L2 controllers (A8 has internal one), so you can remove that code.
If the call is NOP it can be removed, too, of course. Just like outer_inv_range(), it is currently not compiled in, anyway (#if 0 block)DMA_BIDIRECTIONAL is also unimplemented, use dmac_flush_range() for C64_CACHE_AC_WBINV instead.
Yes.Does this mean that the userspace virtual addresses have to be passed to the kernel dmac_*() functions ?
Invalidate without clean will destroy data (C64_CACHE_AC_INV case in your code). Let's say that kernel mapping is freed on remap to userspace, so it's reused by the kernel, and some driver puts some pointers there. It reads these pointers and updates them, but as writeback is default policy, they'll go to L1 or L2 cache line and not go back to memory. Out of the blue your code shows up and invalidates all the range, so data in cache is thrown away. A bit later driver needs to do some work, then ends up fetching old invalid pointers from RAM and crashes.I do not know, either. Cache invalidates/writebacks should be harmless resp. just cause unnecessary cache refills which might slow things down a little bit (depending on which memory region is invalidated). Why they would crash is beyond me, and it is hard to debug since the system freezes so there's no way to look at the klog.I'm not sure why you get crashes though, maybe remap_pfn_range() actually removes the kernel mapping and you end up invalidating kernels other data that gets allocated there?
It turns out in later kernels DMA_ATTR_NO_KERNEL_MAPPING is implemented for some iommu mappings only, whatever that is.However, there's no reason to have a kvirtaddr for the shared memory but as we both have learnt, there's currently no way to avoid the Linux kernel mapping, i.e. not until DMA_ATTR_NO_KERNEL_MAPPING is implemented.
That's not true, reads are cached for both DSP_CACHE_R and DSP_CACHE_RW on user mappings, vm_page_prot defines this. Not changing vm_page_prot give you writeback, pgprot_writethrough gives WT and both of them have the reads cached. Kernel mappings have it uncached, like you say.About the cache functions in general: There currently is no need to use them, anyway.
Since the memory is either uncached (DSP_CACHE_NONE) or write-through (DSP_CACHE_R), applications do not have to writeback caches explicitely.
Reads are always uncached so there's no need to explicitely invalidate caches, either (DSP_CACHE_R was intended to give you write-through, read-cached memory but due to kernel limitations the reads are currently uncached).
Yes because the default is cached+buffered already.A few pages back I also mentioned that DSP_CACHE_RW is currently the same as DSP_CACHE_R since the L_PTE_MT_BUFFERABLE kernel flag does not seem to have any effect.
Like said newer kernels only use the flag in some iommu subsystem, maybe I should try porting it to normal dma_* functions, hmm..I too read a forum comment about ARM Linux having issues with multiple virtual memory mappings for one and the same physical address range (the comment just said that, no further explanations), that's why I tried DMA_ATTR_NO_KERNEL_MAPPING which turned out to be not implemented.
It would definitely be nice if you would backport / implement it, like you said.
Mostly done, still messing with the kernel a bit..As for now - how's the progress on the incremental update ?
I've looked at it and it doesn't look like it can done without some pretty bad hacks, which would likely break things and would be problematic for kernel updates in the future.. I've hacked those kernel mappings to always be writethrough (for testing) and tested with your remap with also writethrough attrs and no changes were noticed and the performance discrepancy in "./c64_tc 13" benchmark was still there.maybe I should try porting it to normal dma_* functions, hmm..
Ok I will give it a try.Yes.Does this mean that the userspace virtual addresses have to be passed to the kernel dmac_*() functions ?
Hmm ok, on second thought that's true. However, any resulting crashes would still be the after effect of a kernel issue since the c64 driver only invalidates its own memory areas, of course.Invalidate without clean will destroy data (C64_CACHE_AC_INV case in your code). Let's say that kernel mapping is freed on remap to userspace, so it's reused by the kernel, and some driver puts some pointers there. It reads these pointers and updates them, but as writeback is default policy, they'll go to L1 or L2 cache line and not go back to memory. Out of the blue your code shows up and invalidates all the range, so data in cache is thrown away. A bit later driver needs to do some work, then ends up fetching old invalid pointers from RAM and crashes.I do not know, either. Cache invalidates/writebacks should be harmless resp. just cause unnecessary cache refills which might slow things down a little bit (depending on which memory region is invalidated). Why they would crash is beyond me, and it is hard to debug since the system freezes so there's no way to look at the klog.
hmm that's a bummer. I was quite surprised to see that the kernel does not implement that feature since to me it seems "the easiest thing" to do -- simply NOT map the memory.It turns out in later kernels DMA_ATTR_NO_KERNEL_MAPPING is implemented for some iommu mappings only, whatever that is.However, there's no reason to have a kvirtaddr for the shared memory but as we both have learnt, there's currently no way to avoid the Linux kernel mapping, i.e. not until DMA_ATTR_NO_KERNEL_MAPPING is implemented.
hmm, I just re-ran the mem benchmarks and yes, I did remember that incorrectly.That's not true, reads are cached for both DSP_CACHE_R and DSP_CACHE_RW on user mappings, vm_page_prot defines this. Not changing vm_page_prot give you writeback, pgprot_writethrough gives WT and both of them have the reads cached. Kernel mappings have it uncached, like you say.Reads are always uncached so there's no need to explicitely invalidate caches, either (DSP_CACHE_R was intended to give you write-through, read-cached memory but due to kernel limitations the reads are currently uncached).
The unfortunate thing about this is that we do not even know whether this will fix e.g. the shared memory read-performance issue, or whether not having that flag would cause random kernel memory to be unmapped (which seems, for aforementioned reasons, unlikely to me).Like said newer kernels only use the flag in some iommu subsystem, maybe I should try porting it to normal dma_* functions, hmm..It would definitely be nice if you would backport / implement it, like you said.
goodie. thanks for all your efforts!Mostly done, still messing with the kernel a bit..As for now - how's the progress on the incremental update ?
Yeah it doesn't look like remap_pfn_range() touches the kernel mapping, so your crashes remain a mystery.Would not this mean that dma_free_attrs() would potentially free random kernel memory if remap_fn_range() actually was buggy and unmapped the kernel memory ? It seems rather unlikely to me since that would quickly result in crashes (?!).
I have a theory about this: pandora's RAM module actually has 2 256M RAM chips on 2 different chip selects. Paged memory most likely ends up on first chip (PA < 0x90000000), and if you look at dmesg, CMA tends to reserve space at the end of physical address space, so ends op on the second chip. For whatever reason second may be slower than the first.However, "copy paged to paged" performs at ~990 MBytes/sec so something "fishy" is going on there -- the shared memory (contiguous mem) reads should not be 3 times slower than this.
yeah it's most likely not it (I edited my previous post at the same time you posted about this).The unfortunate thing about this is that we do not even know whether this will fix e.g. the shared memory read-performance issue, or whether not having that flag would cause random kernel memory to be unmapped (which seems, for aforementioned reasons, unlikely to me).Like said newer kernels only use the flag in some iommu subsystem, maybe I should try porting it to normal dma_* functions, hmm..It would definitely be nice if you would backport / implement it, like you said.