Commit Graph

38 Commits

Author SHA1 Message Date
Sylvain Munaut 65c7283981 fosphor: Update all copyright notices headers
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2021-01-08 17:29:58 +01:00
Sylvain Munaut e8a64b7297 fosphor/cl: Remove spurious debug fprintf
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-01-31 23:46:53 +01:00
Sylvain Munaut 0c658dd3dd fosphor/cl: Make sure to unlocking the GL objects during CL release
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-12-08 15:22:38 +01:00
Sylvain Munaut 15f7a07909 fosphor/cl: Display all devices and allow selection with env var
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-12-08 15:22:38 +01:00
Sylvain Munaut 4aef701e40 fosphor/cl: Check for image support when filtering CL devices
Thanks to Ethan Trewhitt for original patch

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-12-08 15:22:38 +01:00
Sylvain Munaut f5e8890139 fosphor/cl: Fix return type/value of cl_queue_clear_buffers
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-11-30 20:55:37 +01:00
Sylvain Munaut b06234e0fc fosphor/cl: Cleanup shared object lock/unlocking code paths
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-11-30 20:55:37 +01:00
Sylvain Munaut acdddf6e90 fosphor: Use lowercase for WIN32 includes
Apparently needed for mingw build and doesn't affect the MSVC ones.

Thanks to Martin Hauke <mardnh@gmx.de> for reporting

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2016-01-25 16:27:00 +01:00
Sylvain Munaut 44465b9186 fosphor/cl: Retry context creation without CL/GL sharing if needed
This happens commonly on optimus laptop when CL is Nvidia and the GL
is the Intel card. They can't share data ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:23 +01:00
Sylvain Munaut a969e7fbb0 fosphor/cl: Don't fail fatally if a platform fails to return devices
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-10-25 21:41:23 +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 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 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 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 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 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 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 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 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 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 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 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 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 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