Commit Graph

87 Commits

Author SHA1 Message Date
Geoffrey McRae
b4b4a37b2b [client] egl: switch to using GL_TEXTURE_EXTERNAL_OES for DMABUF
According to Erik @ NVidia the open source NVidia driver will not
create a EGLImage from a DMABUF if the target is not
GL_TEXTURE_EXTERNAL_OES. This change set converts the dmabuf texture
from GL_TEXTURE_2D to GL_TEXTURE_EXTERNAL_OES and at runtime performs a
global search & replace on fragment shaders as needed to remain
compatible, replacing `sampler2D` with `samplerExternalOES`.

Ref: https://github.com/NVIDIA/open-gpu-kernel-modules/discussions/243#discussioncomment-3283415
2023-03-09 09:20:01 +11:00
Geoffrey McRae
247e867f18 [client] egl: implemented SPICE display support 2022-05-22 18:19:58 +10:00
Geoffrey McRae
6699018ed1 [client] egl: check for null before free 2022-05-22 12:05:02 +10:00
Geoffrey McRae
947db38bc9 [client] egl: fix mistake in rect clamping 2022-05-22 11:53:46 +10:00
Geoffrey McRae
1fcdcc8725 [client] egl: allow for partial texture updates 2022-05-21 21:21:16 +10:00
Geoffrey McRae
952ebea2c5 [all] refresh copyright dates 2022-01-05 19:42:46 +11:00
Quantum
e9bf225c75 [client] egl: remove useless RenderStep struct 2021-09-04 13:28:49 +10:00
Quantum
579f998519 [client] all: replace assert with DEBUG_ASSERT 2021-08-14 12:19:07 +10:00
Geoffrey McRae
f0ea882165 [client] egl: cleanup texture filtering/post-processing 2021-08-11 18:53:36 +10:00
Geoffrey McRae
f78154d282 [client] egl: fixes to shader post-process pipeline 2021-08-11 06:31:01 +10:00
Geoffrey McRae
dc0b3a8d45 [client] egl: rework post process filters and add AMD FXR 2021-08-10 13:46:48 +10:00
Geoffrey McRae
230ce81eb8 [client] egl: allocate space for the initial texture dimensions
This fixes a buffer overrun when writing to the dimensions array
2021-08-10 09:41:56 +10:00
Geoffrey McRae
64ed383128 [client] egl: re-process the texture and invalidate if a setting changed 2021-08-10 07:51:23 +10:00
Quantum
eb680086ef [client] egl: correctly use flexible array members for BindData
Array size of 0 is a gcc extension, the standard C is not declaring a size.
2021-08-10 06:10:42 +10:00
Geoffrey McRae
92de467edc [client] egl: add ffx_cas post process filter 2021-08-09 23:12:58 +10:00
Geoffrey McRae
4eda01949d [client] egl: give pp filters the dimensions of all prior textures 2021-08-09 22:02:07 +10:00
Geoffrey McRae
062d18d5fa [client] egl: don't allocate the texture ringbuffer unless needed 2021-08-09 18:28:52 +10:00
Geoffrey McRae
04a54598b3 [client] egl: set a default scale for textures without filters 2021-08-09 18:27:10 +10:00
Geoffrey McRae
79dcc6d4f1 Revert "[client] egl: set a default scale for textures without filters"
This reverts commit 57a74c156b.
Pushed a ton of changes that should not have been pushed
2021-08-09 18:26:30 +10:00
Geoffrey McRae
57a74c156b [client] egl: set a default scale for textures without filters 2021-08-09 18:24:33 +10:00
Geoffrey McRae
6882e5c59f [client] egl: provide the texture scale to the desktop shader
If the texture has a post-processing filter that has scaled the texture,
the desktop fragment shader needs to know this if it's doing linear
scaling.
2021-08-09 18:22:28 +10:00
Geoffrey McRae
f7f8060447 [client] egl: allow setting an output scale for a post-process shader 2021-08-09 17:57:36 +10:00
Geoffrey McRae
86d6b67337 [client] egl: rework egl to accomodate post-processing filtering 2021-08-09 14:08:10 +10:00
Geoffrey McRae
91d1b8d2cd [client] egl: refactor egl_texture_free to use project naming standards 2021-08-08 17:52:13 +10:00
Geoffrey McRae
baf9661530 [client] egl: remove texture->ops indirection 2021-08-08 17:31:52 +10:00
Geoffrey McRae
266ad27998 [client] egl: refactor to use project naming standard 2021-08-08 17:16:10 +10:00
Quantum
ac3677d9ae [client] egl: implement partial copies for framebuffer textures
This uses the same line sweep algorithm originally created to copy DXGI
textures to IVSHMEM to implement the copy from IVSHMEM to memory-mapped
pixel buffer objects.
2021-08-08 08:30:11 +10:00
Quantum
51b9cd4e5a [all] copyright: use unicode copyright sign ©
This is done for consistency with the license strings in appstrings.c.
2021-08-04 21:16:35 +10:00
Geoffrey McRae
f3413815a9 [client] egl: re-implement DMABUF (untested) 2021-08-03 03:59:03 +10:00
Geoffrey McRae
13d9c84dc9 [client] egl: replace monolithic EGLTexture with modular version
The way things were handled in EGLTexture is not only very hard to
follow, but broken. This change set breaks up EGLTexture into a modular
design making it easier to implement the various versions.

Note that DMABUF is currently broken and needs to be re-implemented.
2021-08-02 23:37:33 +10:00
Quantum
b8effaf42c [client] egl: use glGetError and codes for errors in gl* functions
We used to use DEBUG_EGL_ERROR for gl* functions, which just yields
EGL_SUCCESS even when there are errors.
2021-07-19 19:36:46 +10:00
Quantum
7c872d2d9e [client] egl: properly use OpenGL ES
Instead of using the desktop <GL/gl.h>, we properly use the OpenGL ES 3.x
headers. Also, we now use GL_EXT_buffer_storage for MAP_PERSISTENT_BIT_EXT
and MAP_COHERENT_BIT_EXT as the core versions are only available in desktop
OpenGL 4.4. Similarly, we need GL_EXT_texture_format_BGRA8888 for GL_BGRA_EXT
as GL_BGRA is desktop-only.
2021-07-18 20:44:32 +10:00
Quantum
c6a6230a56 [client] egl: revert "only copy damaged areas when using dmabuf"
This reverts commit a14de25661.
Frame is sometimes incorrect.
2021-07-18 18:48:35 +10:00
Quantum
a14de25661 [client] egl: only copy damaged areas when using dmabuf
This speeds up the copy significantly when the frame only has small
amount of damage.
2021-07-18 17:41:29 +10:00
Quantum
eb357fa58a [client] egl: use glCopyTexSubImage2D to copy when using DMA
This removes the need for the driver to allocate texture storage and deleting
the previous allocation on every frame update.
2021-07-18 10:34:21 +10:00
Geoffrey McRae
f07e4839b1 [client] egl: fix dmabuf support 2021-06-08 20:51:09 +10:00
Geoffrey McRae
964403b4f8 [client] egl: tex is now an array, so check it properly for assignment 2021-06-08 20:45:37 +10:00
Geoffrey McRae
20d20f5c8a [client] egl: fix incorrect texture usage
The existing code would overwrite the texture's data even if the texture
is currently being used to render to screen. This changeset generates a
texture for each buffer preventing this invalid usage.
2021-06-08 20:41:22 +10:00
Quantum
24d0aa0c18 [all] normalize copyright on all source files 2021-06-06 11:53:05 +10:00
eater
62725bcb9d [client] egl: show error for glMapBufferRange instead of glBindbuffer 2021-05-04 10:30:03 +10:00
vroad
5d5eb47598 [client] egl: do not leak fence when using DMABUF 2021-04-25 14:32:17 +10:00
Quantum
63ec2dc01b [client] egl: destroy cached EGLImages when changing format
Reusing cached EGLImages while the frame format has changed will result
in visual artifacts. We should instead destroy the EGLImages and let
them be recreated.
2021-02-21 19:07:46 +11:00
Quantum
39a09ca565 [client] egl: remove dependency on SDL
After this PR, EGL functions are now accessed through <EGL/egl.h>
instead of through <SDL2/SDL_egl.h>, removing a pointless dependency
on SDL.
2021-02-21 10:31:49 +11:00
Quantum
30a888711b [client] egl: force DMA copy into texture in on_frame
This commit forces the DMA'd memory to be copied into the texture in
the EGL on_frame handler. This avoids tearing when the LG host inevitably
updates the underlying memory. We need an additional copy inside the GPU,
but this is cheap compared to copying from system memory.

We could have used logic to lock the memory buffer, but that would require
performing DMA on every frame, which wastes memory bandwidth. This
manifests as reduced frame rate when moving the mouse compared to the
non-DMA implementation.

We also keep multiple EGLImages, one for each DMA fd, to avoid issues
with the OpenGL driver.
2021-02-21 10:31:48 +11:00
Geoffrey McRae
ca5c3938e4 [client] all: move all SDL specific code into displayservers/sdl 2021-02-21 10:31:48 +11:00
Geoffrey McRae
bf583290a4 [client/common] restructure project in prep for full SDL removal 2021-02-21 10:31:46 +11:00
Geoffrey McRae
202739c5be [client] egl: better debug output for EGL errors 2021-01-24 13:17:11 +11:00
Geoffrey McRae
9941a4bb83 [client] egl: runtime detect support for glEGLImageTargetTexture2DOES 2021-01-24 12:06:10 +11:00
Geoffrey McRae
2738e822a4 [client] egl: remove external dependency on libdrm 2021-01-16 22:11:15 +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