forked from glidernet/ogn-rf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debian: Update patch from PR glidernet#22
- Loading branch information
Showing
7 changed files
with
244 additions
and
4 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
debian/patches/0001-Move-sources-files-into-.-src-directory.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 54a07c768693aabde2e9553dfc4f82de038c80e6 Mon Sep 17 00:00:00 2001 | ||
From: "Fabian P. Schmidt" <[email protected]> | ||
Date: Wed, 11 Jan 2017 22:42:37 +0100 | ||
Subject: [PATCH 1/4] Move sources files into ./src/ directory | ||
Subject: [PATCH 1/6] Move sources files into ./src/ directory | ||
|
||
--- | ||
alloc.h | 28 - | ||
|
2 changes: 1 addition & 1 deletion
2
debian/patches/0002-Move-version-string-from-Makefile-to-VERSION.txt.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From a8b74f697b3f601f0b40329c8657c7ee75fa0aed Mon Sep 17 00:00:00 2001 | ||
From: "Fabian P. Schmidt" <[email protected]> | ||
Date: Thu, 9 Feb 2017 23:01:53 +0100 | ||
Subject: [PATCH 2/4] Move version string from Makefile to VERSION.txt | ||
Subject: [PATCH 2/6] Move version string from Makefile to VERSION.txt | ||
|
||
--- | ||
Makefile | 2 +- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 1580e4c916c0b28b5ce9672b0d510f394494f983 Mon Sep 17 00:00:00 2001 | ||
From: "Fabian P. Schmidt" <[email protected]> | ||
Date: Thu, 9 Feb 2017 22:23:07 +0100 | ||
Subject: [PATCH 3/4] Improve Makefile | ||
Subject: [PATCH 3/6] Improve Makefile | ||
|
||
--- | ||
Makefile | 44 +++++++++++++++++++++----------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From e53ef6f963bb2fd32d993a13067122fc8fdc7f15 Mon Sep 17 00:00:00 2001 | ||
From: "Fabian P. Schmidt" <[email protected]> | ||
Date: Sun, 12 Feb 2017 18:03:14 +0100 | ||
Subject: [PATCH 4/4] Makefile: Add all to phony targets | ||
Subject: [PATCH 4/6] Makefile: Add all to phony targets | ||
|
||
--- | ||
Makefile | 2 +- | ||
|
211 changes: 211 additions & 0 deletions
211
debian/patches/0005-Add-missing-file-gpu_fft_base.c.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
From 7836684639a9225ded6abb6215f24888826b46fe Mon Sep 17 00:00:00 2001 | ||
From: "Fabian P. Schmidt" <[email protected]> | ||
Date: Wed, 15 Mar 2017 09:21:36 +0100 | ||
Subject: [PATCH 5/6] Add missing file gpu_fft_base.c | ||
|
||
Source: http://www.aholme.co.uk/GPU_FFT/Main.htm | ||
Fixes #27. | ||
--- | ||
src/gpu_fft_base.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
1 file changed, 190 insertions(+) | ||
create mode 100644 src/gpu_fft_base.c | ||
|
||
diff --git a/src/gpu_fft_base.c b/src/gpu_fft_base.c | ||
new file mode 100644 | ||
index 0000000..76656b8 | ||
--- /dev/null | ||
+++ b/src/gpu_fft_base.c | ||
@@ -0,0 +1,190 @@ | ||
+/* | ||
+BCM2835 "GPU_FFT" release 3.0 | ||
+Copyright (c) 2015, Andrew Holme. | ||
+All rights reserved. | ||
+ | ||
+Redistribution and use in source and binary forms, with or without | ||
+modification, are permitted provided that the following conditions are met: | ||
+ * Redistributions of source code must retain the above copyright | ||
+ notice, this list of conditions and the following disclaimer. | ||
+ * Redistributions in binary form must reproduce the above copyright | ||
+ notice, this list of conditions and the following disclaimer in the | ||
+ documentation and/or other materials provided with the distribution. | ||
+ * Neither the name of the copyright holder nor the | ||
+ names of its contributors may be used to endorse or promote products | ||
+ derived from this software without specific prior written permission. | ||
+ | ||
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY | ||
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
+*/ | ||
+ | ||
+#include <dlfcn.h> | ||
+ | ||
+#include "gpu_fft.h" | ||
+#include "mailbox.h" | ||
+ | ||
+#define BUS_TO_PHYS(x) ((x)&~0xC0000000) | ||
+ | ||
+// V3D spec: http://www.broadcom.com/docs/support/videocore/VideoCoreIV-AG100-R.pdf | ||
+#define V3D_L2CACTL (0xC00020>>2) | ||
+#define V3D_SLCACTL (0xC00024>>2) | ||
+#define V3D_SRQPC (0xC00430>>2) | ||
+#define V3D_SRQUA (0xC00434>>2) | ||
+#define V3D_SRQCS (0xC0043c>>2) | ||
+#define V3D_DBCFG (0xC00e00>>2) | ||
+#define V3D_DBQITE (0xC00e2c>>2) | ||
+#define V3D_DBQITC (0xC00e30>>2) | ||
+ | ||
+// Setting this define to zero on Pi 1 allows GPU_FFT and Open GL | ||
+// to co-exist and also improves performance of longer transforms: | ||
+#define GPU_FFT_USE_VC4_L2_CACHE 1 // Pi 1 only: cached=1; direct=0 | ||
+ | ||
+#define GPU_FFT_NO_FLUSH 1 | ||
+#define GPU_FFT_TIMEOUT 2000 // ms | ||
+ | ||
+struct GPU_FFT_HOST { | ||
+ unsigned mem_flg, mem_map, peri_addr, peri_size; | ||
+}; | ||
+ | ||
+int gpu_fft_get_host_info(struct GPU_FFT_HOST *info) { | ||
+ void *handle; | ||
+ unsigned (*bcm_host_get_sdram_address) (void); | ||
+ unsigned (*bcm_host_get_peripheral_address)(void); | ||
+ unsigned (*bcm_host_get_peripheral_size) (void); | ||
+ | ||
+ // Pi 1 defaults | ||
+ info->peri_addr = 0x20000000; | ||
+ info->peri_size = 0x01000000; | ||
+ info->mem_flg = GPU_FFT_USE_VC4_L2_CACHE? 0xC : 0x4; | ||
+ info->mem_map = GPU_FFT_USE_VC4_L2_CACHE? 0x0 : 0x20000000; // Pi 1 only | ||
+ | ||
+ handle = dlopen("libbcm_host.so", RTLD_LAZY); | ||
+ if (!handle) return -1; | ||
+ | ||
+ *(void **) (&bcm_host_get_sdram_address) = dlsym(handle, "bcm_host_get_sdram_address"); | ||
+ *(void **) (&bcm_host_get_peripheral_address) = dlsym(handle, "bcm_host_get_peripheral_address"); | ||
+ *(void **) (&bcm_host_get_peripheral_size) = dlsym(handle, "bcm_host_get_peripheral_size"); | ||
+ | ||
+ if (bcm_host_get_sdram_address && bcm_host_get_sdram_address()!=0x40000000) { // Pi 2? | ||
+ info->mem_flg = 0x4; // ARM cannot see VC4 L2 on Pi 2 | ||
+ info->mem_map = 0x0; | ||
+ } | ||
+ | ||
+ if (bcm_host_get_peripheral_address) info->peri_addr = bcm_host_get_peripheral_address(); | ||
+ if (bcm_host_get_peripheral_size) info->peri_size = bcm_host_get_peripheral_size(); | ||
+ | ||
+ dlclose(handle); | ||
+ return 0; | ||
+} | ||
+ | ||
+unsigned gpu_fft_base_exec_direct ( | ||
+ struct GPU_FFT_BASE *base, | ||
+ int num_qpus) { | ||
+ | ||
+ unsigned q, t; | ||
+ | ||
+ base->peri[V3D_DBCFG] = 0; // Disallow IRQ | ||
+ base->peri[V3D_DBQITE] = 0; // Disable IRQ | ||
+ base->peri[V3D_DBQITC] = -1; // Resets IRQ flags | ||
+ | ||
+ base->peri[V3D_L2CACTL] = 1<<2; // Clear L2 cache | ||
+ base->peri[V3D_SLCACTL] = -1; // Clear other caches | ||
+ | ||
+ base->peri[V3D_SRQCS] = (1<<7) | (1<<8) | (1<<16); // Reset error bit and counts | ||
+ | ||
+ for (q=0; q<num_qpus; q++) { // Launch shader(s) | ||
+ base->peri[V3D_SRQUA] = base->vc_unifs[q]; | ||
+ base->peri[V3D_SRQPC] = base->vc_code; | ||
+ } | ||
+ | ||
+ // Busy wait polling | ||
+ for (;;) { | ||
+ if (((base->peri[V3D_SRQCS]>>16) & 0xff) == num_qpus) break; // All done? | ||
+ } | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
+unsigned gpu_fft_base_exec( | ||
+ struct GPU_FFT_BASE *base, | ||
+ int num_qpus) { | ||
+ | ||
+ if (base->vc_msg) { | ||
+ // Use mailbox | ||
+ // Returns: 0x0 for success; 0x80000000 for timeout | ||
+ return execute_qpu(base->mb, num_qpus, base->vc_msg, GPU_FFT_NO_FLUSH, GPU_FFT_TIMEOUT); | ||
+ } | ||
+ else { | ||
+ // Direct register poking | ||
+ return gpu_fft_base_exec_direct(base, num_qpus); | ||
+ } | ||
+} | ||
+ | ||
+int gpu_fft_alloc ( | ||
+ int mb, | ||
+ unsigned size, | ||
+ struct GPU_FFT_PTR *ptr) { | ||
+ | ||
+ struct GPU_FFT_HOST host; | ||
+ struct GPU_FFT_BASE *base; | ||
+ volatile unsigned *peri; | ||
+ unsigned handle; | ||
+ | ||
+ if (gpu_fft_get_host_info(&host)) return -5; | ||
+ | ||
+ if (qpu_enable(mb, 1)) return -1; | ||
+ | ||
+ // Shared memory | ||
+ handle = mem_alloc(mb, size, 4096, host.mem_flg); | ||
+ if (!handle) { | ||
+ qpu_enable(mb, 0); | ||
+ return -3; | ||
+ } | ||
+ | ||
+ peri = (volatile unsigned *) mapmem(host.peri_addr, host.peri_size); | ||
+ if (!peri) { | ||
+ mem_free(mb, handle); | ||
+ qpu_enable(mb, 0); | ||
+ return -4; | ||
+ } | ||
+ | ||
+ ptr->vc = mem_lock(mb, handle); | ||
+ ptr->arm.vptr = mapmem(BUS_TO_PHYS(ptr->vc+host.mem_map), size); | ||
+ | ||
+ base = (struct GPU_FFT_BASE *) ptr->arm.vptr; | ||
+ base->peri = peri; | ||
+ base->peri_size = host.peri_size; | ||
+ base->mb = mb; | ||
+ base->handle = handle; | ||
+ base->size = size; | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
+void gpu_fft_base_release(struct GPU_FFT_BASE *base) { | ||
+ int mb = base->mb; | ||
+ unsigned handle = base->handle, size = base->size; | ||
+ unmapmem((void*)base->peri, base->peri_size); | ||
+ unmapmem((void*)base, size); | ||
+ mem_unlock(mb, handle); | ||
+ mem_free(mb, handle); | ||
+ qpu_enable(mb, 0); | ||
+} | ||
+ | ||
+unsigned gpu_fft_ptr_inc ( | ||
+ struct GPU_FFT_PTR *ptr, | ||
+ int bytes) { | ||
+ | ||
+ unsigned vc = ptr->vc; | ||
+ ptr->vc += bytes; | ||
+ ptr->arm.bptr += bytes; | ||
+ return vc; | ||
+} | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From a9ee51404be1547e137b9d0732117a0d71511b18 Mon Sep 17 00:00:00 2001 | ||
From: "Fabian P. Schmidt" <[email protected]> | ||
Date: Wed, 15 Mar 2017 09:52:53 +0100 | ||
Subject: [PATCH 6/6] Makefile: Fix target RPI_GPU | ||
|
||
--- | ||
Makefile | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/Makefile b/Makefile | ||
index 68608f9..1cbcea5 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -15,8 +15,9 @@ FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp | ||
endif | ||
|
||
ifdef USE_RPI_GPU_FFT | ||
+LDLIBS += -ldl | ||
GPU_FLAGS = -DUSE_RPI_GPU_FFT | ||
-GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c | ||
+GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_base.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c | ||
endif | ||
|
||
##### | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters