Commit Graph

324 Commits

Author SHA1 Message Date
Geoffrey McRae
cbeae46c0b [client] egl: move rotation into the fragment shader 2021-01-15 13:13:39 +11:00
Geoffrey McRae
72c86d7125 [client] all: add screen rotation support win:rotate
Currently only supports EGL, if there is enough demand for OpenGL
support this can be added later.

Closes #231
2021-01-15 12:42:16 +11:00
Geoffrey McRae
c40a81ddf4 [client] egl: remove no longer used yuv shader 2021-01-15 12:42:16 +11:00
Quantum
369c49cdcf [client] render/opengl: remove braces so fallthrough comment is recognized
gcc -Wimplicit-fallthrough only detects comments if they are immediately
preceded before the next label. Braces stops it from recognizing the
fallthrough comment.
2021-01-15 08:06:56 +11:00
Tudor Brindus
a46a3a2668 [all] use explicit void parameter lists
This makes it a compile-time error to call a function that semantically
takes no parameters with a nonzero number of arguments.

Previously, such code would still compile, but risk blowing up the stack
if a compiler chose to use something other than caller-cleanup calling
conventions.
2021-01-14 17:29:37 +11:00
Geoffrey McRae
b58176fcdb [client] removed last remnents of the decoders & parsers 2021-01-12 12:42:06 +11:00
Geoffrey McRae
4334912e01 [client] egl: actually set the dma texture member 2021-01-09 22:16:40 +11:00
Geoffrey McRae
19db67cfe5 [client] egl: detect the NVIDIA driver and disable DMA support
DMA suport for NVIDIA is advertised as available by the presense of the
extension `EGL_EXT_image_dma_buf_import`, however it is completely
broken. Until this is fixed refuse to use DMA support even if VM->VM
support is possible.

