Commit Graph

145 Commits

Author SHA1 Message Date
Sylvain Munaut 7944d0d976 fosphor/cl_compat: Fix goofs with calling convention
Doesn't matter on linux/osx because CL_API is nothing, but on Win32, it
changes things.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:22 +01:00
Sylvain Munaut f33ebdd28b fosphor/gl_cmap_gen: Add new function to generate GL colormap from a PNG
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:22 +01:00
Sylvain Munaut 1780d4b43b fosphor/gl_cmap: Add a return value and void* arg to the generate func
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:22 +01:00
Sylvain Munaut 773442b170 fosphor: Fix typo in headers MAXOSX vs MACOSX
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:22 +01:00
Sylvain Munaut 38c79bca9c fosphor/gl: Don't require a glFinish()
Since we always call swap buffer between a call to draw and
the next call to process(), we don't need it. In the future,
make this an option in case there is some usecase that require
it.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:22 +01:00
Sylvain Munaut 985c78ffa7 fosphor/cl: Handle invalid (infinite/nan) data better so it recovers
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-20 21:54:52 +01:00
Sylvain Munaut 1603497411 fosphor/gl: Use the right cmap when drawing the histogram intensity scale
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-20 21:54:52 +01:00
Sylvain Munaut 7e195eea1b fosphor/cl: Allow to use APIs deprecated in 2.0 without warnings
This app is CL 1.1 compatible and so we're forced to use some API
that were deprecated in 2.0, no need to be constantly reminded of
it

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-20 21:54:52 +01:00
Sylvain Munaut 8c9d6a2152 gr-fosphor: Disable the color scale for the main view when zoomed
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 14:16:25 +01:00
Sylvain Munaut 11f27973a9 fosphor: Add a color intensity scale on the right side
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 14:16:25 +01:00
Sylvain Munaut 720e702ee9 fosphor/shaders: Use GLSL 1.3 instead of "1.5 compatibility"
I originally used 1.5 compatibility because it still allows immediate
mode / fixed pipeline without warning. But Intel Cards on linux and
OSX in general don't implement it.

Using 1.3 works fine since I don't need anything more recent, but
if you display the compilation results, it will for a deprecation
warning.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 14:16:25 +01:00
Sylvain Munaut 95bb75593a fosphor/gl_font: Make sure to set GL_TEXTURE_ENV_MODE properly
GL_MODULATE is required and since it might be used in other mode for
other function, we need to set it explicitely.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 14:16:25 +01:00
Sylvain Munaut 6da6cfe262 fosphor/gl: Allow fallback to GL_LUMINANCE32F_ARB internal format
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 14:16:25 +01:00
Sylvain Munaut 64cf8a305b fosphor/gl: Use glTexSubImage2D for texture update
Much faster than glTexImage2D since it only updates the data
and doesn't delete/create a new storage space for the data.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 14:16:25 +01:00
Sylvain Munaut 1169b7efec fosphor/cl: Fix warning due to unused var
This should have been removed with a previous commit ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-19 00:23:58 +01:00
Sylvain Munaut 5510404207 fosphor/cl: Balance the score of local_mem size a bit more
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-18 23:35:51 +01:00
Sylvain Munaut 95f603cc51 fosphor/cl: Fix overflow when querying local_mem size
CL_DEVICE_LOCAL_MEM_SIZE is an unsigned long and can be quite large.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-18 23:35:51 +01:00
Sylvain Munaut b1ec76c2f4 fosphor/cl_compat: Blacklist POCL
POCL pretends to be OpenCL 1.2 but it doesn't implement some of the
required functions yet ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-18 23:35:51 +01:00
Sylvain Munaut f2ed7b07a3 fosphor: Acquire the GL objects before cleaning buffers in cl_finish
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-01-18 23:35:51 +01:00
Sylvain Munaut 36ce5e7843 gr-fosphor/qt: Explicitely set a size policy on the QGLSurface
Without it, some layout don't work and the widget ends up being zero sized

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-11-23 15:34:12 +01:00
Sylvain Munaut f16d0ffafb fosphor/cl: Make sure that all init is done before first render
If no data was processed, finished would return 0 and then the gl_refresh
would not be called which would lead to the GL deferred init to not be
executed which can crash the OpenGL driver.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-09-25 23:46:25 +02:00
Sylvain Munaut e2ce8e9a5c gr-fosphor: Prevent multiple thread from initializing fosphor in parallell
Although in theory there is nothing wrong with this and fosphor itself
should support it. However it seems some OpenCL implementation don't
really like having multiple context created in parallell, so we prevent
this manually here.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-08-25 21:20:32 +02:00
Sylvain Munaut af2c08b571 fosphor/cl: Add missing stdlib.h include to cl_compat.c
Thanks to roox in IRC for pointing this out

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-08-25 21:20:31 +02:00
Sylvain Munaut dc1104a523 fosphor/cl: Properly set the 'err' variable when cl_load_program fails
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-08-25 21:20:31 +02:00
Sylvain Munaut 9aea19ae1b fosphor: Allow operation without CL/GL sharing extension
The basic idea is that we just create normal CL buffers, then whenever
we need to draw, we wait for CL completion, read the buffers into the
main memory and upload them as textures using plain GL.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:07 +02:00
Sylvain Munaut 566820e8b9 fosphor/cl: Pre-clears the various buffers before use
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut b717480e6e fosphor/cl: Track the current CL state to avoid doing useless stuff
When calling the process method several time without drawing, we don't
need to release the GL objects or even calling clFinish. So here we
internally keep track and only do the 'finishing up' of the CL process
when doing a drawing call.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut 35ec2209e4 fosphor/cl: Separate the buffer creation into separate helper
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut b94ca23981 fosphor/gl: Minor comment typo fix
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut 7e7387978c fosphor/cl: Add compatibility wrappers for more CL 1.2 functions
In particular clCreateImage, clEnqueueFillBuffer and clEnqueueFillImage

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut be1defecc4 gr-fosphor: Adapt the build to cope with the new CL compat system
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut 9433e60478 fosphor/cl: Handle CL 1.1 vs 1.2 differently
The OpenCL 1.2 is nicer but we can't always use it and on linux,
even if the CL_VERSION_1_2 exists, we can't trust it because distrib
sometimes have CL 1.2 headers with a CL 1.1 dispatcher.

So instead, we only assume we have 1.1 header and lib at compile time.
Then at run-time we do a dynamic lookup of the 1.2 symbols from the lib.
We also check if the actual selected platform does support 1.2 (you
could have a 1.2 dispatcher with a 1.1 platform implementation).

If both conditions are satisfied, then we dispatch the call to the 1.2
implementation and if not, then we dispatch them to a local fallback
implementation of the functions (but limited to the functions we need)

It's not pretty but it should work and it isolates all the hack magic
inside cl_compat.{c,h} and you just use the CL1.2 API normally outside
of it.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut cc9f988a20 fosphor/cl: Increase the length of the 'vendor' field
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut 4cc7461c09 fosphor/cl: Use the _WIN32 conditional instead of __WIN32__
cl_platform.h will convert any sign of windows to this symbol and this
is also the one use for the include at the top, so use it everywhere.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut 02e0db8fdb fosphor/main: Fix the render option initialization sequence
Since the width/height will be set as part of the initial reshape
callback and this is done in glfw_init, we need to make sure we
do the first init of the render option _before_ that, or we'll
undo what glfw_init did.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:06 +02:00
Sylvain Munaut 65a19326d4 fosphor: Minor doc fix in fosphor.h
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:05 +02:00
Sylvain Munaut 5ca19a2667 gr-fosphor: Update year in copyright notice
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:05 +02:00
Sylvain Munaut 0af84185f5 fosphor: Update year in copyright notice
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-24 22:34:05 +02:00
Sylvain Munaut b24ba23784 fosphor: Fix layout routing to avoid half pixel offset
'over' variable needs to be an integer or we'll end up shifting stuff
by half a pixel which causes weird render, especially for fonts.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:40 +02:00
Sylvain Munaut 5d9665c000 fosphor/gl_cmap_gen: Introduce a helper to set RGBA values from float R,G,B
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:40 +02:00
Sylvain Munaut 4c08178d89 fosphor/cl: Fix wrong length param when fetching CL_PROGRAM_BINARIES
This would cause a crash when using AMD's CPU OpenCL implementation

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:40 +02:00
Sylvain Munaut 4254a3a714 gr-fosphor: Export method to retrieve the underying QWidget
This is to allow usage in pure c++ flow graph

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:40 +02:00
Sylvain Munaut 2140ef7bb1 gr-fosphor: Add 'SPACE' as a 'freeze' control to pause the processing
In background samples are just discarded.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 2fa5b6cf67 fosphor/gl: Fix the frequency axis when freq_{start,stop} are used
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 223968ad8e fosphor: Automatically select the number of division depending on width
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut aa5b1de867 fosphor/gl_font: Add a method to compute the total width of a given string
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 36cc3e2341 fosphor/axis: Allow variable number of divisions
Need to have an _even_ number of divisions though !

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut a176de27b8 fosphor/axis: Fix scaling of largest frequency
The largest frequency can be negative, make sure to account for this !

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 351af1f7e5 gr-fosphor: Update to fosphor new 'render options' model and add zoom
Note that the d_zoom_* vars are kept as double to avoid error build-up
when changing them a lot from the UI.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut affd1a3eb7 fosphor: Update the test software to showcase the new display functions
Note that the zoom_* vars are kept as double to avoid error build-up
when changing them a lot from the UI.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 4a97b3e5d0 fosphor: Add the concept of "channels" which are overlaid on the display
These are purely display things that allow to highligh chunks of spectrum
of interest. (like currently selected channel)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 88227fea7f fosphor/cl: Properly release the FFT window memory buffer
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:39 +02:00
Sylvain Munaut 8fb8606c38 fosphor: Drawing code overhaul + Introduce 'render options'
There is a lot of parameters that have no influence on the internal
computations but solely affect the rendering call. The height / width
are the only two that were supported previously.

This commit re-structures the drawing code and introduces a lot more
of those parameters. Instead of just passing them all as arguments, a
'struct fosphor_render' is introduced to hold them.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:38 +02:00
Sylvain Munaut a6a5ad8616 fosphor/cl: Fix tex coordinate in bicubic color mapping shader
The texture coordinates didn't match what the normal OpenGL bilinear
mapper does. It was off by half a texel.

This is needed because the color in the texture is considered to be a
sample at the center of the texel. (hence 0.5f, 0.5f offset removed)

For more details on bilinear from OpenGL :

http://hacksoflife.blogspot.be/2009/12/texture-coordinate-system-for-opengl.html

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-07-22 10:16:38 +02:00
Sylvain Munaut 3dd8d53490 gr-fosphor: Introduce a new glctx_update call back to refresh context
This is required for OSX where you need to tell the GL context when resize
has occured and stuff like that.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2014-01-12 11:01:38 +01:00
Sylvain Munaut 4ca8954908 fosphor/main: Improve the error handling path of the benchmark utility
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-12-11 23:54:50 +01:00
Konstanty Bialkowski dadc1d14fa fosphor/build: Make clean target compatible with BSD
Author: Konstanty Bialkowski <konstanty@ieee.org>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-12-11 23:54:49 +01:00
Sylvain Munaut 4913fd79d9 fosphor/cl: Prefer AMD/NVidia GPUs
On system with an integrated gpu + external gpu, the integrated one looks
great "on paper". Plenty of local ram, plenty of compute units, ...

