148 Commits

Author SHA1 Message Date
Ikalco
0a7e2cb152
pass: remove renderer finalDamage since it's unused (#9996) 2025-04-09 17:50:06 +02:00
Vaxry
260d8e1f71
Permission Manager: add permission management for screencopy (#9930) 2025-04-08 19:39:53 +02:00
UjinT34
7374a023ef
renderer/opengl: Extract shaders from source (#9600)
---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-03-29 01:19:35 +01:00
Vaxry
1c2b9a9ce3 opengl: don't attempt to compile cm on gles3.0
also disable the error for the cm shader

fixes #9738
2025-03-26 14:28:19 +00:00
Vaxry
3cc8e8c6be renderer: don't crash if cm fails to compile 2025-03-14 15:20:08 +00:00
Tom Englund
6ffde36466
syncobj: use eventfd instead of stalling fd checks (#9437)
* syncobj: cleanup and use uniqueptrs

cleanup a bit missing removals if resource not good, erasing from
containers etc. make use of unique ptrs instead. and add default
destructors.

* syncobj: rework syncobj entirerly

remove early buffer release that was breaking explicit sync, the buffer
needs to exist until the surface commit event has been emitted and draw
calls added egl sync points, move to eventfd signaling instead of
stalling sync point checks, and recommit pending commits if waiting on a
signal. add a CDRMSyncPointState helper class. move a few weak pointers
to shared pointers so they dont destruct before we need to use them.

* syncobj: queue pending states for eventfd

eventfd requires us to queue pending stats until ready and then apply to
current, and also when no ready state exist commit the client commit on
the current existing buffer, if there is one.

* syncobj: clear current buffer damage

clear current buffer damage on current buffer commits.

* syncobj: cleanup code and fix hyprlock

remove unused code, and ensure we dont commit a empty texture causing
locksession protocol and gtk4-layer-shell misbehaving.

* syncobj: ensure buffers are cleaned up

ensure the containers having the various buffers actually gets cleaned
up from their containers, incase the CSignal isnt signaled because of
expired smart pointers or just wrong order destruction because mishaps.
also move the acquire/point setting to buffer attaching. instead of on
precommit.

* syncobj: remove unused code, optimize

remove unused code and merge sync fds if fence is valid, remove manual
directscanout buffer dropping that signals release point on pageflip, it
can cause us to signal the release point while still keeping the current
buffer and rendering it yet again causing wrong things.

* syncobj: delay buffer release on non syncobj

delay buffer releases on non syncobj surfaces until next commit, and
check on async buffers if syncobj and drop and signal the release point
on backend buffer release.

* syncobj: ensure we follow protocol

ensure we follow protocol by replacing acquire/release points if they
arrive late and replace already existing ones. also remove unneded
brackets, and dont try to manual lock/release buffers when it comes to
explicit protocol. it doesnt care about buffer releases only about
acquire and release points and signaling them.

* syncobj: lets not complicate things

set points in precommit, before checking protocol errors and we catch
any pending acquire/release points arriving late.

* syncobj: move SSurfaceState to types

remove destructor resource destroying, let resources destroys them on
their events, and move SSurfaceStates to types/SurfaceState.hpp

* syncobj: actually store the merged fd

have to actually store the mergedfd to use it.

* syncobj: cleanup a bit around fences

ensure the current asynchronous buffer is actually released on pageflip
not the previous. cleanup a bit FD handling in
commitPendingAndDoExplicitSync, and reuse the in fence when syncing
surfaces.

* syncobjs: ensure fence FD doesnt leak

calling resetexplicitfence without properly ensuring the FD is closed
before will leak it, store it per monitor and let it close itself with
the CFileDescriptor class.

* syncobj: ensure buffers are actually released

buffers were never being sent released properly.

* types: Defer buffer sync releaser until unlock

* syncobj: store directscanout fence in monitor

ensure the infence fd survives the scope of attemptdirectscanout so it
doesnt close before it should have.

* syncobj: check if if acquire is expired

we might hit a race to finish on exit where the timeline just has
destructed but the buffer waiter is still pending. and such we
removeAllWaiters null dereferences.

* syncobj: code style changes

remove quack comment, change to m_foo and use a std::vector and
weakpointer in the waiter for removal instead of a std::list.

* syncobj: remove unused async buffer drop

remove unused async buffer drop, only related to directscanout and is
handled elsewhere.

---------

Co-authored-by: Lee Bousfield <ljbousfield@gmail.com>
2025-03-14 15:08:20 +01:00
UjinT34
8c97cb7858
renderer: add simple color management (#9506)
Adds proper color management and transformations for CM surfaces.
2025-03-14 00:15:18 +01:00
Tom Englund
f7fcbe32c9
renderer: various fixes towards improving gpu calls robustness (#9188)
ensure framebuffer textures are detached and deleted, avoid leaving framebuffers bound when not needed

* render: avoid calling glDeleteProgram on no program

its safe to do so but it adds a bunch of unnecessery lines in apitrace
when tracing. if guard it and return early.

* opengl: ensure texture and buffers are unbound

ensure bound buffers are unbound after use, also detach textures from
framebuffer before deleting it otherwise it will become dangling and
essentially leak.
2025-02-08 01:46:26 +01:00
nyx
ddf180fa30
render: enforce framebuffer offloading and remove introspection toggle (#9217) 2025-01-31 17:08:43 +01:00
Tom Englund
32c0fa2f2f
core: begin using CFileDescriptor from hyprutils (#9122)
* config: make fd use CFileDescriptor

make use of the new hyprutils CFileDescriptor instead of manual FD
handling.

* hyprctl: make fd use CFileDescriptor

make use of the new hyprutils CFileDescriptor instead of manual FD
handling.

* ikeyboard: make fd use CFileDescriptor

make use of the new CFileDescriptor instead of manual FD handling, also
in sendKeymap remove dead code, it already early returns if keyboard
isnt valid, and dont try to close the FD that ikeyboard owns.

* core: make SHMFile functions use CFileDescriptor

make SHMFile misc functions use CFileDescriptor and its associated usage
in dmabuf and keyboard.

* core: make explicit sync use CFileDescriptor

begin using CFileDescriptor in explicit sync and its timelines and
eglsync usage in opengl, there is still a bit left with manual handling
that requires future aquamarine change aswell.

* eventmgr: make fd and sockets use CFileDescriptor

make use of the hyprutils CFileDescriptor instead of manual FD and
socket handling and closing.

* eventloopmgr: make timerfd use CFileDescriptor

make the timerfd use CFileDescriptor instead of manual fd handling

* opengl: make gbm fd use CFileDescriptor

make the gbm rendernode fd use CFileDescriptor instead of manual fd
handling

* core: make selection source/offer use CFileDescriptor

make data selection source and offers use CFileDescriptor and its
associated use in xwm and protocols

* protocols: convert protocols fd to CFileDescriptor

make most fd handling use CFileDescriptor in protocols

* shm: make SHMPool use CfileDescriptor

make SHMPool use CFileDescriptor instead of manual fd handling.

* opengl: duplicate fd with CFileDescriptor

duplicate fenceFD with CFileDescriptor duplicate instead.

* xwayland: make sockets and fds use CFileDescriptor

instead of manual opening/closing make sockets and fds use
CFileDescriptor

* keybindmgr: make sockets and fds use CFileDescriptor

make sockets and fds use CFileDescriptor instead of manual handling.
2025-01-30 11:30:12 +00:00
Vaxry
e951011503 renderer/internal: stop using box pointers
in favor of const refs
2025-01-26 15:05:34 +00:00
outfoxxed
465cf66df1
protocols: add hyprland_surface_v1.set_visible_region implementation (#9120) 2025-01-23 22:57:33 +01:00
Vaxry
0a1ae48a9f
core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
user111111111111111111111111111111111
2bad73354a
core: cleanup header includes (#9088)
Cleanup some unneeded includes to speed up compilation
2025-01-17 15:21:35 +00:00
vaxerski
25add26881 renderer: unload background texture if it's disabled
ref #9031
2025-01-14 17:52:32 +01:00
Pollux
a5c14370c1
renderer: Add supercircular window corners (#8943)
renderer: Add supercircular shadows and borders

config: Add rounding_power to default and example configs

rule: add `roundingpower` window rule
2025-01-05 18:38:49 +00:00
vaxerski
60f069d540 groupbar: fix missing ellipsize for text
fixes #8938
2025-01-04 00:25:01 +01:00
vaxerski
81721b8aa8 groupbar: unify title rendering
moves the text renderer to the unified opengl impl
2025-01-02 17:50:55 +01:00
outfoxxed
dde3e082c9
protocols: add hyprland_surface_v1 implementation (#8877) 2025-01-01 23:34:02 +00:00
vaxerski
d64ac47202 pass: improve pass debugging 2025-01-01 17:26:05 +01:00
vaxerski
4e93b2def5 renderer: use a render pass for render modif in client render
fixes #8918
2025-01-01 14:11:21 +01:00
Vaxry
e536b02248
Renderer: rewrite render scheduling (#8683)
This rewrites renderer scheduling. Occlusion is now unified in a new Pass type.
2024-12-22 17:12:09 +01:00
Vaxry
8bbeee1173
core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us.

It's not a strict requirement to be compliant, but I tuned it to be alright.
2024-12-07 18:51:18 +01:00
Vaxry
320144ae72
core: move colorspace handling to oklab (#8635)
* Meson: add hyprgraphics

* Nix: add hyprgraphics

* CI/setup_base: get hyprgraphics-git

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-12-03 18:58:24 +00:00
Vaxry
d8b865366a renderer: Add a missing texture asset and a user check
When an asset is missing, instead of a black screen, render an obnoxious, yet standard, missing texture.

Additionally, warn the user assets failed to load.

Shoutout to Arch for having their assets broken for months. Fix your shit. I am tired of it, and it's negatively impacting users.
2024-11-01 15:52:09 +00:00
Vaxry
d5689bb539 internal: cleanup CMonitor usage and fix a few ref hogs
ref #8221
2024-10-26 02:06:13 +01:00
Vaxry
f044e4c951
internal: Move CMonitor to SP (#8178)
* move monitors to sp

* XD
2024-10-19 23:03:29 +01:00
Vaxry
2320b2241c
Internal: move to Mat3x3 from hyprutils (#7902)
* Meson: require hyprutils >= 0.2.3

* flake.lock: update hyprutils

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-09-25 10:01:13 +01:00
Vaxry
604eb21a7e
renderer: better lockscreen dead behavior (#7574)
---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-08-29 23:30:12 +02:00
Vaxry
640d161851
renderer: Explicit sync fixes (#7151)
Enables explicit sync by default for most platforms

`misc:no_direct_scanout` -> `render:direct_scanout`
2024-08-06 15:52:19 +02:00
Tom Englund
9c38b0fdbe core: add a destructor to CHyprOpenglImpl and avoid wl_container_of undefined behaviour (#7101)
* protocols: avoid undefined behaviour in C macro

to safely use wl_container_of with a class the class has to be no
virtual functions, no inheritance, and uniform access control (e.g all
public)

work around this by putting this into a destroywrapper struct.

* opengl: clean memory on destruction

add a destructor and free the allocated memory and close the fd
2024-07-29 19:29:08 +02:00
vaxerski
57371b93a0 renderer: drastically optimize bg texture creation
stop loading 20MB images every time, dumbass
2024-07-26 19:53:24 +02:00
Vaxry
b16fb9770c egl: support getting the device via platform_device
a neat EXT
2024-07-24 18:53:51 +02:00
Vaxry
016da234d0
Core: Move to aquamarine (#6608)
Moves Hyprland from wlroots to aquamarine for the backend.

---------

Signed-off-by: Vaxry <vaxry@vaxry.net>
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
Co-authored-by: vaxerski <vaxerski@users.noreply.github.com>
Co-authored-by: UjinT34 <41110182+UjinT34@users.noreply.github.com>
Co-authored-by: Tom Englund <tomenglund26@gmail.com>
Co-authored-by: Ikalco <73481042+ikalco@users.noreply.github.com>
Co-authored-by: diniamo <diniamo53@gmail.com>
2024-07-21 13:09:54 +02:00
Vaxry
fb15b7aa2a core: Move to hyprutils for Math
Moves CRegion, CBox and Vector2D over to hyprutils.

Requires hyprutils>=0.1.4
2024-06-19 16:20:15 +02:00
Vaxry
2f278dc883 egl: fixup format modifier lookups with implicit modifiers
ref #6485
2024-06-14 21:59:21 +02:00
Vaxry
6967a31450
wayland/core: move to new impl (#6268)
* wayland/core/dmabuf: move to new impl

it's the final countdown
2024-06-08 10:07:59 +02:00
Vaxry
ed411f53bd cursor: move to a hyprland impl
This moves wlr_cursor to a completely new impl mostly under
CPointerManager

Also adds beginSimple to OpenGL for simple render passes (e.g. cursor)
2024-05-09 13:37:39 +01:00
Vaxry
1ed1ce9506
internal: new shared_ptr and weak_ptr implementation (#5883)
moves std::shared_ptrs to a new implementation

Advantages:
- you can dereference a weak_ptr directly. This will obviously segfault on a nullptr deref if it's expired.
   - this is useful to avoid the .lock() hell where we are 100% sure the pointer _should_ be valid. (and if it isn't, it should throw.)
- weak_ptrs are still valid while the SP is being destroyed.
   - reasoning: while an object (e.g. CWindow) is being destroyed, its `weak_ptr self` should be accessible (the sp is still alive, and so is CWindow), but it's not because by stl it's already expired (to prevent resurrection)
   - this impl solves it differently. w_p is expired, but can still be dereferenced and used. Creating `s_p`s is not possible anymore, though.
   - this is useful in destructors and callbacks.
2024-05-05 17:16:00 +01:00
Vaxry
5edc32930d layerSurface: refactor/move to a memory-safe impl
Makes all the pointers smart to avoid memory issues
Refactors layerSurface code to live inside desktop/layersurface
2024-04-30 02:41:27 +01:00
Vaxry
bca7804bb6
internal: Window storage rework - part 1 (#5762)
* Window storage rework - part 1

* format

* remove useless include

* fix pch

* format

* fix crash in dwindle

* fix vram leak

* prefer .expired() for bool checks
2024-04-27 12:43:12 +01:00
Virt
9fe409800b
renderer: Fix mirrored displays when transformed and preserve aspect ratio (#5697)
* renderer: transform mirror buffer and preserve mirror aspect ratio

* renderer: render mirrors directly from offloadFB

* renderer: fix formatting

* renderer: use monitorMirrorFB again, but properly damage mirrors

* renderer: clean mirrors after reload and support cursor zoom mirroring
2024-04-24 16:29:41 +01:00
Vaxry
d605e47511 renderer: block screen shader on screencopy 2024-04-03 21:35:16 +01:00
Vaxry
efdc1af044 renderer: some fixes for renderModif 2024-04-03 14:09:58 +01:00
Vaxry
ef23ef60c5
Workspace/core: Refactor workspace storage (#5380)
* refactor workspaces to use ptrs

* clang-format
2024-04-02 20:32:39 +01:00
jill
ee00cb1dd8
opengl: report shader compilation errors from screen_shader (#5138)
* opengl: report shader compilation errors from screen_shader

* opengl: prefer .data()

* opengl: move shader error logging to logError

* opengl: quick glGetShaderiv -> glGetProgramiv fix

* opengl: typo fix

* opengl: format fixes

* opengl: minor compile fixes

* opengl: logError -> logShaderError
2024-03-21 14:46:23 +00:00
Vaxry
4bc669f933 layers: add fully featured animations
Adds configs and layerrules to handle them

alas fixes #981

I have cooked
2024-02-28 15:00:40 +00:00
Vaxry
8c3613632a renderer: nuke lastFrameDamage and rework finalDamage
this fucking SUCKED
2024-02-23 01:02:32 +00:00
Vaxry
2e3f0d5991 renderer: Add new background infrastructure
Adds new backgrounds from the winners of the contest
Rewrites how it works
Allows high color precision PNGs (RGB32F precisely)
Fixes a small bug in renderTextureInternalWithDamage
Nukes misc:force_hypr_chan
2024-01-29 23:11:00 +00:00
vaxerski
f5b2fd2bc3 opengl: add renderdata.forceIntrospection 2024-01-07 18:37:02 +01:00