See: https://forums.developer.nvidia.com/t/egl-ext-image-dma-buf-import-broken-egl-bad-alloc-with-tons-of-free-ram/165552
2021-01-09 21:25:41 +11:00
Quantum
78b1f64a61 [client] require 8 bit colour when creating OpenGL context
For some reason, if we don't ask for 8-bit, wayland will give a context with
lower bit depth, which looks terrible.
2021-01-04 15:51:36 +11:00
Tudor Brindus
1ca5e439c1 [client] egl: disable EGL when running on Wayland
This commit makes Looking Glass always use the OpenGL renderer when
running on Wayland. The EGL renderer is broken on Wayland and can't
reasonably be fixed until SDL is dropped entirely (as per
https://github.com/gnif/LookingGlass/issues/306).

Until that time, the OpenGL renderer provides a much better
Wayland-native experience.
2021-01-04 15:47:01 +11:00
Geoffrey McRae
3016f0c53e [client] fix invalid method names 2021-01-04 14:44:33 +11:00
Tudor Brindus
4bceaf5505 [client] fix hang in eglSwapBuffers when exiting while not visible
eglSwapBuffers is allowed to block when called with a nonzero interval
parameter. On Wayland, Mesa will block until a frame callback arrives.
If an application is not visible, a compositor is free to not schedule
frame callbacks (in order to save CPU time rendering something that is
entirely invisible).

Currently, starting Looking Glass from a terminal, hiding it
entirely, and sending ^C will cause Looking Glass to hang joining the
render thread until the window is made visible again.

Calling eglDestroySurface is insufficient to unblock eglSwapBuffers, as
it attempts to grab the same underlying mutex.

Instead, this commit makes it so that we pass a 0 interval to
eglSwapBuffers when running on Wayland, such that we don't block waiting
for a frame callback. This is not entirely ideal as it *does* mean
Looking Glass submits buffers while hidden, but it seems better than
hanging on exit.

It also forces opengl:vsync and egl:vsync flags to off when running on
Wayland, as they are meaningless there.
2021-01-04 14:43:21 +11:00
Tudor Brindus
bc2f26b86d [client] set default opengl:vsync=off
This makes it consistent with the EGL renderer.
2021-01-04 14:43:21 +11:00
Geoffrey McRae
bf1eba15d1 [client] egl: actually do front buffer rendering 2020-12-31 15:31:24 +11:00
Geoffrey McRae
1e4e582f67 [client] egl: only use a single texture but multiple PBOs 2020-12-31 14:18:38 +11:00
Geoffrey McRae
678ba0f484 [client] egl: check for EGLImage creation failure 2020-12-31 12:58:40 +11:00
Geoffrey McRae
2c2008c981 [client] egl: improve DMA logic 2020-12-31 12:58:22 +11:00
Geoffrey McRae
806ff934b2 [client] egl: detect if egl is even available 2020-11-29 21:43:28 +11:00
Geoffrey McRae
cd4dfd7252 [client] egl: cleanup/refactor of cursor texture code 2020-11-10 20:42:14 +11:00
Geoffrey McRae
36726bb349 [client] egl: fixed typo 2020-11-09 07:42:59 +11:00
Geoffrey McRae
dd7e0ea8c6 [client] egl: added colorblind support (egl:cbMode=0/1/2/3)
Based on http://www.daltonize.org/search/label/Daltonize

0 = Off
1 = Protanope
2 = Deuteranope
3 = Tritanope
2020-11-09 07:08:15 +11:00
Geoffrey McRae
4c14797319 [client] egl: no need to create textures when using DMA mode 2020-10-30 22:19:15 +11:00
Geoffrey McRae
42fef7a98d [client] egl: remove deprecated YUV420 support 2020-10-30 19:31:48 +11:00
Geoffrey McRae
267fa6e389 [client] egl: select the correct fourcc type for dma mode 2020-10-30 11:55:47 +11:00
Geoffrey McRae
4f9544d61d [client] egl: added DMA texture support for direct upload
Note: This only works with the KVMFR kernel module in a VM->VM
configuration. If this causes issues it can be disabled with the new
option `app:allowDMA`
2020-10-30 02:36:45 +11:00
Geoffrey McRae
0bf73d862d [client] added initial framework for dma buffer support 2020-10-30 02:36:45 +11:00
Geoffrey McRae
58ba76a27f [client] seperate frame setup and data events 2020-10-12 19:43:29 +11:00
Geoffrey McRae
90d1ed64e4 [client] opengl: added RGBA16F support 2020-10-11 20:44:22 +11:00
Geoffrey McRae
919b77df71 [client] egl: fix RGBA16F support 2020-10-11 20:34:34 +11:00
Geoffrey McRae
98e0e5fc0b [client] egl: correct invalid value for texture row length 2020-10-11 19:59:44 +11:00
Geoffrey McRae
8a9f004ff6 [host/client] fix invalid initialization of RGBA16F 2020-10-11 19:39:47 +11:00
Geoffrey McRae
9c6bd888fd [host/client] added experimental RGBA16 float support (EGL only) 2020-10-11 19:22:31 +11:00
Jonathan Rubenstein
66df00cee2 Add option to skip splash screen fade out 2020-10-09 03:28:58 +11:00
Geoffrey McRae
c66a339bbc [client] egl: ensure overflow occurs for state value checks 2020-08-15 22:39:10 +10:00
Geoffrey McRae
76e119f8ad [client] egl: don't fade the splash when restarting 2020-08-11 14:54:48 +10:00
Geoffrey McRae
da8b2d0cec [client] egl: properly wait for a new frame on restart 2020-08-11 14:45:08 +10:00
Geoffrey McRae
74649ddb96 [client] gracefully restart if the host application restarts 2020-08-11 14:30:44 +10:00
Geoffrey McRae
06aee158de [client] egl: make better use of atomics and fix modulus bug 2020-07-24 17:39:16 +10:00
Geoffrey McRae
ede96fa486 [client] egl: don't map the texture until it's needed
The texture buffer may still be in use if we try to re-map it
immediately, instead only map when we need it mapped, and unmap
immediately after advancing the offset allowing the render thread to
continue while the unmap operation occurs
2020-05-30 16:50:27 +10:00
Geoffrey McRae
fcbdf7ba4f [client] egl: fix non-streaming texture updates 2020-05-29 16:54:25 +10:00
Geoffrey McRae
e8c949c1e7 [client] egl: dont re-setup the fps texture on each update 2020-05-29 16:47:21 +10:00
Geoffrey McRae
28c93ef5ac [client] egl: don't unmap/map all buffers for each frame 2020-05-29 15:48:59 +10:00
Geoffrey McRae
075c82b32c [client] egl: fix context binding enabling a lock free implementation 2020-05-22 17:47:19 +10:00
Geoffrey McRae
c9ff1e1949 [client] egl: alter warning about low fps as it doesn't apply anymore 2020-05-21 14:09:51 +10:00
Geoffrey McRae
e31f38eadc [client] allow frame updates to be triggered by a timed event
This is a major change to how the LG client performs it's updates. In
the past LG would operate a fixed FPS regardless of incoming update
speed and/or frequency. This change allows LG to dynamically increase
it's FPS in order to better sync with the guest as it's rate changes.
2020-05-21 13:41:59 +10:00
Geoffrey McRae
756b57400b [client] egl: move context init to lock function 2020-05-21 11:55:35 +10:00
Geoffrey McRae
01bfd2e090 [client] egl: make better use of the second thread for streaming 2020-05-21 11:44:56 +10:00
Geoffrey McRae
a6d6a49f82 [client] egl: use atomic members instead of locking the entire state 2020-05-21 08:20:30 +10:00
Geoffrey McRae
d899c26617 [client] egl: add low FPS warning when failing to keep up 2020-05-19 22:42:55 +10:00
Geoffrey McRae
73ba325072 [client] egl: reworked the streaming texture pipeline 2020-05-19 22:03:36 +10:00
Geoffrey McRae
f96f0fecda [client] egl: use proper atomics for pbo counting 2020-05-18 09:06:11 +10:00
feltcat
e7f088ef52 [client] egl: typo fix in info message
"Multsampling" to "Multisampling"
2020-04-24 19:01:42 +10:00
Geoffrey McRae
f6691a90c0 [client/obs] improve frambuffer_read functions to support copy pitch
Fixes #244
2020-04-14 13:27:07 +10:00
Mikko Rasa
ead09ed110 [client] opengl: render frame if config didn't change 2020-04-14 12:19:59 +10:00
fishery
94a35a6558 [client] fix buffer overflow in opengl_options
buffer overflow loading opengl_options
2020-04-02 00:17:19 +11:00
Geoffrey McRae
4746c89227 [all] moved time and locking methods to the common library 2020-01-17 14:35:08 +11:00
Geoffrey McRae
278d851c7c [egl] added fallback for platforms not supporting eglGetPlatformDisplay 2020-01-17 11:50:00 +11:00
Geoffrey McRae
17e05c6fd5 [all] expose the FrameBuffer struct for correct sizeof calculations 2020-01-13 19:30:49 +11:00
Andrew Sheldon
70110b4a5a [client] Use eglGetPlatformDisplay() to fix surface creation
[Why]
Recent versions of Mesa may have trouble with surface creation, resulting in
errors like:
egl.c:428  | egl_render_startup             | Failed to create EGL surface (eglError: 0x300b)

[How]
Replace eglGetDisplay() with eglGetPlatformDisplay(). Requires EGL 1.5, but should
be supported with any desktop driver released in the past few years.
2019-12-13 00:35:35 +11:00
Geoffrey McRae
a6f23f00b4 [client] opengl: handle configuration failure properly 2019-12-12 23:32:31 +11:00
Geoffrey McRae
30e3a43311 [client] opengl: fixed failure to render full frame 2019-12-12 23:04:58 +11:00
Geoffrey McRae
66891aa536 [client] don't require wayland-egl, fixes #204 2019-10-26 11:23:04 +11:00
Geoffrey McRae
4c0ca1c8e7 [client] fix xor support for masked color cursors
fixes #200
2019-10-09 19:48:42 +11:00
Geoffrey McRae
bca54ab1f6 [client/host] added new asyncronous memory copy
This changes the method of the memory copy from the host application to
the guest. Instead of performing a full copy from the capture device
into shared memory, and then flagging the new frame, we instead set a
write pointer, flag the client that there is a new frame and then copy
in chunks of 1024 bytes until the entire frame is copied. The client
upon seeing the new frame flag begins to poll at high frequency the
write pointer and upon each update copies as much as it can into the
texture.

This should improve latency but also slightly increase CPU usage on the
client due to the high frequency polling.
2019-10-09 13:53:02 +11:00
Geoffrey McRae
6d2c464436 [client] egl: improved streaming texture syncronization 2019-08-30 12:09:05 +10:00
Geoffrey McRae
da94075e7b [client] egl: more verbose error on texture egl failures 2019-08-30 11:40:38 +10:00
Geoffrey McRae
fce88fc72c [EGL] add debug printf helper 2019-08-30 11:33:43 +10:00
Geoffrey McRae
b979752989 [client] added missing include 2019-07-15 18:30:39 +10:00
Geoffrey McRae
607539a2af [client] improve streaming texture performance 2019-06-13 08:54:51 +10:00
Geoffrey McRae
3d426ccef8 [all] fix missing cursor when client reconnects 2019-05-28 14:06:15 +10:00
Geoffrey McRae
b31e8e1cee [client] egl: remove accidental commit of debug code 2019-05-27 18:46:05 +10:00
Geoffrey McRae
f0923c4ed7 [client] egl: expose a few new tuneables 2019-05-27 18:42:46 +10:00
Geoffrey McRae
4cf2c7a350 [client] check for failure to map pbo memory 2019-05-27 01:39:01 +10:00
Geoffrey McRae
dba9764c5e [egl] alert: fix fuzzy font bug and make alerts a little more plesant 2019-05-23 19:58:12 +10:00
Geoffrey McRae
d2d427b533 [client] egl: query maximum multisample support for MSAA context
Based on @rLink234's work in 4ac781b4516678b6c59d9ecf4a61df64a01ec8c1

Fixes #128
2019-05-23 16:56:50 +10:00
Geoffrey McRae
3585e02993 [client] egl: add options for maximum NV level and initial level
Adds options:

 * egl:nvGain
 * egl:nvGainMax

Fixes #153
2019-05-23 16:33:40 +10:00
Geoffrey McRae
86f4256b5a [client] egl: fix streaming texture re-init crash 2019-05-22 12:19:03 +10:00
Geoffrey McRae
fc66a4a19c [client] egl: use persistant mapped texture buffers
While it is recommended to use memory barriers when updating a buffer
like we are, since we double buffer it is unlikely we will corrupt a
prior frame, and even if we do since it's just texture data at worst
we might see a tear.
2019-05-22 11:37:27 +10:00
Geoffrey McRae
087387087e [client] fix race condition on initial uniform access 2019-05-22 11:36:47 +10:00
Geoffrey McRae
e3c98ddc35 [client] port all configuration parsing to use the new option helper 2019-05-21 15:03:59 +10:00
Geoffrey McRae
ba50fbdc3e [client] egl: implement pixel perfect upscaling 2019-04-19 11:23:51 +10:00
Geoffrey McRae
d8915dbfc9 [build] make "common" a static library (part 2/2) 2019-04-11 11:12:59 +10:00
Geoffrey McRae
1fbba5cf2d [client] egl: make nightvision enhance luminosity before gain 2019-03-31 00:08:52 +11:00
Geoffrey McRae
35094a57cb [client] more cleanup and added alerts for new events 2019-03-30 12:26:06 +11:00
Geoffrey McRae
c4001c727a [client] egl: added new super+N binding to increase image gain
This feture is to allow the use of the key combination <super>+N to
increase the brightness of the screen when using monitors with poor
backlighting. Can help in some games.

N = Night vision
2019-03-29 00:15:14 +11:00
Geoffrey McRae
ee09594190 [client] cmake: cosmetics 2019-03-28 20:15:13 +11:00
Geoffrey McRae
66c3c0115f [client] added options to disable/enable interfaces 2019-03-28 20:12:18 +11:00
Geoffrey McRae
3e021f3a6b [client] use cmake to generate renderers/fonts/clipboards headers/code
This is in preperation of cmake options to enable/disable various
functionallity.
2019-03-28 19:56:14 +11:00
Geoffrey McRae
b524c077a4 [client] egl: remove the rest of the shaders into seperate files 2019-03-28 15:53:15 +11:00
Geoffrey McRae
10f7efecb2 [client] cmake: fix inconsistent versioning 2019-03-28 15:03:35 +11:00
Geoffrey McRae
f09ee0bdb3 [client] egl: fix minor error in CMakeLists 2019-03-28 15:01:52 +11:00
Geoffrey McRae
d5a52241b0 [client] egl: move shaders into seperate files and build into objects 2019-03-28 14:59:54 +11:00
Geoffrey McRae
52c4e15c76 [client] project restructure part 2/2 2019-03-28 12:42:41 +11:00
Geoffrey McRae
fdba14691c [client] egl: requires gl 2019-03-28 12:31:28 +11:00
Geoffrey McRae
db398d41a0 [client] project restructure part 1/2 2019-03-28 11:02:36 +11:00
Geoffrey McRae
7cbaf8b5be [egl] don't assume SDL is compiled with Wayland support 2019-03-26 17:30:16 +11:00
Geoffrey McRae
08bf01b649 [all] update copyright dates 2019-02-22 22:16:14 +11:00
Geoffrey McRae
e4ae9134ae [client] egl: fix graphical glitch with splash 2019-01-02 10:36:17 +11:00
Geoffrey McRae
640bc03c6b [client] [Patch 2/2] fixes #106 2019-01-02 10:30:55 +11:00
Geoffrey McRae
667aed635d [client] egl: added untested support for wayland 2019-01-02 00:04:40 +11:00
Geoffrey McRae
507732587e [client] egl: fixed uninitialized variable bug 2018-12-16 12:17:12 +11:00
Geoffrey McRae
de5795e368 [client] egl: implemented alerts and some minor fixes to fps 2018-12-16 10:57:01 +11:00
Geoffrey McRae
fca71e2b95 [client] egl: slight correction to splash 2018-12-16 00:56:35 +11:00
Geoffrey McRae
0e2b371e59 [client] egl: added splash screen rendering 2018-12-16 00:54:37 +11:00
Geoffrey McRae
e1fa6b4057 [client] egl: fix cursor regression 2018-12-13 02:11:37 +11:00
Geoffrey McRae
b6c8d3fae5 [client] egl: fix mono cursor double height regression 2018-12-13 01:39:52 +11:00
Geoffrey McRae
5fe2db7e56 [client] rename fps variables to be more correct 2018-12-12 23:59:22 +11:00
Geoffrey McRae
42fa0e1d1f [client] egl: corrected fps alpha blending 2018-12-12 22:38:08 +11:00
Geoffrey McRae
abfe3a9b4d [client] egl: moved desktop rendering into seperate unit 2018-12-12 21:41:51 +11:00
Geoffrey McRae
b9f8f1a0ad [client] egl: add and use default quad helper for models 2018-12-12 20:08:52 +11:00
Geoffrey McRae
608b67af77 [client] egl: moved fps code into seperate unit 2018-12-12 20:04:43 +11:00
Geoffrey McRae
2a65e39848 [client] egl: added missing files from last commit 2018-12-12 18:57:31 +11:00
Geoffrey McRae
c23bf6a0c4 [client] egl: migrate cursor code into seperate unit 2018-12-12 18:53:55 +11:00
Geoffrey McRae
50c460df5a [client] define GL_GLEXT_PROTOTYPES globally 2018-12-12 16:53:30 +11:00
Geoffrey McRae
61f0577ab2 [client] egl: costmetics 2018-12-12 16:41:29 +11:00
Geoffrey McRae
a9aab3c1ee [client] egl: moved egl sources into subdirectory 2018-12-12 16:39:04 +11:00
Geoffrey McRae
73da86ac0e [client] egl: add checking to egl_shader_get_uniform_location 2018-12-12 16:32:16 +11:00
Geoffrey McRae
43d08df6b3 [client] egl: rename "shader" to "this" for consistancy 2018-12-12 16:31:25 +11:00
Geoffrey McRae
4654f317ca [client] opengl: fixed incorrect colors and added 10-bit RGBA support 2018-12-12 10:55:18 +11:00
Geoffrey McRae
d2b83027b4 [client] egl: removed accidental commit of test code 2018-12-11 16:35:53 +11:00
Geoffrey McRae
7be930a69c [client] removed use of now removed frame type, fixed #105 2018-12-11 16:34:41 +11:00
Geoffrey McRae
75ffcacfe4 [client] added support for RGBA, BGRA and 10-bit RGBA 2018-12-04 21:24:01 +11:00
Geoffrey McRae
1beeac545d [client] added missing lg-fonts.c to the repo 2018-11-20 22:34:01 +11:00
Geoffrey McRae
ab98c87e7c [client] egl: added FPS rendering 2018-11-20 09:50:09 +11:00
Geoffrey McRae
5b453d604e [client] remove other render modes from font ABI 2018-11-20 05:50:22 +11:00
Geoffrey McRae
90fc2a8164 [client] move FPS calculations out of renderers 2018-11-20 05:26:51 +11:00
Geoffrey McRae
0ed9301ed9 [client] font: implemented font ABI and updated OpenGL to use it 2018-11-20 04:38:53 +11:00
Geoffrey McRae
4e7de236d3 [egl] implement window positioning 2018-10-04 02:31:37 +10:00
Geoffrey McRae
741dfd418d [egl] improve texture upload performance 2018-10-04 00:09:47 +10:00
Geoffrey McRae
e70928d603 [egl] fix incorrect xor blending for monochrome cursors 2018-09-25 23:32:45 +10:00
Geoffrey McRae
e2b33348f3 [egl] added monochrome cursor rendering 2018-09-25 23:04:29 +10:00
Geoffrey McRae
3ff712fea5 [egl] fix performance issue with cursor updates and add todo message 2018-09-24 20:26:31 +10:00
Geoffrey McRae
2db26ae37e [egl] fix incorrect mouse size and position scaling 2018-09-24 20:11:42 +10:00
Geoffrey McRae
375b97ca6f [egl] fix incorrect mouse colors 2018-09-24 19:52:44 +10:00
Geoffrey McRae
d331a3dd5a [egl] added intial cursor support 2018-09-24 19:48:11 +10:00
Geoffrey McRae
c0c63fd93b [egl] simplify yuv to rgb shader 2018-09-23 20:56:18 +10:00
Geoffrey McRae
b5a47cae25 [egl] implemented YUV420 decode support in hardware 2018-09-23 20:45:20 +10:00
Geoffrey McRae
1f1c9dfa59 [egl] don't re-create the buffer each frame 2018-09-23 16:56:09 +10:00
Geoffrey McRae
884ad6557b [egl] cleanup texture API 2018-09-23 15:56:47 +10:00
Geoffrey McRae
00658f3d64 [egl] split out texture code into it's own object 2018-09-23 15:48:44 +10:00
Geoffrey McRae
fff3ec30b8 [egl] added basic shaders and use dma to xfer buffer to the gpu 2018-09-22 18:00:52 +10:00
Geoffrey McRae
26434f7baf [egl] initial commit of new modern OpenGL ES renderer 2018-09-22 16:26:55 +10:00
Geoffrey McRae
83592f7e4a [client] cleanup of renderer API for better usage
* Added new on_render_start for render initialization
* Changed on_resize to execute inside the render thread
2018-07-28 14:49:37 +10:00
Geoffrey McRae
13cd50f92c [client] disable multisample after logo is gone
We only use multisample to smooth out the edges of the LG logo, it is
pointless to leave it on after the logo is gone.
2018-07-28 10:36:41 +10:00
Geoffrey McRae
05bd587c74 [client] implemented initial slow yuv420 support 2018-07-28 08:41:39 +10:00
Geoffrey McRae
60070e6076 [client] implement stream paused alert 2018-07-24 01:09:53 +10:00
Geoffrey McRae
d839026ade [opengl] added fade out to wait screen 2018-07-20 01:01:16 +10:00
Geoffrey McRae
34de213926 [opengl] render alerts and fps on wait screen 2018-07-20 00:10:29 +10:00
Geoffrey McRae
b5ec4dd305 [client] scale up the logo and put a gradient behind it 2018-07-19 23:48:35 +10:00
Geoffrey McRae
023d3f811b [client] render the looking glass logo (almost) 2018-07-19 23:33:51 +10:00