But in practice, it sucks against the external one. So here, we prefer
NVidia / AMD.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-12-11 23:54:49 +01:00
Sylvain Munaut d58643fa89 gr-fosphor: Add proper dependency tracking in resource_data.c generation
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-12-06 13:28:44 +01:00
Sylvain Munaut f5cee5f826 fosphor: Fix double free in the init failure case
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-13 23:57:15 +01:00
Sylvain Munaut fd3d6cf77d gr-fosphor: Allow to select custom FFT window from the gr::fft:window list
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut ce907419c7 fosphor: Make the FFT window dynamic
- It's not longer hardcoded / computed in the kernel, but computed
   once and read from constant memory
 - By default it uses a periodic Hamming window
 - But you can load any window as a simple array of float
 - Different types of window is deemed out-of-scope here. The default
   is provided just for convenience to have something valid.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut 3779600868 gr-fosphor/cmake: Switch to the new recommended GnuradioConfig
Rather than using our own copy of FindGnuradioRuntine

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut 8378696eea gr-fosphor/lib: Add the new source file "axis.c" to source list
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut 6d9396f686 gr-fosphor: Add frequency range (center/span) awareness
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut ba6024ee5f gr-fosphor: Setup a mechanism to apply settings in the processing thread
The setters can be called from any thrad and will just set the
member variables and a flag asking the main processing thread to apply
the new settings on the next iteration.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut 010face67b fosphor/gl: Add a proper "smart" frequency axis
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:07 +01:00
Sylvain Munaut 8e89f9cd8b fosphor/gl: Use the new glf_printf instead of manual sprintf/glf_draw_str
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut 7e12d64a69 fosphor/gl_font: Introduce new glf_printf convenience function
This avoids having to do a sprintf then a draw_str myself every time.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut 81a9ad16fd fopshor: Add frequency range (center/span) awareness
Although this is not actually used anywhere yet, but will be used in the
drawing routines to draw a proper scale.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut a2318a5994 gr-fosphor: Use the new fosphor_set_power_range call
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut ca3f391976 fosphor: Store the selected power range in the top level 'struct fosphor'
The CL code keeps its own copy since those values are tweaked to be
applied in the kernel. We may also need the callback in the future if
instead of storing them we reconfigure the kernel at that point.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut 3ccf1aa52d fosphor: Refactor to introduce more shared state between global/cl/gl
Originally I wanted the CL/GL part to be as separate as possible and
have no shared data. But it's too inconvenient since a beside the
CL / GL objects there is also configuration data that should be shared
and distributed between the two.

So instead we still have separate gl/cl state that are restricted but
the function act on a shared 'struct fosphor' object that contains
everything that's shared and exposed to both cl.c and gl.c

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut 68f0302bce fosphor: Misc typo & whitespace fixes
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-10 22:24:06 +01:00
Sylvain Munaut dfb5081b91 gr-fosphor: Link to python libraries if python is enabled
This is required for OSX. And although not strictly required for linux,
it doesn't hurt.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-06 18:53:34 +01:00
Sylvain Munaut 0ea1177108 gr-fosphor: Submit data for processing in adaptative batch sizes
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-04 22:24:22 +01:00
Sylvain Munaut 3e35c83ded fosphor/gl_cmap_gen: Use the float version of round
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-04 22:01:48 +01:00
Sylvain Munaut 4066201ca8 fosphor/fft: Fix the window formula
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-04 22:01:27 +01:00
Sylvain Munaut 869ba4d156 fosphor/cl: Use OpenCL 1.1 API for everything except OSX
It seems that some linux distro ship OpenCL 1.2 headers but a OpenCL 1.1
ICD ...

So we just use OpenCL 1.1 API everywhere and disable 1.1 deprecated
warnings.

