mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-03 20:14:34 +00:00
Compare commits
203 Commits
dxgi-rgb24
...
Release/B7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27fe47cbe2 | ||
|
|
aefbebff9c | ||
|
|
9174b1ae0f | ||
|
|
f6b7ea11c8 | ||
|
|
2c50ce4dbd | ||
|
|
f6b0752e45 | ||
|
|
50fee59b29 | ||
|
|
554f5bf75d | ||
|
|
b43f572af0 | ||
|
|
d9f2df361d | ||
|
|
6dcf178879 | ||
|
|
ea00b623ed | ||
|
|
711c932380 | ||
|
|
be52a86a9a | ||
|
|
420eaebb71 | ||
|
|
551298ed5b | ||
|
|
41008add12 | ||
|
|
32d1b8063e | ||
|
|
b0227a8ff8 | ||
|
|
a1c713556d | ||
|
|
a0cf34df73 | ||
|
|
fbb489b9b6 | ||
|
|
03ca20d3e4 | ||
|
|
7e9e38faa5 | ||
|
|
0fd6f59bbb | ||
|
|
661efd107e | ||
|
|
f6094de919 | ||
|
|
77f6054f0a | ||
|
|
c169d4ab23 | ||
|
|
e25492a3a3 | ||
|
|
4e8201da07 | ||
|
|
6a0a635781 | ||
|
|
3ea37b86e3 | ||
|
|
d060e375ea | ||
|
|
7305ce36af | ||
|
|
c04f84b85c | ||
|
|
d21bdebc52 | ||
|
|
695cbc2d61 | ||
|
|
2067b21d47 | ||
|
|
9bc82ab1b4 | ||
|
|
82c9df54c5 | ||
|
|
c48bd35b3a | ||
|
|
ecd3692e1e | ||
|
|
23b773ad80 | ||
|
|
a626a1142d | ||
|
|
e70718600c | ||
|
|
0990c59eff | ||
|
|
fb1d96e147 | ||
|
|
7f515c54b3 | ||
|
|
20972cfd9b | ||
|
|
dc9065b62f | ||
|
|
13b9756e80 | ||
|
|
d902afa3dc | ||
|
|
6e37305765 | ||
|
|
dd6c79594b | ||
|
|
ce9ed5da5d | ||
|
|
fdad5daff8 | ||
|
|
8d25469d27 | ||
|
|
8c5d1d47ee | ||
|
|
90398bc04f | ||
|
|
989fe2bb0b | ||
|
|
7a41169104 | ||
|
|
0b4322d921 | ||
|
|
b251b22a64 | ||
|
|
90b27ae1f7 | ||
|
|
4d388d6b9b | ||
|
|
a88783e5b7 | ||
|
|
da820769e8 | ||
|
|
d5b32225f4 | ||
|
|
778c21070c | ||
|
|
cae410d4de | ||
|
|
064a605208 | ||
|
|
279357e205 | ||
|
|
98aade2ec9 | ||
|
|
4acea9fa25 | ||
|
|
01efbc62c4 | ||
|
|
ed512f5943 | ||
|
|
4a4f72ba38 | ||
|
|
eb31815b46 | ||
|
|
545e736389 | ||
|
|
6a72633674 | ||
|
|
9123984ecc | ||
|
|
d81395b672 | ||
|
|
bfadf0a427 | ||
|
|
03662f45a7 | ||
|
|
a4e761bedc | ||
|
|
beb8de922d | ||
|
|
e247f1fc7b | ||
|
|
4463ca15f6 | ||
|
|
97d91a32c8 | ||
|
|
2d41cda640 | ||
|
|
a894348530 | ||
|
|
ad7ac6540f | ||
|
|
0184ddeedd | ||
|
|
b87d8d2f33 | ||
|
|
5c4540ed8b | ||
|
|
c7f1aadb9e | ||
|
|
57ac020c8c | ||
|
|
71b826458d | ||
|
|
4408359597 | ||
|
|
2f3ca443cf | ||
|
|
66049cf763 | ||
|
|
a6dc8a9db3 | ||
|
|
dc4d93f50a | ||
|
|
3b43dcb80d | ||
|
|
9de047d9cb | ||
|
|
1098b7e6bd | ||
|
|
055d5527ef | ||
|
|
b1313980fb | ||
|
|
319241b597 | ||
|
|
b0b851dd4b | ||
|
|
60b01566e1 | ||
|
|
4076377820 | ||
|
|
0b210a280d | ||
|
|
a4fede01f3 | ||
|
|
071e4323fa | ||
|
|
be82b7e578 | ||
|
|
c07b72883a | ||
|
|
462d8187b6 | ||
|
|
4523b9ba00 | ||
|
|
cae4b2f4f9 | ||
|
|
72b25b99bc | ||
|
|
e376e6fb53 | ||
|
|
34e8a2255e | ||
|
|
adaf40e2bf | ||
|
|
84dd68dd2b | ||
|
|
738a04d0bc | ||
|
|
2316a5e64d | ||
|
|
47ad93f48d | ||
|
|
c5cbb8aa46 | ||
|
|
ad00aaacd0 | ||
|
|
1b75ae0762 | ||
|
|
5b3cc4cd48 | ||
|
|
7247fadad8 | ||
|
|
c2237f29ae | ||
|
|
e5a9c0242f | ||
|
|
537218d6ae | ||
|
|
f05151c9a6 | ||
|
|
b776b00a67 | ||
|
|
4b4e07875d | ||
|
|
6104956a27 | ||
|
|
3668040892 | ||
|
|
8cd002f1b2 | ||
|
|
22d949c411 | ||
|
|
43a3fb0db3 | ||
|
|
8d27d9e2e2 | ||
|
|
660b4b8ec8 | ||
|
|
4911e129f8 | ||
|
|
d3ee5bddde | ||
|
|
0ce4c34c37 | ||
|
|
584de4133f | ||
|
|
3330f83af6 | ||
|
|
5d4c1d348c | ||
|
|
750cab83a3 | ||
|
|
e61678ef1b | ||
|
|
6357df1a7a | ||
|
|
1f4395570c | ||
|
|
accf300c6c | ||
|
|
a0fd03d328 | ||
|
|
929e88b9d3 | ||
|
|
7bea919352 | ||
|
|
96b5892c31 | ||
|
|
b14aad7118 | ||
|
|
7321ca6768 | ||
|
|
cd6485f2ed | ||
|
|
7bcad37568 | ||
|
|
ba8075a9fd | ||
|
|
3bad3837b4 | ||
|
|
084ebe5035 | ||
|
|
d480b674ca | ||
|
|
10e30eec57 | ||
|
|
38b6b0ac40 | ||
|
|
503efdd0d8 | ||
|
|
75e10688d4 | ||
|
|
ec88a52fe2 | ||
|
|
a28deae569 | ||
|
|
cf51503a54 | ||
|
|
aa42751743 | ||
|
|
9a53880b9b | ||
|
|
a3b51220ed | ||
|
|
17fce1cf78 | ||
|
|
9f3f8cc5bd | ||
|
|
0524980cb4 | ||
|
|
a0f5907cb6 | ||
|
|
0a9784d09d | ||
|
|
120e063a10 | ||
|
|
f59ef4422a | ||
|
|
417c9cf092 | ||
|
|
852825a97e | ||
|
|
cce12508cc | ||
|
|
43f9a4c0e1 | ||
|
|
ee5c02f72a | ||
|
|
55fa5cc851 | ||
|
|
b70811dcb9 | ||
|
|
3c1405719c | ||
|
|
f6befb4567 | ||
|
|
62aef5a240 | ||
|
|
4f508d320a | ||
|
|
29f1434270 | ||
|
|
27f3af8221 | ||
|
|
cb849b287c | ||
|
|
8630fd20ad | ||
|
|
0057cf5377 |
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
@@ -2,7 +2,7 @@ name: build
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
client:
|
client:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -15,12 +15,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install libdecor PPA
|
|
||||||
run: sudo add-apt-repository ppa:christianrauch/libdecoration
|
|
||||||
if: ${{ matrix.wayland_shell == 'libdecor' }}
|
|
||||||
- name: Install PipeWire repository
|
|
||||||
run: |
|
|
||||||
echo 'deb [trusted=yes] https://pipewire-ubuntu.quantum5.workers.dev ./' | sudo tee /etc/apt/sources.list.d/pipewire.list
|
|
||||||
- name: Update apt
|
- name: Update apt
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
@@ -32,6 +26,7 @@ jobs:
|
|||||||
libgl-dev libgles-dev \
|
libgl-dev libgles-dev \
|
||||||
libx11-dev libxss-dev libxi-dev libxinerama-dev libxcursor-dev libxpresent-dev \
|
libx11-dev libxss-dev libxi-dev libxinerama-dev libxcursor-dev libxpresent-dev \
|
||||||
libwayland-dev libxkbcommon-dev \
|
libwayland-dev libxkbcommon-dev \
|
||||||
|
libfontconfig-dev \
|
||||||
libsamplerate0-dev libpipewire-0.3-dev libpulse-dev \
|
libsamplerate0-dev libpipewire-0.3-dev libpulse-dev \
|
||||||
$([ '${{ matrix.wayland_shell }}' = libdecor ] && echo 'libdecor-0-dev libdbus-1-dev') \
|
$([ '${{ matrix.wayland_shell }}' = libdecor ] && echo 'libdecor-0-dev libdbus-1-dev') \
|
||||||
$([ '${{ matrix.compiler.cc }}' = clang ] && echo 'clang-tools')
|
$([ '${{ matrix.compiler.cc }}' = clang ] && echo 'clang-tools')
|
||||||
@@ -76,16 +71,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install PipeWire repository
|
|
||||||
run: |
|
|
||||||
echo 'deb [trusted=yes] https://pipewire-ubuntu.quantum5.workers.dev ./' | sudo tee /etc/apt/sources.list.d/pipewire.list
|
|
||||||
- name: Update apt
|
- name: Update apt
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
- name: Install Linux host dependencies
|
- name: Install Linux host dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install binutils-dev libxcb-xfixes0-dev \
|
sudo apt-get install binutils-dev libglib2.0-dev libxcb-xfixes0-dev \
|
||||||
libpipewire-0.3-dev
|
libpipewire-0.3-dev libxcb-shm0-dev
|
||||||
- name: Configure Linux host
|
- name: Configure Linux host
|
||||||
run: |
|
run: |
|
||||||
mkdir host/build
|
mkdir host/build
|
||||||
|
|||||||
22
.github/workflows/pr-check.yml
vendored
22
.github/workflows/pr-check.yml
vendored
@@ -3,16 +3,36 @@ on: pull_request
|
|||||||
jobs:
|
jobs:
|
||||||
authors:
|
authors:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Check AUTHORS file
|
- name: Check AUTHORS file
|
||||||
|
id: check-authors
|
||||||
run: |
|
run: |
|
||||||
user="$(curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -s https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} | jq -r .user.login)"
|
user="$(curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -s https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} | jq -r .user.login)"
|
||||||
|
echo "user=$user" >> "$GITHUB_OUTPUT"
|
||||||
echo "Checking if GitHub user $user is in AUTHORS file..."
|
echo "Checking if GitHub user $user is in AUTHORS file..."
|
||||||
if grep -q -E '> \('"$user"'\)' AUTHORS; then
|
if grep -q -E '> \('"$user"'\)' AUTHORS; then
|
||||||
echo "$user found in AUTHORS file, all good!"
|
echo "$user found in AUTHORS file, all good!"
|
||||||
else
|
else
|
||||||
echo "$user not found in AUTHORS file."
|
echo "$user not found in AUTHORS file."
|
||||||
echo "Please add yourself to the AUTHORS file and try again."
|
echo "Please add yourself to the AUTHORS file and try again."
|
||||||
exit 1
|
echo "not-found=yes" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
- name: 'Not found: Create review requesting changes'
|
||||||
|
if: ${{ steps.check-authors.outputs.not-found }}
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
github.rest.pulls.createReview({
|
||||||
|
owner: context.issue.owner,
|
||||||
|
repo: context.issue.repo,
|
||||||
|
pull_number: context.issue.number,
|
||||||
|
event: "REQUEST_CHANGES",
|
||||||
|
body: "@${{ steps.check-authors.outputs.user }} not found in AUTHORS file.\n" +
|
||||||
|
"Please add yourself to the AUTHORS file and try again."
|
||||||
|
});
|
||||||
|
- name: 'Not found: Fail job'
|
||||||
|
if: ${{ steps.check-authors.outputs.not-found }}
|
||||||
|
run: exit 1
|
||||||
|
|||||||
5
AUTHORS
5
AUTHORS
@@ -67,3 +67,8 @@ Daniel Cordero <looking-glass@0xdc.io> (0xdc)
|
|||||||
esi <git@esibun.net> (esibun)
|
esi <git@esibun.net> (esibun)
|
||||||
MakiseKurisu <saberconer@gmail.com> (MakiseKurisu)
|
MakiseKurisu <saberconer@gmail.com> (MakiseKurisu)
|
||||||
Zenithal <i@zenithal.me> (ZenithalHourlyRate)
|
Zenithal <i@zenithal.me> (ZenithalHourlyRate)
|
||||||
|
Kamplom <6284968128@protonmail.ch> (kamplom)
|
||||||
|
Jacob McNamee <jacob@jacobmcnamee.com> (jacobmcnamee)
|
||||||
|
Marco Antonio J. Costa <marco.antonio.costa@gmail.com> (majcosta)
|
||||||
|
rs189 <35667100+rs189@users.noreply.github.com> (rs189)
|
||||||
|
Jérôme Poulin <jeromepoulin@gmail.com> (ticpu)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(looking-glass-client C CXX)
|
project(looking-glass-client C CXX)
|
||||||
|
|
||||||
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||||
@@ -42,19 +42,12 @@ add_feature_info(ENABLE_ASAN ENABLE_ASAN "AddressSanitizer support.")
|
|||||||
option(ENABLE_UBSAN "Build with UndefinedBehaviorSanitizer" OFF)
|
option(ENABLE_UBSAN "Build with UndefinedBehaviorSanitizer" OFF)
|
||||||
add_feature_info(ENABLE_UBSAN ENABLE_UBSAN "UndefinedBehaviorSanitizer support.")
|
add_feature_info(ENABLE_UBSAN ENABLE_UBSAN "UndefinedBehaviorSanitizer support.")
|
||||||
|
|
||||||
option(ENABLE_X11 "Build with X11 support" ON)
|
|
||||||
add_feature_info(ENABLE_X11 ENABLE_X11 "X11 support.")
|
|
||||||
|
|
||||||
option(ENABLE_PIPEWIRE "Build with PipeWire audio output support" ON)
|
option(ENABLE_PIPEWIRE "Build with PipeWire audio output support" ON)
|
||||||
add_feature_info(ENABLE_PIPEWIRE ENABLE_PIPEWIRE "PipeWire audio support.")
|
add_feature_info(ENABLE_PIPEWIRE ENABLE_PIPEWIRE "PipeWire audio support.")
|
||||||
|
|
||||||
option(ENABLE_PULSEAUDIO "Build with PulseAudio audio output support" ON)
|
option(ENABLE_PULSEAUDIO "Build with PulseAudio audio output support" ON)
|
||||||
add_feature_info(ENABLE_PULSEAUDIO ENABLE_PULSEAUDIO "PulseAudio audio support.")
|
add_feature_info(ENABLE_PULSEAUDIO ENABLE_PULSEAUDIO "PulseAudio audio support.")
|
||||||
|
|
||||||
if (NOT ENABLE_X11 AND NOT ENABLE_WAYLAND)
|
|
||||||
message(FATAL_ERROR "Either ENABLE_X11 or ENABLE_WAYLAND must be on")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
"-Wall"
|
"-Wall"
|
||||||
"-Wextra"
|
"-Wextra"
|
||||||
@@ -144,6 +137,8 @@ set(SOURCES
|
|||||||
|
|
||||||
# Force cimgui to build as a static library.
|
# Force cimgui to build as a static library.
|
||||||
set(IMGUI_STATIC "yes" CACHE STRING "Build as a static library")
|
set(IMGUI_STATIC "yes" CACHE STRING "Build as a static library")
|
||||||
|
add_definitions("-DCIMGUI_USE_OPENGL2=1")
|
||||||
|
add_definitions("-DCIMGUI_USE_OPENGL3=1")
|
||||||
|
|
||||||
add_subdirectory("${PROJECT_TOP}/resources" "${CMAKE_BINARY_DIR}/resources")
|
add_subdirectory("${PROJECT_TOP}/resources" "${CMAKE_BINARY_DIR}/resources")
|
||||||
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common" )
|
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common" )
|
||||||
@@ -154,6 +149,7 @@ add_subdirectory("${PROJECT_TOP}/repos/cimgui" "${CMAKE_BINARY_DIR}/cimgui" E
|
|||||||
add_subdirectory(displayservers)
|
add_subdirectory(displayservers)
|
||||||
add_subdirectory(renderers)
|
add_subdirectory(renderers)
|
||||||
|
|
||||||
|
configure_file("${PROJECT_TOP}/resources/looking-glass-client.desktop.in" "${CMAKE_BINARY_DIR}/resources/looking-glass-client.desktop" @ONLY)
|
||||||
add_executable(looking-glass-client ${SOURCES})
|
add_executable(looking-glass-client ${SOURCES})
|
||||||
|
|
||||||
target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
|
target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
|
||||||
@@ -184,4 +180,10 @@ install(TARGETS looking-glass-client
|
|||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
COMPONENT binary)
|
COMPONENT binary)
|
||||||
|
|
||||||
|
install(FILES "${CMAKE_BINARY_DIR}/resources/looking-glass-client.desktop"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||||
|
install(FILES "${PROJECT_TOP}/resources/lg-logo.svg"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
|
||||||
|
RENAME "looking-glass.svg")
|
||||||
|
|
||||||
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(audiodevs LANGUAGES C)
|
project(audiodevs LANGUAGES C)
|
||||||
|
|
||||||
set(AUDIODEV_H "${CMAKE_BINARY_DIR}/include/dynamic/audiodev.h")
|
set(AUDIODEV_H "${CMAKE_BINARY_DIR}/include/dynamic/audiodev.h")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(audiodev_PipeWire LANGUAGES C)
|
project(audiodev_PipeWire LANGUAGES C)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -48,6 +48,7 @@ struct PipeWire
|
|||||||
{
|
{
|
||||||
struct pw_stream * stream;
|
struct pw_stream * stream;
|
||||||
struct spa_io_rate_match * rateMatch;
|
struct spa_io_rate_match * rateMatch;
|
||||||
|
struct pw_time time;
|
||||||
|
|
||||||
int channels;
|
int channels;
|
||||||
int sampleRate;
|
int sampleRate;
|
||||||
@@ -91,6 +92,14 @@ static void pipewire_onPlaybackProcess(void * userdata)
|
|||||||
{
|
{
|
||||||
struct pw_buffer * pbuf;
|
struct pw_buffer * pbuf;
|
||||||
|
|
||||||
|
#if PW_CHECK_VERSION(0, 3, 50)
|
||||||
|
if (pw_stream_get_time_n(pw.playback.stream, &pw.playback.time,
|
||||||
|
sizeof(pw.playback.time)) < 0)
|
||||||
|
#else
|
||||||
|
if (pw_stream_get_time(pw.playback.stream, &pw.playback.time) < 0)
|
||||||
|
#endif
|
||||||
|
DEBUG_ERROR("pw_stream_get_time failed");
|
||||||
|
|
||||||
if (!(pbuf = pw_stream_dequeue_buffer(pw.playback.stream)))
|
if (!(pbuf = pw_stream_dequeue_buffer(pw.playback.stream)))
|
||||||
{
|
{
|
||||||
DEBUG_WARN("out of buffers");
|
DEBUG_WARN("out of buffers");
|
||||||
@@ -115,6 +124,7 @@ static void pipewire_onPlaybackProcess(void * userdata)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pbuf->size = frames;
|
||||||
sbuf->datas[0].chunk->offset = 0;
|
sbuf->datas[0].chunk->offset = 0;
|
||||||
sbuf->datas[0].chunk->stride = pw.playback.stride;
|
sbuf->datas[0].chunk->stride = pw.playback.stride;
|
||||||
sbuf->datas[0].chunk->size = frames * pw.playback.stride;
|
sbuf->datas[0].chunk->size = frames * pw.playback.stride;
|
||||||
@@ -248,6 +258,7 @@ static void pipewire_playbackSetup(int channels, int sampleRate,
|
|||||||
|
|
||||||
struct pw_properties * props =
|
struct pw_properties * props =
|
||||||
pw_properties_new(
|
pw_properties_new(
|
||||||
|
PW_KEY_APP_NAME , "Looking Glass",
|
||||||
PW_KEY_NODE_NAME , "Looking Glass",
|
PW_KEY_NODE_NAME , "Looking Glass",
|
||||||
PW_KEY_MEDIA_TYPE , "Audio",
|
PW_KEY_MEDIA_TYPE , "Audio",
|
||||||
PW_KEY_MEDIA_CATEGORY, "Playback",
|
PW_KEY_MEDIA_CATEGORY, "Playback",
|
||||||
@@ -401,20 +412,32 @@ static void pipewire_playbackMute(bool mute)
|
|||||||
pw_thread_loop_unlock(pw.thread);
|
pw_thread_loop_unlock(pw.thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t pipewire_playbackLatency(void)
|
static uint64_t pipewire_playbackLatency(void)
|
||||||
{
|
{
|
||||||
struct pw_time time = { 0 };
|
|
||||||
|
|
||||||
pw_thread_loop_lock(pw.thread);
|
|
||||||
#if PW_CHECK_VERSION(0, 3, 50)
|
#if PW_CHECK_VERSION(0, 3, 50)
|
||||||
if (pw_stream_get_time_n(pw.playback.stream, &time, sizeof(time)) < 0)
|
if (pw.playback.time.rate.num == 0)
|
||||||
#else
|
return 0;
|
||||||
if (pw_stream_get_time(pw.playback.stream, &time) < 0)
|
|
||||||
#endif
|
|
||||||
DEBUG_ERROR("pw_stream_get_time failed");
|
|
||||||
pw_thread_loop_unlock(pw.thread);
|
|
||||||
|
|
||||||
return time.delay + time.queued / pw.playback.stride;
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
|
// diff in ns
|
||||||
|
int64_t diff = SPA_TIMESPEC_TO_NSEC(&ts) - pw.playback.time.now;
|
||||||
|
|
||||||
|
// elapsed frames
|
||||||
|
int64_t elapsed =
|
||||||
|
(pw.playback.time.rate.denom * diff) /
|
||||||
|
(pw.playback.time.rate.num * SPA_NSEC_PER_SEC);
|
||||||
|
|
||||||
|
const int64_t buffered = pw.playback.time.buffered + pw.playback.time.queued;
|
||||||
|
int64_t latency = (buffered * 1000 / pw.playback.sampleRate) +
|
||||||
|
((pw.playback.time.delay - elapsed) * 1000 *
|
||||||
|
pw.playback.time.rate.num / pw.playback.time.rate.denom);
|
||||||
|
|
||||||
|
return max(0, -latency);
|
||||||
|
#else
|
||||||
|
return pw.playback.time.delay + pw.playback.time.queued / pw.playback.stride;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pipewire_recordStopStream(void)
|
static void pipewire_recordStopStream(void)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(audiodev_PulseAudio LANGUAGES C)
|
project(audiodev_PulseAudio LANGUAGES C)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(displayservers LANGUAGES C)
|
project(displayservers LANGUAGES C)
|
||||||
|
|
||||||
set(DISPLAYSERVER_H "${CMAKE_BINARY_DIR}/include/dynamic/displayservers.h")
|
set(DISPLAYSERVER_H "${CMAKE_BINARY_DIR}/include/dynamic/displayservers.h")
|
||||||
@@ -18,9 +18,16 @@ function(add_displayserver name)
|
|||||||
add_subdirectory(${name})
|
add_subdirectory(${name})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
option(ENABLE_X11 "Build with X11 support" ON)
|
||||||
|
add_feature_info(ENABLE_X11 ENABLE_X11 "X11 support.")
|
||||||
|
|
||||||
option(ENABLE_WAYLAND "Build with Wayland support" ON)
|
option(ENABLE_WAYLAND "Build with Wayland support" ON)
|
||||||
add_feature_info(ENABLE_WAYLAND ENABLE_WAYLAND "Wayland support.")
|
add_feature_info(ENABLE_WAYLAND ENABLE_WAYLAND "Wayland support.")
|
||||||
|
|
||||||
|
if (NOT ENABLE_X11 AND NOT ENABLE_WAYLAND)
|
||||||
|
message(FATAL_ERROR "Either ENABLE_X11 or ENABLE_WAYLAND must be on")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add/remove displayservers here!
|
# Add/remove displayservers here!
|
||||||
if (ENABLE_WAYLAND)
|
if (ENABLE_WAYLAND)
|
||||||
add_displayserver(Wayland)
|
add_displayserver(Wayland)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(displayserver_Wayland LANGUAGES C)
|
project(displayserver_Wayland LANGUAGES C)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -475,6 +475,7 @@ void waylandCBRequest(LG_ClipboardData type)
|
|||||||
close(data->fd);
|
close(data->fd);
|
||||||
free(data->buf);
|
free(data->buf);
|
||||||
free(data);
|
free(data);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlCb.currentRead = data;
|
wlCb.currentRead = data;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(wayland_desktops LANGUAGES C)
|
project(wayland_desktops LANGUAGES C)
|
||||||
|
|
||||||
set(DESKTOP_H "${CMAKE_BINARY_DIR}/include/dynamic/wayland_desktops.h")
|
set(DESKTOP_H "${CMAKE_BINARY_DIR}/include/dynamic/wayland_desktops.h")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(wayland_desktop_libdecor LANGUAGES C)
|
project(wayland_desktop_libdecor LANGUAGES C)
|
||||||
|
|
||||||
add_library(wayland_desktop_libdecor STATIC
|
add_library(wayland_desktop_libdecor STATIC
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -130,17 +130,23 @@ static void libdecorCallback(uint32_t events, void * opaque)
|
|||||||
|
|
||||||
static bool libdecor_shellInit(
|
static bool libdecor_shellInit(
|
||||||
struct wl_display * display, struct wl_surface * surface,
|
struct wl_display * display, struct wl_surface * surface,
|
||||||
const char * title, bool fullscreen,
|
const char * title, const char * appId, bool fullscreen,
|
||||||
bool maximize, bool borderless, bool resizable)
|
bool maximize, bool borderless, bool resizable)
|
||||||
{
|
{
|
||||||
state.libdecor = libdecor_new(display, &libdecorListener);
|
state.libdecor = libdecor_new(display, &libdecorListener);
|
||||||
state.libdecorFrame = libdecor_decorate(state.libdecor, surface,
|
state.libdecorFrame = libdecor_decorate(state.libdecor, surface,
|
||||||
&libdecorFrameListener, NULL);
|
&libdecorFrameListener, NULL);
|
||||||
|
|
||||||
libdecor_frame_set_app_id(state.libdecorFrame, "looking-glass-client");
|
libdecor_frame_set_app_id(state.libdecorFrame, appId);
|
||||||
libdecor_frame_set_title(state.libdecorFrame, title);
|
libdecor_frame_set_title(state.libdecorFrame, title);
|
||||||
libdecor_frame_map(state.libdecorFrame);
|
libdecor_frame_map(state.libdecorFrame);
|
||||||
|
|
||||||
|
if (fullscreen)
|
||||||
|
libdecor_frame_set_fullscreen(state.libdecorFrame, NULL);
|
||||||
|
|
||||||
|
if (maximize)
|
||||||
|
libdecor_frame_set_maximized(state.libdecorFrame);
|
||||||
|
|
||||||
if (resizable)
|
if (resizable)
|
||||||
libdecor_frame_set_capabilities(state.libdecorFrame,
|
libdecor_frame_set_capabilities(state.libdecorFrame,
|
||||||
LIBDECOR_ACTION_RESIZE);
|
LIBDECOR_ACTION_RESIZE);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(wayland_desktop_xdg LANGUAGES C)
|
project(wayland_desktop_xdg LANGUAGES C)
|
||||||
|
|
||||||
add_library(wayland_desktop_xdg STATIC
|
add_library(wayland_desktop_xdg STATIC
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -130,7 +130,7 @@ static const struct xdg_toplevel_listener xdgToplevelListener = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool xdg_shellInit(struct wl_display * display, struct wl_surface * surface,
|
bool xdg_shellInit(struct wl_display * display, struct wl_surface * surface,
|
||||||
const char * title, bool fullscreen, bool maximize, bool borderless,
|
const char * title, const char * appId, bool fullscreen, bool maximize, bool borderless,
|
||||||
bool resizable)
|
bool resizable)
|
||||||
{
|
{
|
||||||
if (!state.wmBase)
|
if (!state.wmBase)
|
||||||
@@ -147,7 +147,7 @@ bool xdg_shellInit(struct wl_display * display, struct wl_surface * surface,
|
|||||||
state.toplevel = xdg_surface_get_toplevel(state.surface);
|
state.toplevel = xdg_surface_get_toplevel(state.surface);
|
||||||
xdg_toplevel_add_listener(state.toplevel, &xdgToplevelListener, NULL);
|
xdg_toplevel_add_listener(state.toplevel, &xdgToplevelListener, NULL);
|
||||||
xdg_toplevel_set_title(state.toplevel, title);
|
xdg_toplevel_set_title(state.toplevel, title);
|
||||||
xdg_toplevel_set_app_id(state.toplevel, "looking-glass-client");
|
xdg_toplevel_set_app_id(state.toplevel, appId);
|
||||||
|
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
xdg_toplevel_set_fullscreen(state.toplevel, NULL);
|
xdg_toplevel_set_fullscreen(state.toplevel, NULL);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -102,7 +102,11 @@ void waylandEGLSwapBuffers(EGLDisplay display, EGLSurface surface, const struct
|
|||||||
wl_surface_set_buffer_scale(wlWm.surface, 1);
|
wl_surface_set_buffer_scale(wlWm.surface, 1);
|
||||||
if (!wlWm.viewport)
|
if (!wlWm.viewport)
|
||||||
wlWm.viewport = wp_viewporter_get_viewport(wlWm.viewporter, wlWm.surface);
|
wlWm.viewport = wp_viewporter_get_viewport(wlWm.viewporter, wlWm.surface);
|
||||||
wp_viewport_set_source(wlWm.viewport, 0, 0, width * wlWm.scale, height * wlWm.scale);
|
wp_viewport_set_source(
|
||||||
|
wlWm.viewport,
|
||||||
|
wl_fixed_from_int(-1), wl_fixed_from_int(-1),
|
||||||
|
wl_fixed_from_int(-1), wl_fixed_from_int(-1)
|
||||||
|
);
|
||||||
wp_viewport_set_destination(wlWm.viewport, width, height);
|
wp_viewport_set_destination(wlWm.viewport, width, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -34,7 +34,7 @@ typedef struct WL_DesktopOps
|
|||||||
|
|
||||||
bool (*shellInit)(
|
bool (*shellInit)(
|
||||||
struct wl_display * display, struct wl_surface * surface,
|
struct wl_display * display, struct wl_surface * surface,
|
||||||
const char * title, bool fullscreen, bool maximize,
|
const char * title, const char * appId, bool fullscreen, bool maximize,
|
||||||
bool borderless, bool resizable);
|
bool borderless, bool resizable);
|
||||||
|
|
||||||
void (*shellAckConfigureIfNeeded)(void);
|
void (*shellAckConfigureIfNeeded)(void);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -109,10 +109,17 @@ void waylandPresentationFrame(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
struct FrameData * data = malloc(sizeof(*data));
|
struct FrameData * data = malloc(sizeof(*data));
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("out of memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (clock_gettime(wlWm.clkId, &data->sent))
|
if (clock_gettime(wlWm.clkId, &data->sent))
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("clock_gettime failed: %s\n", strerror(errno));
|
DEBUG_ERROR("clock_gettime failed: %s\n", strerror(errno));
|
||||||
free(data);
|
free(data);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wp_presentation_feedback * feedback = wp_presentation_feedback(wlWm.presentation, wlWm.surface);
|
struct wp_presentation_feedback * feedback = wp_presentation_feedback(wlWm.presentation, wlWm.surface);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(wayland_protocol LANGUAGES C)
|
project(wayland_protocol LANGUAGES C)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -121,7 +121,7 @@ static bool waylandInit(const LG_DSInitParams params)
|
|||||||
for(int i = 0; i < WL_DESKTOP_COUNT; ++i)
|
for(int i = 0; i < WL_DESKTOP_COUNT; ++i)
|
||||||
if (strcmp(WL_Desktops[i]->compositor, compositor) == 0)
|
if (strcmp(WL_Desktops[i]->compositor, compositor) == 0)
|
||||||
{
|
{
|
||||||
wlWm.desktop = WL_Desktops[0];
|
wlWm.desktop = WL_Desktops[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ static bool waylandInit(const LG_DSInitParams params)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
wlWm.desktop->setSize(params.w, params.h);
|
wlWm.desktop->setSize(params.w, params.h);
|
||||||
if (!waylandWindowInit(params.title, params.fullscreen, params.maximize,
|
if (!waylandWindowInit(params.title, params.appId, params.fullscreen, params.maximize,
|
||||||
params.borderless, params.resizable))
|
params.borderless, params.resizable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -301,7 +301,7 @@ bool waylandRegistryInit(void);
|
|||||||
void waylandRegistryFree(void);
|
void waylandRegistryFree(void);
|
||||||
|
|
||||||
// window module
|
// window module
|
||||||
bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool borderless, bool resizable);
|
bool waylandWindowInit(const char * title, const char * appId, bool fullscreen, bool maximize, bool borderless, bool resizable);
|
||||||
void waylandWindowFree(void);
|
void waylandWindowFree(void);
|
||||||
void waylandWindowUpdateScale(void);
|
void waylandWindowUpdateScale(void);
|
||||||
void waylandSetWindowSize(int x, int y);
|
void waylandSetWindowSize(int x, int y);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -85,7 +85,7 @@ static const struct wl_surface_listener wlSurfaceListener = {
|
|||||||
.leave = wlSurfaceLeaveHandler,
|
.leave = wlSurfaceLeaveHandler,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool borderless, bool resizable)
|
bool waylandWindowInit(const char * title, const char * appId, bool fullscreen, bool maximize, bool borderless, bool resizable)
|
||||||
{
|
{
|
||||||
wlWm.scale = wl_fixed_from_int(1);
|
wlWm.scale = wl_fixed_from_int(1);
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ bool waylandWindowInit(const char * title, bool fullscreen, bool maximize, bool
|
|||||||
wl_surface_add_listener(wlWm.surface, &wlSurfaceListener, NULL);
|
wl_surface_add_listener(wlWm.surface, &wlSurfaceListener, NULL);
|
||||||
|
|
||||||
if (!wlWm.desktop->shellInit(wlWm.display, wlWm.surface,
|
if (!wlWm.desktop->shellInit(wlWm.display, wlWm.surface,
|
||||||
title, fullscreen, maximize, borderless, resizable))
|
title, appId, fullscreen, maximize, borderless, resizable))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wl_surface_commit(wlWm.surface);
|
wl_surface_commit(wlWm.surface);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(displayserver_X11 LANGUAGES C)
|
project(displayserver_X11 LANGUAGES C)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -60,40 +60,40 @@ static void x11CBSelectionIncr(const XPropertyEvent e);
|
|||||||
static void x11CBSelectionNotify(const XSelectionEvent e);
|
static void x11CBSelectionNotify(const XSelectionEvent e);
|
||||||
static void x11CBXFixesSelectionNotify(const XFixesSelectionNotifyEvent e);
|
static void x11CBXFixesSelectionNotify(const XFixesSelectionNotifyEvent e);
|
||||||
|
|
||||||
bool x11CBEventThread(const XEvent xe)
|
bool x11CBEventThread(const XEvent * xe)
|
||||||
{
|
{
|
||||||
switch(xe.type)
|
switch(xe->type)
|
||||||
{
|
{
|
||||||
case SelectionRequest:
|
case SelectionRequest:
|
||||||
x11CBSelectionRequest(xe.xselectionrequest);
|
x11CBSelectionRequest(xe->xselectionrequest);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SelectionClear:
|
case SelectionClear:
|
||||||
x11CBSelectionClear(xe.xselectionclear);
|
x11CBSelectionClear(xe->xselectionclear);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case SelectionNotify:
|
case SelectionNotify:
|
||||||
x11CBSelectionNotify(xe.xselection);
|
x11CBSelectionNotify(xe->xselection);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case PropertyNotify:
|
case PropertyNotify:
|
||||||
if (xe.xproperty.state != PropertyNewValue)
|
if (xe->xproperty.state != PropertyNewValue)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (xe.xproperty.atom == x11atoms.SEL_DATA)
|
if (xe->xproperty.atom == x11atoms.SEL_DATA)
|
||||||
{
|
{
|
||||||
if (x11cb.lowerBound == 0)
|
if (x11cb.lowerBound == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
x11CBSelectionIncr(xe.xproperty);
|
x11CBSelectionIncr(xe->xproperty);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (xe.type == x11.eventBase + XFixesSelectionNotify)
|
if (xe->type == x11.eventBase + XFixesSelectionNotify)
|
||||||
{
|
{
|
||||||
XFixesSelectionNotifyEvent * sne = (XFixesSelectionNotifyEvent *)&xe;
|
XFixesSelectionNotifyEvent * sne = (XFixesSelectionNotifyEvent *)xe;
|
||||||
x11CBXFixesSelectionNotify(*sne);
|
x11CBXFixesSelectionNotify(*sne);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "interface/displayserver.h"
|
#include "interface/displayserver.h"
|
||||||
|
|
||||||
bool x11CBEventThread(const XEvent xe);
|
bool x11CBEventThread(const XEvent * xe);
|
||||||
|
|
||||||
bool x11CBInit(void);
|
bool x11CBInit(void);
|
||||||
void x11CBNotice(LG_ClipboardData type);
|
void x11CBNotice(LG_ClipboardData type);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -71,9 +71,9 @@ static bool wm_i3_init(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||||
char path[sizeof(addr.sun_path)];
|
char * path = (char *)&addr.sun_path;
|
||||||
int pathLen;
|
int pathLen;
|
||||||
if ((pathLen = fread(path, 1, sizeof(path), fd)) <= 0)
|
if ((pathLen = fread(path, 1, sizeof(addr.sun_path), fd)) <= 0)
|
||||||
{
|
{
|
||||||
pclose(fd);
|
pclose(fd);
|
||||||
return false;
|
return false;
|
||||||
@@ -91,7 +91,6 @@ static bool wm_i3_init(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(addr.sun_path, path, sizeof(addr.sun_path));
|
|
||||||
if (connect(i3.sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
if (connect(i3.sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to connect to the i3 IPC socket");
|
DEBUG_ERROR("Failed to connect to the i3 IPC socket");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -229,7 +229,7 @@ static void x11CheckEWMHSupport(void)
|
|||||||
x11.ewmhHasFocusEvent = true;
|
x11.ewmhHasFocusEvent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_INFO("EWMH-complient window manager detected: %s", wmName);
|
DEBUG_INFO("EWMH-compliant window manager detected: %s", wmName);
|
||||||
x11.ewmhSupport = true;
|
x11.ewmhSupport = true;
|
||||||
|
|
||||||
if (strcmp(wmName, "i3") == 0)
|
if (strcmp(wmName, "i3") == 0)
|
||||||
@@ -343,7 +343,7 @@ static bool x11Init(const LG_DSInitParams params)
|
|||||||
XClassHint hint =
|
XClassHint hint =
|
||||||
{
|
{
|
||||||
.res_name = strdup(params.title),
|
.res_name = strdup(params.title),
|
||||||
.res_class = strdup("looking-glass-client")
|
.res_class = strdup(params.appId)
|
||||||
};
|
};
|
||||||
XSetClassHint(x11.display, x11.window, &hint);
|
XSetClassHint(x11.display, x11.window, &hint);
|
||||||
free(hint.res_name);
|
free(hint.res_name);
|
||||||
@@ -699,7 +699,7 @@ static bool x11Init(const LG_DSInitParams params)
|
|||||||
XMoveWindow(x11.display, x11.window, params.x, params.y);
|
XMoveWindow(x11.display, x11.window, params.x, params.y);
|
||||||
|
|
||||||
if (params.fullscreen)
|
if (params.fullscreen)
|
||||||
x11SetFullscreen(true);
|
x11.doFullscreenOnExpose = true;
|
||||||
|
|
||||||
XSetLocaleModifiers(""); // Load XMODIFIERS
|
XSetLocaleModifiers(""); // Load XMODIFIERS
|
||||||
x11.xim = XOpenIM(x11.display, 0, 0, 0);
|
x11.xim = XOpenIM(x11.display, 0, 0, 0);
|
||||||
@@ -897,7 +897,7 @@ static int x11EventThread(void * unused)
|
|||||||
XNextEvent(x11.display, &xe);
|
XNextEvent(x11.display, &xe);
|
||||||
|
|
||||||
// call the clipboard handling code
|
// call the clipboard handling code
|
||||||
if (x11CBEventThread(xe))
|
if (x11CBEventThread(&xe))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(xe.type)
|
switch(xe.type)
|
||||||
@@ -946,6 +946,11 @@ static int x11EventThread(void * unused)
|
|||||||
{
|
{
|
||||||
atomic_store(&x11.lastWMEvent, microtime());
|
atomic_store(&x11.lastWMEvent, microtime());
|
||||||
x11.invalidateAll = true;
|
x11.invalidateAll = true;
|
||||||
|
if (x11.doFullscreenOnExpose)
|
||||||
|
{
|
||||||
|
x11SetFullscreen(true);
|
||||||
|
x11.doFullscreenOnExpose = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -71,6 +71,7 @@ struct X11DSState
|
|||||||
|
|
||||||
_Atomic(uint64_t) lastWMEvent;
|
_Atomic(uint64_t) lastWMEvent;
|
||||||
bool invalidateAll;
|
bool invalidateAll;
|
||||||
|
bool doFullscreenOnExpose;
|
||||||
|
|
||||||
int xpresentOp;
|
int xpresentOp;
|
||||||
bool jitRender;
|
bool jitRender;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -84,6 +84,7 @@ LG_DSPointer;
|
|||||||
typedef struct LG_DSInitParams
|
typedef struct LG_DSInitParams
|
||||||
{
|
{
|
||||||
const char * title;
|
const char * title;
|
||||||
|
const char * appId;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
bool center;
|
bool center;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(renderers LANGUAGES C)
|
project(renderers LANGUAGES C)
|
||||||
|
|
||||||
set(RENDERER_H "${CMAKE_BINARY_DIR}/include/dynamic/renderers.h")
|
set(RENDERER_H "${CMAKE_BINARY_DIR}/include/dynamic/renderers.h")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(renderer_EGL LANGUAGES C CXX)
|
project(renderer_EGL LANGUAGES C CXX)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -346,11 +346,6 @@ bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)
|
|||||||
|
|
||||||
case FRAME_TYPE_RGB_24:
|
case FRAME_TYPE_RGB_24:
|
||||||
pixFmt = EGL_PF_RGB_24;
|
pixFmt = EGL_PF_RGB_24;
|
||||||
// the data width is correct per the format, but we are going to use a
|
|
||||||
// 32-bit texture to load the data, so we need to alter the width for the
|
|
||||||
// different bpp
|
|
||||||
desktop->format.dataWidth =
|
|
||||||
desktop->format.pitch / 4;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -382,9 +377,9 @@ bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format)
|
|||||||
bool egl_desktopUpdate(EGL_Desktop * desktop, const FrameBuffer * frame, int dmaFd,
|
bool egl_desktopUpdate(EGL_Desktop * desktop, const FrameBuffer * frame, int dmaFd,
|
||||||
const FrameDamageRect * damageRects, int damageRectsCount)
|
const FrameDamageRect * damageRects, int damageRectsCount)
|
||||||
{
|
{
|
||||||
if (desktop->useDMA && dmaFd >= 0)
|
if (likely(desktop->useDMA && dmaFd >= 0))
|
||||||
{
|
{
|
||||||
if (egl_textureUpdateFromDMA(desktop->texture, frame, dmaFd))
|
if (likely(egl_textureUpdateFromDMA(desktop->texture, frame, dmaFd)))
|
||||||
{
|
{
|
||||||
atomic_store(&desktop->processFrame, true);
|
atomic_store(&desktop->processFrame, true);
|
||||||
return true;
|
return true;
|
||||||
@@ -420,8 +415,8 @@ bool egl_desktopUpdate(EGL_Desktop * desktop, const FrameBuffer * frame, int dma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (egl_textureUpdateFromFrame(desktop->texture, frame,
|
if (likely(egl_textureUpdateFromFrame(desktop->texture, frame,
|
||||||
damageRects, damageRectsCount))
|
damageRects, damageRectsCount)))
|
||||||
{
|
{
|
||||||
atomic_store(&desktop->processFrame, true);
|
atomic_store(&desktop->processFrame, true);
|
||||||
return true;
|
return true;
|
||||||
@@ -442,25 +437,28 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
|
|||||||
{
|
{
|
||||||
EGL_Texture * tex;
|
EGL_Texture * tex;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
bool dma;
|
||||||
|
|
||||||
if (desktop->useSpice)
|
if (unlikely(desktop->useSpice))
|
||||||
{
|
{
|
||||||
tex = desktop->spiceTexture;
|
tex = desktop->spiceTexture;
|
||||||
width = desktop->spiceWidth;
|
width = desktop->spiceWidth;
|
||||||
height = desktop->spiceHeight;
|
height = desktop->spiceHeight;
|
||||||
|
dma = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tex = desktop->texture;
|
tex = desktop->texture;
|
||||||
width = desktop->width;
|
width = desktop->width;
|
||||||
height = desktop->height;
|
height = desktop->height;
|
||||||
|
dma = desktop->useDMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outputWidth == 0 && outputHeight == 0)
|
if (unlikely(outputWidth == 0 || outputHeight == 0))
|
||||||
DEBUG_FATAL("outputWidth || outputHeight == 0");
|
DEBUG_FATAL("outputWidth || outputHeight == 0");
|
||||||
|
|
||||||
enum EGL_TexStatus status;
|
enum EGL_TexStatus status;
|
||||||
if ((status = egl_textureProcess(tex)) != EGL_TEX_STATUS_OK)
|
if (unlikely((status = egl_textureProcess(tex)) != EGL_TEX_STATUS_OK))
|
||||||
{
|
{
|
||||||
if (status != EGL_TEX_STATUS_NOTREADY)
|
if (status != EGL_TEX_STATUS_NOTREADY)
|
||||||
DEBUG_ERROR("Failed to process the desktop texture");
|
DEBUG_ERROR("Failed to process the desktop texture");
|
||||||
@@ -475,7 +473,7 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
|
|||||||
if (atomic_exchange(&desktop->processFrame, false) ||
|
if (atomic_exchange(&desktop->processFrame, false) ||
|
||||||
egl_postProcessConfigModified(desktop->pp))
|
egl_postProcessConfigModified(desktop->pp))
|
||||||
egl_postProcessRun(desktop->pp, tex, desktop->mesh,
|
egl_postProcessRun(desktop->pp, tex, desktop->mesh,
|
||||||
width, height, outputWidth, outputHeight, desktop->useDMA);
|
width, height, outputWidth, outputHeight, dma);
|
||||||
|
|
||||||
unsigned int finalSizeX, finalSizeY;
|
unsigned int finalSizeX, finalSizeY;
|
||||||
EGL_Texture * texture = egl_postProcessGetOutput(desktop->pp,
|
EGL_Texture * texture = egl_postProcessGetOutput(desktop->pp,
|
||||||
@@ -515,7 +513,7 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth,
|
|||||||
&desktop->dmaShader : &desktop->shader;
|
&desktop->dmaShader : &desktop->shader;
|
||||||
|
|
||||||
const float mapHDRGain =
|
const float mapHDRGain =
|
||||||
desktop->maxCLL / desktop->peakLuminance;
|
(float)desktop->maxCLL / desktop->peakLuminance;
|
||||||
|
|
||||||
EGL_Uniform uniforms[] =
|
EGL_Uniform uniforms[] =
|
||||||
{
|
{
|
||||||
@@ -611,9 +609,9 @@ void egl_desktopSpiceDrawFill(EGL_Desktop * desktop, int x, int y, int width,
|
|||||||
for(int x = 0; x < width; ++x)
|
for(int x = 0; x < width; ++x)
|
||||||
line[x] = color;
|
line[x] = color;
|
||||||
|
|
||||||
for(; y < height; ++y)
|
for(int dy = 0; dy < height; ++dy)
|
||||||
egl_textureUpdateRect(desktop->spiceTexture,
|
egl_textureUpdateRect(desktop->spiceTexture,
|
||||||
x, y, width, 1, width, sizeof(line), (uint8_t *)line, false);
|
x, y + dy, width, 1, width, sizeof(line), (uint8_t *)line, false);
|
||||||
|
|
||||||
atomic_store(&desktop->processFrame, true);
|
atomic_store(&desktop->processFrame, true);
|
||||||
}
|
}
|
||||||
@@ -629,4 +627,5 @@ void egl_desktopSpiceDrawBitmap(EGL_Desktop * desktop, int x, int y, int width,
|
|||||||
void egl_desktopSpiceShow(EGL_Desktop * desktop, bool show)
|
void egl_desktopSpiceShow(EGL_Desktop * desktop, bool show)
|
||||||
{
|
{
|
||||||
desktop->useSpice = show;
|
desktop->useSpice = show;
|
||||||
|
atomic_store(&desktop->processFrame, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -296,7 +296,7 @@ bool egl_screenToDesktop(struct FrameDamageRect * output, const double matrix[6]
|
|||||||
|
|
||||||
void egl_desktopRectsRender(EGL_DesktopRects * rects)
|
void egl_desktopRectsRender(EGL_DesktopRects * rects)
|
||||||
{
|
{
|
||||||
if (!rects->count)
|
if (unlikely(!rects->count))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glBindVertexArray(rects->vao);
|
glBindVertexArray(rects->vao);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "interface/renderer.h"
|
#include "interface/renderer.h"
|
||||||
|
|
||||||
|
#include "common/util.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/KVMFR.h"
|
#include "common/KVMFR.h"
|
||||||
#include "common/option.h"
|
#include "common/option.h"
|
||||||
@@ -580,7 +581,7 @@ static bool egl_onFrameFormat(LG_Renderer * renderer, const LG_RendererFormat fo
|
|||||||
this->formatValid = true;
|
this->formatValid = true;
|
||||||
|
|
||||||
/* this event runs in a second thread so we need to init it here */
|
/* this event runs in a second thread so we need to init it here */
|
||||||
if (!this->frameContext)
|
if (unlikely(!this->frameContext))
|
||||||
{
|
{
|
||||||
static EGLint attrs[] = {
|
static EGLint attrs[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||||
@@ -600,7 +601,7 @@ static bool egl_onFrameFormat(LG_Renderer * renderer, const LG_RendererFormat fo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->scalePointer)
|
if (likely(this->scalePointer))
|
||||||
{
|
{
|
||||||
float scale = max(1.0f, (float)format.screenWidth / this->width);
|
float scale = max(1.0f, (float)format.screenWidth / this->width);
|
||||||
egl_cursorSetScale(this->cursor, scale);
|
egl_cursorSetScale(this->cursor, scale);
|
||||||
@@ -623,7 +624,8 @@ static bool egl_onFrame(LG_Renderer * renderer, const FrameBuffer * frame, int d
|
|||||||
struct Inst * this = UPCAST(struct Inst, renderer);
|
struct Inst * this = UPCAST(struct Inst, renderer);
|
||||||
|
|
||||||
uint64_t start = nanotime();
|
uint64_t start = nanotime();
|
||||||
if (!egl_desktopUpdate(this->desktop, frame, dmaFd, damageRects, damageRectsCount))
|
if (unlikely(!egl_desktopUpdate(
|
||||||
|
this->desktop, frame, dmaFd, damageRects, damageRectsCount)))
|
||||||
{
|
{
|
||||||
DEBUG_INFO("Failed to to update the desktop");
|
DEBUG_INFO("Failed to to update the desktop");
|
||||||
return false;
|
return false;
|
||||||
@@ -632,12 +634,17 @@ static bool egl_onFrame(LG_Renderer * renderer, const FrameBuffer * frame, int d
|
|||||||
|
|
||||||
INTERLOCKED_SECTION(this->desktopDamageLock, {
|
INTERLOCKED_SECTION(this->desktopDamageLock, {
|
||||||
struct DesktopDamage * damage = this->desktopDamage + this->desktopDamageIdx;
|
struct DesktopDamage * damage = this->desktopDamage + this->desktopDamageIdx;
|
||||||
if (damage->count == -1 || damageRectsCount == 0 ||
|
if (unlikely(
|
||||||
damage->count + damageRectsCount >= KVMFR_MAX_DAMAGE_RECTS)
|
damage->count == -1 ||
|
||||||
|
damageRectsCount == 0 ||
|
||||||
|
damage->count + damageRectsCount >= KVMFR_MAX_DAMAGE_RECTS))
|
||||||
|
{
|
||||||
damage->count = -1;
|
damage->count = -1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memcpy(damage->rects + damage->count, damageRects, damageRectsCount * sizeof(FrameDamageRect));
|
memcpy(damage->rects + damage->count, damageRects,
|
||||||
|
damageRectsCount * sizeof(FrameDamageRect));
|
||||||
damage->count += damageRectsCount;
|
damage->count += damageRectsCount;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1056,14 +1063,14 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
|
|||||||
accumulated->count = 0;
|
accumulated->count = 0;
|
||||||
|
|
||||||
INTERLOCKED_SECTION(this->desktopDamageLock, {
|
INTERLOCKED_SECTION(this->desktopDamageLock, {
|
||||||
if (!renderAll)
|
if (likely(!renderAll))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < bufferAge; ++i)
|
for (int i = 0; i < bufferAge; ++i)
|
||||||
{
|
{
|
||||||
struct DesktopDamage * damage = this->desktopDamage +
|
struct DesktopDamage * damage = this->desktopDamage +
|
||||||
IDX_AGO(this->desktopDamageIdx, i, DESKTOP_DAMAGE_COUNT);
|
IDX_AGO(this->desktopDamageIdx, i, DESKTOP_DAMAGE_COUNT);
|
||||||
|
|
||||||
if (damage->count < 0)
|
if (unlikely(damage->count < 0))
|
||||||
{
|
{
|
||||||
renderAll = true;
|
renderAll = true;
|
||||||
break;
|
break;
|
||||||
@@ -1087,7 +1094,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
|
|||||||
this->desktopDamage[this->desktopDamageIdx].count = 0;
|
this->desktopDamage[this->desktopDamageIdx].count = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!renderAll)
|
if (likely(!renderAll))
|
||||||
{
|
{
|
||||||
double matrix[6];
|
double matrix[6];
|
||||||
egl_screenToDesktopMatrix(matrix,
|
egl_screenToDesktopMatrix(matrix,
|
||||||
@@ -1101,7 +1108,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
|
|||||||
int count = this->overlayHistoryCount[idx];
|
int count = this->overlayHistoryCount[idx];
|
||||||
struct Rect * damage = this->overlayHistory[idx];
|
struct Rect * damage = this->overlayHistory[idx];
|
||||||
|
|
||||||
if (count < 0)
|
if (unlikely(count < 0))
|
||||||
{
|
{
|
||||||
renderAll = true;
|
renderAll = true;
|
||||||
break;
|
break;
|
||||||
@@ -1114,11 +1121,12 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
accumulated->count = rectsMergeOverlapping(accumulated->rects, accumulated->count);
|
accumulated->count = rectsMergeOverlapping(accumulated->rects,
|
||||||
|
accumulated->count);
|
||||||
}
|
}
|
||||||
++this->overlayHistoryIdx;
|
++this->overlayHistoryIdx;
|
||||||
|
|
||||||
if (this->destRect.w > 0 && this->destRect.h > 0)
|
if (likely(this->destRect.w > 0 && this->destRect.h > 0))
|
||||||
{
|
{
|
||||||
if (egl_desktopRender(this->desktop,
|
if (egl_desktopRender(this->desktop,
|
||||||
this->destRect.w, this->destRect.h,
|
this->destRect.w, this->destRect.h,
|
||||||
@@ -1136,41 +1144,39 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
|
|||||||
|
|
||||||
renderLetterBox(this);
|
renderLetterBox(this);
|
||||||
|
|
||||||
hasOverlay |= egl_damageRender(this->damage, rotate, newFrame ? desktopDamage : NULL);
|
hasOverlay |=
|
||||||
hasOverlay |= invalidateWindow;
|
egl_damageRender(this->damage, rotate, newFrame ? desktopDamage : NULL) |
|
||||||
|
invalidateWindow;
|
||||||
|
|
||||||
struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2];
|
struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2];
|
||||||
int damageIdx = app_renderOverlay(damage, MAX_OVERLAY_RECTS);
|
int damageIdx = app_renderOverlay(damage, MAX_OVERLAY_RECTS);
|
||||||
|
if (unlikely(damageIdx != 0))
|
||||||
switch (damageIdx)
|
|
||||||
{
|
{
|
||||||
case 0: // no overlay
|
if (damageIdx == -1)
|
||||||
break;
|
|
||||||
case -1: // full damage
|
|
||||||
hasOverlay = true;
|
hasOverlay = true;
|
||||||
// fallthrough
|
|
||||||
default:
|
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
|
||||||
|
|
||||||
for (int i = 0; i < damageIdx; ++i)
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
damage[i].y = this->height - damage[i].y - damage[i].h;
|
ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
||||||
|
|
||||||
|
for (int i = 0; i < damageIdx; ++i)
|
||||||
|
damage[i].y = this->height - damage[i].y - damage[i].h;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damageIdx >= 0 && cursorState.visible)
|
if (likely(damageIdx >= 0 && cursorState.visible))
|
||||||
damage[damageIdx++] = cursorState.rect;
|
damage[damageIdx++] = cursorState.rect;
|
||||||
|
|
||||||
int overlayHistoryIdx = this->overlayHistoryIdx % DESKTOP_DAMAGE_COUNT;
|
int overlayHistoryIdx = this->overlayHistoryIdx % DESKTOP_DAMAGE_COUNT;
|
||||||
if (hasOverlay)
|
if (unlikely(hasOverlay))
|
||||||
this->overlayHistoryCount[overlayHistoryIdx] = -1;
|
this->overlayHistoryCount[overlayHistoryIdx] = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (damageIdx > 0)
|
if (unlikely(damageIdx > 0))
|
||||||
memcpy(this->overlayHistory[overlayHistoryIdx], damage, damageIdx * sizeof(struct Rect));
|
memcpy(this->overlayHistory[overlayHistoryIdx],
|
||||||
|
damage, damageIdx * sizeof(struct Rect));
|
||||||
this->overlayHistoryCount[overlayHistoryIdx] = damageIdx;
|
this->overlayHistoryCount[overlayHistoryIdx] = damageIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasOverlay && !this->hadOverlay)
|
if (unlikely(!hasOverlay && !this->hadOverlay))
|
||||||
{
|
{
|
||||||
if (this->cursorLast.visible)
|
if (this->cursorLast.visible)
|
||||||
damage[damageIdx++] = this->cursorLast.rect;
|
damage[damageIdx++] = this->cursorLast.rect;
|
||||||
@@ -1197,7 +1203,9 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate,
|
|||||||
this->cursorLast = cursorState;
|
this->cursorLast = cursorState;
|
||||||
|
|
||||||
preSwap(udata);
|
preSwap(udata);
|
||||||
app_eglSwapBuffers(this->display, this->surface, damage, this->noSwapDamage ? 0 : damageIdx);
|
app_eglSwapBuffers(this->display, this->surface, damage,
|
||||||
|
this->noSwapDamage ? 0 : damageIdx);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -39,7 +39,8 @@ typedef enum EGL_PixelFormat
|
|||||||
EGL_PF_RGBA10,
|
EGL_PF_RGBA10,
|
||||||
EGL_PF_RGBA16F,
|
EGL_PF_RGBA16F,
|
||||||
EGL_PF_BGR_32,
|
EGL_PF_BGR_32,
|
||||||
EGL_PF_RGB_24
|
EGL_PF_RGB_24,
|
||||||
|
EGL_PF_RGB_24_32
|
||||||
}
|
}
|
||||||
EGL_PixelFormat;
|
EGL_PixelFormat;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -80,9 +80,9 @@ typedef struct EGL_FilterOps
|
|||||||
void (*setOutputResHint)(EGL_Filter * filter,
|
void (*setOutputResHint)(EGL_Filter * filter,
|
||||||
unsigned int x, unsigned int y);
|
unsigned int x, unsigned int y);
|
||||||
|
|
||||||
/* returns the output resolution of the filter */
|
/* returns the output resolution and pixel format of the filter */
|
||||||
void (*getOutputRes)(EGL_Filter * filter,
|
void (*getOutputRes)(EGL_Filter * filter,
|
||||||
unsigned int *x, unsigned int *y);
|
unsigned int *x, unsigned int *y, enum EGL_PixelFormat *pixFmt);
|
||||||
|
|
||||||
/* prepare the shader for use
|
/* prepare the shader for use
|
||||||
* A filter can return false to bypass it */
|
* A filter can return false to bypass it */
|
||||||
@@ -162,9 +162,9 @@ static inline void egl_filterSetOutputResHint(EGL_Filter * filter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void egl_filterGetOutputRes(EGL_Filter * filter,
|
static inline void egl_filterGetOutputRes(EGL_Filter * filter,
|
||||||
unsigned int *x, unsigned int *y)
|
unsigned int *x, unsigned int *y, enum EGL_PixelFormat *pixFmt)
|
||||||
{
|
{
|
||||||
return filter->ops.getOutputRes(filter, x, y);
|
return filter->ops.getOutputRes(filter, x, y, pixFmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool egl_filterPrepare(EGL_Filter * filter)
|
static inline bool egl_filterPrepare(EGL_Filter * filter)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -112,7 +112,7 @@ static bool egl_filter24bitSetup(EGL_Filter * filter,
|
|||||||
{
|
{
|
||||||
EGL_Filter24bit * this = UPCAST(EGL_Filter24bit, filter);
|
EGL_Filter24bit * this = UPCAST(EGL_Filter24bit, filter);
|
||||||
|
|
||||||
if (pixFmt != EGL_PF_BGR_32 && pixFmt != EGL_PF_RGB_24)
|
if (pixFmt != EGL_PF_BGR_32 && pixFmt != EGL_PF_RGB_24_32)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this->useDMA != useDMA || this->format != pixFmt)
|
if (this->useDMA != useDMA || this->format != pixFmt)
|
||||||
@@ -148,7 +148,7 @@ static bool egl_filter24bitSetup(EGL_Filter * filter,
|
|||||||
this->desktopHeight == desktopHeight)
|
this->desktopHeight == desktopHeight)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!egl_framebufferSetup(this->fb, pixFmt, desktopWidth, desktopHeight))
|
if (!egl_framebufferSetup(this->fb, EGL_PF_BGRA, desktopWidth, desktopHeight))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->format = pixFmt;
|
this->format = pixFmt;
|
||||||
@@ -162,11 +162,12 @@ static bool egl_filter24bitSetup(EGL_Filter * filter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void egl_filter24bitGetOutputRes(EGL_Filter * filter,
|
static void egl_filter24bitGetOutputRes(EGL_Filter * filter,
|
||||||
unsigned int *width, unsigned int *height)
|
unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt)
|
||||||
{
|
{
|
||||||
EGL_Filter24bit * this = UPCAST(EGL_Filter24bit, filter);
|
EGL_Filter24bit * this = UPCAST(EGL_Filter24bit, filter);
|
||||||
*width = this->desktopWidth;
|
*width = this->desktopWidth;
|
||||||
*height = this->desktopHeight;
|
*height = this->desktopHeight;
|
||||||
|
*pixFmt = EGL_PF_BGRA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool egl_filter24bitPrepare(EGL_Filter * filter)
|
static bool egl_filter24bitPrepare(EGL_Filter * filter)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -370,11 +370,12 @@ static bool egl_filterDownscaleSetup(EGL_Filter * filter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void egl_filterDownscaleGetOutputRes(EGL_Filter * filter,
|
static void egl_filterDownscaleGetOutputRes(EGL_Filter * filter,
|
||||||
unsigned int *width, unsigned int *height)
|
unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt)
|
||||||
{
|
{
|
||||||
EGL_FilterDownscale * this = UPCAST(EGL_FilterDownscale, filter);
|
EGL_FilterDownscale * this = UPCAST(EGL_FilterDownscale, filter);
|
||||||
*width = this->width;
|
*width = this->width;
|
||||||
*height = this->height;
|
*height = this->height;
|
||||||
|
*pixFmt = this->pixFmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool egl_filterDownscalePrepare(EGL_Filter * filter)
|
static bool egl_filterDownscalePrepare(EGL_Filter * filter)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -254,11 +254,12 @@ static bool egl_filterFFXCASSetup(EGL_Filter * filter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void egl_filterFFXCASGetOutputRes(EGL_Filter * filter,
|
static void egl_filterFFXCASGetOutputRes(EGL_Filter * filter,
|
||||||
unsigned int *width, unsigned int *height)
|
unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt)
|
||||||
{
|
{
|
||||||
EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter);
|
EGL_FilterFFXCAS * this = UPCAST(EGL_FilterFFXCAS, filter);
|
||||||
*width = this->width;
|
*width = this->width;
|
||||||
*height = this->height;
|
*height = this->height;
|
||||||
|
*pixFmt = this->pixFmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool egl_filterFFXCASPrepare(EGL_Filter * filter)
|
static bool egl_filterFFXCASPrepare(EGL_Filter * filter)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -383,11 +383,12 @@ static bool egl_filterFFXFSR1Setup(EGL_Filter * filter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void egl_filterFFXFSR1GetOutputRes(EGL_Filter * filter,
|
static void egl_filterFFXFSR1GetOutputRes(EGL_Filter * filter,
|
||||||
unsigned int *width, unsigned int *height)
|
unsigned int *width, unsigned int *height, enum EGL_PixelFormat *pixFmt)
|
||||||
{
|
{
|
||||||
EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter);
|
EGL_FilterFFXFSR1 * this = UPCAST(EGL_FilterFFXFSR1, filter);
|
||||||
*width = this->width;
|
*width = this->width;
|
||||||
*height = this->height;
|
*height = this->height;
|
||||||
|
*pixFmt = this->pixFmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool egl_filterFFXFSR1Prepare(EGL_Filter * filter)
|
static bool egl_filterFFXFSR1Prepare(EGL_Filter * filter)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -43,6 +43,7 @@ bool egl_framebufferInit(EGL_Framebuffer ** fb)
|
|||||||
if (!egl_textureInit(&this->tex, NULL, EGL_TEXTYPE_BUFFER))
|
if (!egl_textureInit(&this->tex, NULL, EGL_TEXTYPE_BUFFER))
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to initialize the texture");
|
DEBUG_ERROR("Failed to initialize the texture");
|
||||||
|
free(this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ bool egl_framebufferSetup(EGL_Framebuffer * this, enum EGL_PixelFormat pixFmt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
egl_textureGet(this->tex, &tex, NULL, NULL);
|
egl_textureGet(this->tex, &tex, NULL, NULL, NULL);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -642,7 +642,9 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
|||||||
|
|
||||||
//TODO: clean this up
|
//TODO: clean this up
|
||||||
GLuint _unused;
|
GLuint _unused;
|
||||||
if (egl_textureGet(tex, &_unused, &sizeX, &sizeY) != EGL_TEX_STATUS_OK)
|
EGL_PixelFormat pixFmt;
|
||||||
|
if (egl_textureGet(tex, &_unused,
|
||||||
|
&sizeX, &sizeY, &pixFmt) != EGL_TEX_STATUS_OK)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (atomic_exchange(&this->modified, false))
|
if (atomic_exchange(&this->modified, false))
|
||||||
@@ -677,13 +679,13 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex,
|
|||||||
{
|
{
|
||||||
egl_filterSetOutputResHint(filter, targetX, targetY);
|
egl_filterSetOutputResHint(filter, targetX, targetY);
|
||||||
|
|
||||||
if (!egl_filterSetup(filter, tex->format.pixFmt, sizeX, sizeY,
|
if (!egl_filterSetup(filter, pixFmt, sizeX, sizeY,
|
||||||
desktopWidth, desktopHeight, useDMA) ||
|
desktopWidth, desktopHeight, useDMA) ||
|
||||||
!egl_filterPrepare(filter))
|
!egl_filterPrepare(filter))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
texture = egl_filterRun(filter, &filterRects, texture);
|
texture = egl_filterRun(filter, &filterRects, texture);
|
||||||
egl_filterGetOutputRes(filter, &sizeX, &sizeY);
|
egl_filterGetOutputRes(filter, &sizeX, &sizeY, &pixFmt);
|
||||||
|
|
||||||
if (lastFilter)
|
if (lastFilter)
|
||||||
egl_filterRelease(lastFilter);
|
egl_filterRelease(lastFilter);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/stringutils.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -219,18 +220,22 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
|||||||
|
|
||||||
if (useDMA)
|
if (useDMA)
|
||||||
{
|
{
|
||||||
const char * search = "sampler2D";
|
const char search[] = "sampler2D";
|
||||||
const char * replace = "samplerExternalOES";
|
const char replace[] = "samplerExternalOES";
|
||||||
|
|
||||||
const char * src = fragment_code;
|
const char * offset = NULL;
|
||||||
int instances = 0;
|
int instances = 0;
|
||||||
while((src = strstr(src, search)))
|
|
||||||
|
while((offset = memsearch(
|
||||||
|
fragment_code, fragment_size,
|
||||||
|
search , sizeof(search)-1,
|
||||||
|
offset)))
|
||||||
{
|
{
|
||||||
++instances;
|
++instances;
|
||||||
src += strlen(search);
|
offset += sizeof(search)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int diff = (strlen(replace) - strlen(search)) * instances;
|
const int diff = (sizeof(replace) - sizeof(search)) * instances;
|
||||||
const int newLen = fragment_size + diff;
|
const int newLen = fragment_size + diff;
|
||||||
newCode = malloc(newLen + 1);
|
newCode = malloc(newLen + 1);
|
||||||
if (!newCode)
|
if (!newCode)
|
||||||
@@ -239,7 +244,7 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
src = fragment_code;
|
const char * src = fragment_code;
|
||||||
char * dst = newCode;
|
char * dst = newCode;
|
||||||
for(int i = 0; i < instances; ++i)
|
for(int i = 0; i < instances; ++i)
|
||||||
{
|
{
|
||||||
@@ -248,10 +253,10 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
|||||||
|
|
||||||
memcpy(dst, src, offset);
|
memcpy(dst, src, offset);
|
||||||
dst += offset;
|
dst += offset;
|
||||||
src = pos + strlen(search);
|
src = pos + sizeof(search)-1;
|
||||||
|
|
||||||
memcpy(dst, replace, strlen(replace));
|
memcpy(dst, replace, sizeof(replace)-1);
|
||||||
dst += strlen(replace);
|
dst += sizeof(replace)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int final = fragment_size - (src - fragment_code);
|
const int final = fragment_size - (src - fragment_code);
|
||||||
@@ -303,7 +308,9 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
|||||||
|
|
||||||
if (!newLine)
|
if (!newLine)
|
||||||
{
|
{
|
||||||
insertPos = i - 1;
|
insertPos = i;
|
||||||
|
if (insertPos > 0)
|
||||||
|
--insertPos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -92,7 +92,8 @@ typedef struct EGL_TextureOps
|
|||||||
enum EGL_TexStatus (*process)(EGL_Texture * texture);
|
enum EGL_TexStatus (*process)(EGL_Texture * texture);
|
||||||
|
|
||||||
/* get the texture for use */
|
/* get the texture for use */
|
||||||
enum EGL_TexStatus (*get)(EGL_Texture * texture, GLuint * tex);
|
enum EGL_TexStatus (*get)(EGL_Texture * texture, GLuint * tex,
|
||||||
|
EGL_PixelFormat * fmt);
|
||||||
|
|
||||||
/* bind the texture for use */
|
/* bind the texture for use */
|
||||||
enum EGL_TexStatus (*bind)(EGL_Texture * texture);
|
enum EGL_TexStatus (*bind)(EGL_Texture * texture);
|
||||||
@@ -132,13 +133,15 @@ bool egl_textureUpdateFromDMA(EGL_Texture * texture,
|
|||||||
enum EGL_TexStatus egl_textureProcess(EGL_Texture * texture);
|
enum EGL_TexStatus egl_textureProcess(EGL_Texture * texture);
|
||||||
|
|
||||||
static inline EGL_TexStatus egl_textureGet(EGL_Texture * texture, GLuint * tex,
|
static inline EGL_TexStatus egl_textureGet(EGL_Texture * texture, GLuint * tex,
|
||||||
unsigned int * sizeX, unsigned int * sizeY)
|
unsigned int * sizeX, unsigned int * sizeY, EGL_PixelFormat * fmt)
|
||||||
{
|
{
|
||||||
if (sizeX)
|
if (sizeX)
|
||||||
*sizeX = texture->format.width;
|
*sizeX = texture->format.width;
|
||||||
if (sizeY)
|
if (sizeY)
|
||||||
*sizeY = texture->format.height;
|
*sizeY = texture->format.height;
|
||||||
return texture->ops.get(texture, tex);
|
if (fmt)
|
||||||
|
*fmt = texture->format.pixFmt;
|
||||||
|
return texture->ops.get(texture, tex, fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum EGL_TexStatus egl_textureBind(EGL_Texture * texture);
|
enum EGL_TexStatus egl_textureBind(EGL_Texture * texture);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -132,7 +132,8 @@ EGL_TexStatus egl_texBufferProcess(EGL_Texture * texture)
|
|||||||
return EGL_TEX_STATUS_OK;
|
return EGL_TEX_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGL_TexStatus egl_texBufferGet(EGL_Texture * texture, GLuint * tex)
|
EGL_TexStatus egl_texBufferGet(EGL_Texture * texture, GLuint * tex,
|
||||||
|
EGL_PixelFormat * fmt)
|
||||||
{
|
{
|
||||||
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
||||||
*tex = this->tex[0];
|
*tex = this->tex[0];
|
||||||
@@ -195,7 +196,7 @@ static bool egl_texBufferStreamUpdate(EGL_Texture * texture,
|
|||||||
const uint8_t * src = update->buffer;
|
const uint8_t * src = update->buffer;
|
||||||
for(int y = 0; y < update->height; ++y)
|
for(int y = 0; y < update->height; ++y)
|
||||||
{
|
{
|
||||||
memcpy(dst, src, update->pitch);
|
memcpy(dst, src, update->width * texture->format.bpp);
|
||||||
dst += texture->format.pitch;
|
dst += texture->format.pitch;
|
||||||
src += update->pitch;
|
src += update->pitch;
|
||||||
}
|
}
|
||||||
@@ -205,8 +206,8 @@ static bool egl_texBufferStreamUpdate(EGL_Texture * texture,
|
|||||||
const uint8_t * src = update->buffer + update->pitch * update->height;
|
const uint8_t * src = update->buffer + update->pitch * update->height;
|
||||||
for(int y = 0; y < update->height; ++y)
|
for(int y = 0; y < update->height; ++y)
|
||||||
{
|
{
|
||||||
src -= update->stride;
|
src -= update->pitch;
|
||||||
memcpy(dst, src, update->stride);
|
memcpy(dst, src, update->width * texture->format.bpp);
|
||||||
dst += texture->format.pitch;
|
dst += texture->format.pitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,7 +243,7 @@ EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture)
|
|||||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer->pbo);
|
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer->pbo);
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->format.width);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->format.stride);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,
|
glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
texture->format.width,
|
texture->format.width,
|
||||||
@@ -260,7 +261,8 @@ EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture)
|
|||||||
return EGL_TEX_STATUS_OK;
|
return EGL_TEX_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
EGL_TexStatus egl_texBufferStreamGet(EGL_Texture * texture, GLuint * tex)
|
EGL_TexStatus egl_texBufferStreamGet(EGL_Texture * texture, GLuint * tex,
|
||||||
|
EGL_PixelFormat * fmt)
|
||||||
{
|
{
|
||||||
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
||||||
|
|
||||||
@@ -298,7 +300,7 @@ EGL_TexStatus egl_texBufferBind(EGL_Texture * texture)
|
|||||||
GLuint tex;
|
GLuint tex;
|
||||||
EGL_TexStatus status;
|
EGL_TexStatus status;
|
||||||
|
|
||||||
if ((status = texture->ops.get(texture, &tex)) != EGL_TEX_STATUS_OK)
|
if ((status = texture->ops.get(texture, &tex, NULL)) != EGL_TEX_STATUS_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, tex);
|
glBindTexture(GL_TEXTURE_2D, tex);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -47,7 +47,8 @@ bool egl_texBufferInit(EGL_Texture ** texture_, EGL_TexType type,
|
|||||||
void egl_texBufferFree(EGL_Texture * texture_);
|
void egl_texBufferFree(EGL_Texture * texture_);
|
||||||
bool egl_texBufferSetup(EGL_Texture * texture_, const EGL_TexSetup * setup);
|
bool egl_texBufferSetup(EGL_Texture * texture_, const EGL_TexSetup * setup);
|
||||||
EGL_TexStatus egl_texBufferProcess(EGL_Texture * texture_);
|
EGL_TexStatus egl_texBufferProcess(EGL_Texture * texture_);
|
||||||
EGL_TexStatus egl_texBufferGet(EGL_Texture * texture_, GLuint * tex);
|
EGL_TexStatus egl_texBufferGet(EGL_Texture * texture_, GLuint * tex,
|
||||||
|
EGL_PixelFormat * fmt);
|
||||||
EGL_TexStatus egl_texBufferBind(EGL_Texture * texture_);
|
EGL_TexStatus egl_texBufferBind(EGL_Texture * texture_);
|
||||||
|
|
||||||
bool egl_texBufferStreamInit(EGL_Texture ** texture_, EGL_TexType type,
|
bool egl_texBufferStreamInit(EGL_Texture ** texture_, EGL_TexType type,
|
||||||
@@ -55,4 +56,5 @@ bool egl_texBufferStreamInit(EGL_Texture ** texture_, EGL_TexType type,
|
|||||||
bool egl_texBufferStreamSetup(EGL_Texture * texture_,
|
bool egl_texBufferStreamSetup(EGL_Texture * texture_,
|
||||||
const EGL_TexSetup * setup);
|
const EGL_TexSetup * setup);
|
||||||
EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture_);
|
EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture_);
|
||||||
EGL_TexStatus egl_texBufferStreamGet(EGL_Texture * texture_, GLuint * tex);
|
EGL_TexStatus egl_texBufferStreamGet(EGL_Texture * texture_, GLuint * tex,
|
||||||
|
EGL_PixelFormat * fmt);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -37,13 +37,21 @@ typedef struct TexDMABUF
|
|||||||
TextureBuffer base;
|
TextureBuffer base;
|
||||||
|
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
bool hasImportModifiers;
|
|
||||||
Vector images;
|
Vector images;
|
||||||
|
|
||||||
|
EGL_PixelFormat pixFmt;
|
||||||
|
unsigned fourcc;
|
||||||
|
unsigned width;
|
||||||
|
GLuint format;
|
||||||
}
|
}
|
||||||
TexDMABUF;
|
TexDMABUF;
|
||||||
|
|
||||||
EGL_TextureOps EGL_TextureDMABUF;
|
EGL_TextureOps EGL_TextureDMABUF;
|
||||||
|
|
||||||
|
static bool initDone = false;
|
||||||
|
static bool has24BitSupport = true;
|
||||||
|
static bool hasImportModifiers = true;
|
||||||
|
|
||||||
// internal functions
|
// internal functions
|
||||||
|
|
||||||
static void egl_texDMABUFCleanup(EGL_Texture * texture)
|
static void egl_texDMABUFCleanup(EGL_Texture * texture)
|
||||||
@@ -94,9 +102,13 @@ static bool egl_texDMABUFInit(EGL_Texture ** texture, EGL_TexType type,
|
|||||||
|
|
||||||
this->display = display;
|
this->display = display;
|
||||||
|
|
||||||
const char * client_exts = eglQueryString(this->display, EGL_EXTENSIONS);
|
if (!initDone)
|
||||||
this->hasImportModifiers =
|
{
|
||||||
util_hasGLExt(client_exts, "EGL_EXT_image_dma_buf_import_modifiers");
|
const char * client_exts = eglQueryString(this->display, EGL_EXTENSIONS);
|
||||||
|
hasImportModifiers =
|
||||||
|
util_hasGLExt(client_exts, "EGL_EXT_image_dma_buf_import_modifiers");
|
||||||
|
initDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -113,9 +125,18 @@ static void egl_texDMABUFFree(EGL_Texture * texture)
|
|||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool egl_texDMABUFSetup(EGL_Texture * texture, const EGL_TexSetup * setup)
|
static bool texDMABUFSetup(EGL_Texture * texture)
|
||||||
{
|
{
|
||||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
|
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
||||||
|
|
||||||
|
if (texture->format.pixFmt == EGL_PF_RGB_24 && !has24BitSupport)
|
||||||
|
{
|
||||||
|
this->pixFmt = EGL_PF_RGB_24_32;
|
||||||
|
this->width = texture->format.pitch / 4;
|
||||||
|
this->fourcc = DRM_FORMAT_ARGB8888;
|
||||||
|
this->format = GL_BGRA_EXT;
|
||||||
|
}
|
||||||
|
|
||||||
egl_texDMABUFCleanup(texture);
|
egl_texDMABUFCleanup(texture);
|
||||||
|
|
||||||
@@ -126,10 +147,10 @@ static bool egl_texDMABUFSetup(EGL_Texture * texture, const EGL_TexSetup * setup
|
|||||||
glTexImage2D(GL_TEXTURE_EXTERNAL_OES,
|
glTexImage2D(GL_TEXTURE_EXTERNAL_OES,
|
||||||
0,
|
0,
|
||||||
texture->format.intFormat,
|
texture->format.intFormat,
|
||||||
texture->format.width,
|
this->width,
|
||||||
texture->format.height,
|
texture->format.height,
|
||||||
0,
|
0,
|
||||||
texture->format.format,
|
this->format,
|
||||||
texture->format.dataType,
|
texture->format.dataType,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@@ -139,6 +160,50 @@ static bool egl_texDMABUFSetup(EGL_Texture * texture, const EGL_TexSetup * setup
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool egl_texDMABUFSetup(EGL_Texture * texture, const EGL_TexSetup * setup)
|
||||||
|
{
|
||||||
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
|
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
||||||
|
|
||||||
|
this->pixFmt = texture->format.pixFmt;
|
||||||
|
this->width = texture->format.width;
|
||||||
|
this->fourcc = texture->format.fourcc;
|
||||||
|
this->format = texture->format.format;
|
||||||
|
|
||||||
|
return texDMABUFSetup(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
static EGLImage createImage(EGL_Texture * texture, int fd)
|
||||||
|
{
|
||||||
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
|
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
||||||
|
|
||||||
|
const uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
|
||||||
|
EGLAttrib attribs[] =
|
||||||
|
{
|
||||||
|
EGL_WIDTH , this->width ,
|
||||||
|
EGL_HEIGHT , texture->format.height,
|
||||||
|
EGL_LINUX_DRM_FOURCC_EXT , this->fourcc,
|
||||||
|
EGL_DMA_BUF_PLANE0_FD_EXT , fd,
|
||||||
|
EGL_DMA_BUF_PLANE0_OFFSET_EXT , 0,
|
||||||
|
EGL_DMA_BUF_PLANE0_PITCH_EXT , texture->format.pitch,
|
||||||
|
EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, (modifier & 0xffffffff),
|
||||||
|
EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, (modifier >> 32),
|
||||||
|
EGL_NONE , EGL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!hasImportModifiers)
|
||||||
|
attribs[12] = attribs[13] =
|
||||||
|
attribs[14] = attribs[15] = EGL_NONE;
|
||||||
|
|
||||||
|
return g_egl_dynProcs.eglCreateImage(
|
||||||
|
this->display,
|
||||||
|
EGL_NO_CONTEXT,
|
||||||
|
EGL_LINUX_DMA_BUF_EXT,
|
||||||
|
(EGLClientBuffer)NULL,
|
||||||
|
attribs);
|
||||||
|
}
|
||||||
|
|
||||||
static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
||||||
const EGL_TexUpdate * update)
|
const EGL_TexUpdate * update)
|
||||||
{
|
{
|
||||||
@@ -157,43 +222,36 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image == EGL_NO_IMAGE)
|
if (unlikely(image == EGL_NO_IMAGE))
|
||||||
{
|
{
|
||||||
const uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
|
bool setup = false;
|
||||||
EGLAttrib attribs[] =
|
if (texture->format.pixFmt == EGL_PF_RGB_24 && has24BitSupport)
|
||||||
{
|
{
|
||||||
EGL_WIDTH , texture->format.width ,
|
image = createImage(texture, update->dmaFD);
|
||||||
EGL_HEIGHT , texture->format.height,
|
if (image == EGL_NO_IMAGE)
|
||||||
EGL_LINUX_DRM_FOURCC_EXT , texture->format.fourcc,
|
{
|
||||||
EGL_DMA_BUF_PLANE0_FD_EXT , update->dmaFD,
|
DEBUG_INFO("Using 24-bit in 32-bit for DMA");
|
||||||
EGL_DMA_BUF_PLANE0_OFFSET_EXT , 0,
|
has24BitSupport = false;
|
||||||
EGL_DMA_BUF_PLANE0_PITCH_EXT , texture->format.pitch,
|
setup = true;
|
||||||
EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, (modifier & 0xffffffff),
|
}
|
||||||
EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, (modifier >> 32),
|
}
|
||||||
EGL_NONE , EGL_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!this->hasImportModifiers)
|
if (!has24BitSupport && setup)
|
||||||
attribs[12] = attribs[13] =
|
texDMABUFSetup(texture);
|
||||||
attribs[14] = attribs[15] = EGL_NONE;
|
|
||||||
|
|
||||||
image = g_egl_dynProcs.eglCreateImage(
|
|
||||||
this->display,
|
|
||||||
EGL_NO_CONTEXT,
|
|
||||||
EGL_LINUX_DMA_BUF_EXT,
|
|
||||||
(EGLClientBuffer)NULL,
|
|
||||||
attribs);
|
|
||||||
|
|
||||||
if (image == EGL_NO_IMAGE)
|
if (image == EGL_NO_IMAGE)
|
||||||
|
image = createImage(texture, update->dmaFD);
|
||||||
|
|
||||||
|
if (unlikely(image == EGL_NO_IMAGE))
|
||||||
{
|
{
|
||||||
DEBUG_EGL_ERROR("Failed to create EGLImage for DMA transfer");
|
DEBUG_EGL_ERROR("Failed to create EGLImage for DMA transfer");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vector_push(&this->images, &(struct FdImage) {
|
if (unlikely(!vector_push(&this->images, &(struct FdImage) {
|
||||||
.fd = update->dmaFD,
|
.fd = update->dmaFD,
|
||||||
.image = image,
|
.image = image,
|
||||||
}))
|
})))
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to store EGLImage");
|
DEBUG_ERROR("Failed to store EGLImage");
|
||||||
g_egl_dynProcs.eglDestroyImage(this->display, image);
|
g_egl_dynProcs.eglDestroyImage(this->display, image);
|
||||||
@@ -206,7 +264,7 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
|||||||
glBindTexture(GL_TEXTURE_EXTERNAL_OES, parent->tex[parent->bufIndex]);
|
glBindTexture(GL_TEXTURE_EXTERNAL_OES, parent->tex[parent->bufIndex]);
|
||||||
g_egl_dynProcs.glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image);
|
g_egl_dynProcs.glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image);
|
||||||
|
|
||||||
if (parent->sync)
|
if (likely(parent->sync))
|
||||||
glDeleteSync(parent->sync);
|
glDeleteSync(parent->sync);
|
||||||
|
|
||||||
parent->sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
parent->sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||||
@@ -220,9 +278,12 @@ static EGL_TexStatus egl_texDMABUFProcess(EGL_Texture * texture)
|
|||||||
return EGL_TEX_STATUS_OK;
|
return EGL_TEX_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EGL_TexStatus egl_texDMABUFGet(EGL_Texture * texture, GLuint * tex)
|
static EGL_TexStatus egl_texDMABUFGet(EGL_Texture * texture, GLuint * tex,
|
||||||
|
EGL_PixelFormat * fmt)
|
||||||
{
|
{
|
||||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
|
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
||||||
|
|
||||||
GLsync sync = 0;
|
GLsync sync = 0;
|
||||||
|
|
||||||
INTERLOCKED_SECTION(parent->copyLock,
|
INTERLOCKED_SECTION(parent->copyLock,
|
||||||
@@ -265,6 +326,10 @@ static EGL_TexStatus egl_texDMABUFGet(EGL_Texture * texture, GLuint * tex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*tex = parent->tex[parent->rIndex];
|
*tex = parent->tex[parent->rIndex];
|
||||||
|
|
||||||
|
if (fmt)
|
||||||
|
*fmt = this->pixFmt;
|
||||||
|
|
||||||
return EGL_TEX_STATUS_OK;
|
return EGL_TEX_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +338,7 @@ static EGL_TexStatus egl_texDMABUFBind(EGL_Texture * texture)
|
|||||||
GLuint tex;
|
GLuint tex;
|
||||||
EGL_TexStatus status;
|
EGL_TexStatus status;
|
||||||
|
|
||||||
if ((status = egl_texDMABUFGet(texture, &tex)) != EGL_TEX_STATUS_OK)
|
if ((status = egl_texDMABUFGet(texture, &tex, NULL)) != EGL_TEX_STATUS_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
|
glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -38,17 +38,12 @@ bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt)
|
|||||||
|
|
||||||
switch(setup->pixFmt)
|
switch(setup->pixFmt)
|
||||||
{
|
{
|
||||||
//EGL has no support for 24-bit formats, so we stuff it into a 32-bit
|
|
||||||
//texture to unpack with a shader later
|
|
||||||
case EGL_PF_BGR_32:
|
|
||||||
// fallthrough
|
|
||||||
|
|
||||||
case EGL_PF_BGRA:
|
case EGL_PF_BGRA:
|
||||||
fmt->bpp = 4;
|
fmt->bpp = 4;
|
||||||
fmt->format = GL_BGRA_EXT;
|
fmt->format = GL_BGRA_EXT;
|
||||||
fmt->intFormat = GL_BGRA_EXT;
|
fmt->intFormat = GL_BGRA_EXT;
|
||||||
fmt->dataType = GL_UNSIGNED_BYTE;
|
fmt->dataType = GL_UNSIGNED_BYTE;
|
||||||
fmt->fourcc = DRM_FORMAT_ARGB8888;
|
fmt->fourcc = DRM_FORMAT_XRGB8888;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGL_PF_RGBA:
|
case EGL_PF_RGBA:
|
||||||
@@ -56,7 +51,7 @@ bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt)
|
|||||||
fmt->format = GL_RGBA;
|
fmt->format = GL_RGBA;
|
||||||
fmt->intFormat = GL_RGBA;
|
fmt->intFormat = GL_RGBA;
|
||||||
fmt->dataType = GL_UNSIGNED_BYTE;
|
fmt->dataType = GL_UNSIGNED_BYTE;
|
||||||
fmt->fourcc = DRM_FORMAT_ABGR8888;
|
fmt->fourcc = DRM_FORMAT_XBGR8888;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGL_PF_RGBA10:
|
case EGL_PF_RGBA10:
|
||||||
@@ -64,7 +59,7 @@ bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt)
|
|||||||
fmt->format = GL_RGBA;
|
fmt->format = GL_RGBA;
|
||||||
fmt->intFormat = GL_RGB10_A2;
|
fmt->intFormat = GL_RGB10_A2;
|
||||||
fmt->dataType = GL_UNSIGNED_INT_2_10_10_10_REV;
|
fmt->dataType = GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||||
fmt->fourcc = DRM_FORMAT_ABGR2101010;
|
fmt->fourcc = DRM_FORMAT_XBGR2101010;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGL_PF_RGBA16F:
|
case EGL_PF_RGBA16F:
|
||||||
@@ -72,17 +67,27 @@ bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt)
|
|||||||
fmt->format = GL_RGBA;
|
fmt->format = GL_RGBA;
|
||||||
fmt->intFormat = GL_RGBA16F;
|
fmt->intFormat = GL_RGBA16F;
|
||||||
fmt->dataType = GL_HALF_FLOAT;
|
fmt->dataType = GL_HALF_FLOAT;
|
||||||
fmt->fourcc = DRM_FORMAT_ABGR16161616F;
|
fmt->fourcc = DRM_FORMAT_XBGR16161616F;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGL_PF_RGB_24:
|
//EGL has no support for 24-bit formats, so we stuff it into a 32-bit
|
||||||
fmt->bpp = 3;
|
//texture to unpack with a shader later
|
||||||
|
case EGL_PF_BGR_32:
|
||||||
|
fmt->bpp = 4;
|
||||||
fmt->format = GL_BGRA_EXT;
|
fmt->format = GL_BGRA_EXT;
|
||||||
fmt->intFormat = GL_BGRA_EXT;
|
fmt->intFormat = GL_BGRA_EXT;
|
||||||
fmt->dataType = GL_UNSIGNED_BYTE;
|
fmt->dataType = GL_UNSIGNED_BYTE;
|
||||||
fmt->fourcc = DRM_FORMAT_ARGB8888;
|
fmt->fourcc = DRM_FORMAT_ARGB8888;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EGL_PF_RGB_24:
|
||||||
|
fmt->bpp = 3;
|
||||||
|
fmt->format = GL_RGB;
|
||||||
|
fmt->intFormat = GL_BGRA_EXT;
|
||||||
|
fmt->dataType = GL_UNSIGNED_BYTE;
|
||||||
|
fmt->fourcc = DRM_FORMAT_RGB888;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG_ERROR("Unsupported pixel format");
|
DEBUG_ERROR("Unsupported pixel format");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -63,10 +63,12 @@ void egl_texUtilUnmapBuffer(EGL_TexBuffer * buffer);
|
|||||||
#define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
|
#define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
|
||||||
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
||||||
|
|
||||||
|
#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4')
|
||||||
#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4')
|
#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4')
|
||||||
#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4')
|
#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4')
|
||||||
#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0')
|
#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4')
|
||||||
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H')
|
#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0')
|
||||||
|
#define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H')
|
||||||
|
|
||||||
#define DRM_FORMAT_MOD_VENDOR_NONE 0
|
#define DRM_FORMAT_MOD_VENDOR_NONE 0
|
||||||
#define fourcc_mod_code(vendor, val) \
|
#define fourcc_mod_code(vendor, val) \
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(renderer_Opengl LANGUAGES C CXX)
|
project(renderer_Opengl LANGUAGES C CXX)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -622,13 +622,13 @@ static void opengl_spiceDrawFill(LG_Renderer * renderer, int x, int y, int width
|
|||||||
glBindTexture(GL_TEXTURE_2D, this->textures[SPICE_TEXTURE]);
|
glBindTexture(GL_TEXTURE_2D, this->textures[SPICE_TEXTURE]);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT , 4 );
|
glPixelStorei(GL_UNPACK_ALIGNMENT , 4 );
|
||||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
|
||||||
for(; y < height; ++y)
|
for(int dy = 0; dy < height; ++dy)
|
||||||
glTexSubImage2D
|
glTexSubImage2D
|
||||||
(
|
(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0 ,
|
0 ,
|
||||||
x ,
|
x ,
|
||||||
y ,
|
y + dy ,
|
||||||
width ,
|
width ,
|
||||||
1 ,
|
1 ,
|
||||||
GL_BGRA,
|
GL_BGRA,
|
||||||
@@ -1146,7 +1146,9 @@ static bool opengl_bufferFn(void * opaque, const void * data, size_t size)
|
|||||||
size,
|
size,
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
check_gl_error("glBufferSubData");
|
|
||||||
|
if (check_gl_error("glBufferSubData"))
|
||||||
|
return false;
|
||||||
|
|
||||||
this->texPos += size;
|
this->texPos += size;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@@ -345,7 +345,10 @@ void app_handleKeyPress(int sc, int charcode)
|
|||||||
if (sc == KEY_ESC)
|
if (sc == KEY_ESC)
|
||||||
app_setOverlay(false);
|
app_setOverlay(false);
|
||||||
else
|
else
|
||||||
g_state.io->KeysDown[sc] = true;
|
{
|
||||||
|
if (linux_to_imgui[sc])
|
||||||
|
ImGuiIO_AddKeyEvent(g_state.io, linux_to_imgui[sc], true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,7 +391,8 @@ void app_handleKeyRelease(int sc, int charcode)
|
|||||||
|
|
||||||
if (app_isOverlayMode())
|
if (app_isOverlayMode())
|
||||||
{
|
{
|
||||||
g_state.io->KeysDown[sc] = false;
|
if (linux_to_imgui[sc])
|
||||||
|
ImGuiIO_AddKeyEvent(g_state.io, linux_to_imgui[sc], false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2023 The Looking Glass Authors
|
* Copyright © 2017-2025 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user