OSX OTOH doesn't allow to disable the deprecated but at least ships
consistent headers/ICD so we use 1.2 is available.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-11-04 22:00:48 +01:00
Sylvain Munaut 180fd0042a gr-fosphor: Make the different GUI version optional
You'd don't have to have glfw, qt and wx all at once, you can select
which variant you want built.

Python support is also make fully optional

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:09:50 +02:00
Sylvain Munaut 6183eefc9a gr-fosphor: Add Qt widget version of the fosphor sink
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:07:14 +02:00
Sylvain Munaut e3732c0609 gr-fosphor: Add WX widget version of the fosphor sink
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:06:04 +02:00
Sylvain Munaut b056fcc1a8 gr-fosphor: Split block into base function and UI specific part
It's split into:

 - A generic "base" sink that handles pretty much everything except
   managing a GL context and getting the UI interaction for it
 - The GLFW specific part

This is preparation for for WX and QT widget implementations of a
fosphor sink.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:05:08 +02:00
Sylvain Munaut 062040ae70 gr-fosphor: Move to the _impl paradigm
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 21:03:03 +02:00
Sylvain Munaut 4f102ee334 fosphor: Add AMD include path to the standalone benchmark tool Makefile
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 17:54:52 +02:00
Sylvain Munaut bbbd9986a4 fosphor/gl_cmap: Use an explicit 'context' object rather than static var
I originally thought that even with multiple fosphor instance, the shaders
could just be shared. But if those instances are binded to different
GL Contexts, shaders aren't shared and so need to be recreated.

So all the gl_cmap shader stuff is now stored inside a fosphor_gl_cmap_ctx
struct and the latter is stored in fosphor_gl_state

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 17:52:43 +02:00
Sylvain Munaut 6b93698f16 fosphor/gl_cmap: Prefix enum with fosphor_ for consitency
Since all the cmap stuff is fosphor-specific and can't be really
reused, use the fosphor_ prefix for stuff exposed outside gl_cmap.c
itself.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 17:52:11 +02:00
Sylvain Munaut 36d05cfc57 fosphor/cl: Make the batch size dynamic and up to FOSPHOR_FFT_MAX_BATCH
Basically need to :
 - Set the kernel parameter at each kernel invocation
 - Modify the kernel to deal with wrap-around when writing the
   waterfall texture

The batch size still must meet some constraint :
 - Be a multiple of FOSPHOR_FFT_MULT_BATCH
 - Be less than FOSPHOR_FFT_MAX_BATCH

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 17:49:48 +02:00
Sylvain Munaut 020f5b1c6f fosphor: Make sure the FFT len is from #define everywhere
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 17:49:19 +02:00
Sylvain Munaut e828e7faff fosphor/cl: Add a debug block allowing to save compile CL binary for debug
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-26 17:48:25 +02:00
Sylvain Munaut 20fd7fac53 fosphor/cl: Allow the use of cl_khr_local_int32_base_atomics extension
Apparently there are some cards that are neither Nvidia SM1.1, nor
OpenCL 1.1 but that do have cl_khr_local_int32_base_atomics extension.

This is enough for fosphor to implement the histogram so add the
required code to test for it and enable its use in the kernel if
required.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-18 11:43:06 +02:00
Sylvain Munaut 6db631c466 fosphor/cl: Add a workaround for OSX hiding the NVidia attributes
OSX doesn't allow query of NV attributes even on NVidia cards so we just
assume any non-opencl 1.1 nvidia card that does OpenCL is a SM1.1 one.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-16 09:12:59 +02:00
Sylvain Munaut 32e410a8c8 fosphor/cl: Remove extraneous CL/xxx includes
Those are taken care of by the cl_platform.h wrapper now

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-16 09:12:32 +02:00
Sylvain Munaut aabc21b7f2 fosphor: Initial import of the core code
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-13 22:05:38 +02:00
Sylvain Munaut edfee19c61 Initial import of the GNURadio block
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-10-13 22:02:56 +02:00