Commit graph

27325 commits

Author SHA1 Message Date
Vlad Zahorodnii
f1eb095a0c opengl: Drop GLTexture::clear()
It's used only by the decoration renderer, but even it doesn't need it
because the atlas parts are padded.

From the API point of view, it's worth looking for alternative solutions,
like integrating the render target clear step in the render passes. And
texture uploading code usually doesn't need to clear the texture because
it is going to overwrite its contents anyway.
2024-08-20 22:38:13 +00:00
Xaver Hugl
874189f11b scene/workspacescene: also check for occlusion of the parent item
Somehow this was dropped in a rebase of def0bde5e9
2024-08-20 21:52:55 +00:00
David Redondo
aa88904b53 decorations: Show tooltip at current cursor position
instead of at the mouse position. Fixes tooltips showing
up in wrong places when using tablets.
BUG: 491143
FIXED-IN: 6.1.5
2024-08-20 20:54:53 +00:00
Vlad Zahorodnii
76eb1d20b9 wayland: Allow mapping more than one shm buffer at the same time
The shared memory buffer may need to install a SIGBUS handler if the
compositor _may_ access the data outside of the buffer.

However, signal handling requires great care. For the simplicity sake,
only one shared memory buffer is allowed to be accessed at the time.
But such a restricted access policy is inconvenient and requires us
making client buffer contents copies.

This change eases the restrictions on map() and unmap() functions so
several buffers can be accessed simulatenously.

Note that atomic pointers are used because a signal handler can be
invoked at any point in the main thread's execution. Even though
"a = b" is a single operation from the developer's pov, it can take
several steps for the CPU to store a new value to the variable. The
atomic pointers ensure that assignments to the next and s_accessedBuffers
happen atomically.

Also keep in mind that we cannot start removing copy() calls yet
because the ShmClientBuffer life time management requires further
changes, which I believe, are out of the scope of this patch.
2024-08-20 22:32:38 +03:00
Vlad Zahorodnii
0162aea100 wayland: Store shm pool mapping in a shared pointer
ShmClientBuffer needs to hold a reference to the old memory
map while the buffer is mapped. Currently, it's not a problem
because unmap() must be called soon after map(). But in case
we relax that constraint, shm_pool.resize() can change the
memory map in the ShmPool with a new one, which can cause issues
for the SIGBUS handler because it won't be able to find the
right mapping object.
2024-08-20 22:32:38 +03:00
Xaver Hugl
b8b900891b scene/workspacescene: don't iterate through all child items twice
Instead, use an iterator for the second loop to pick up where the first loop stopped
2024-08-20 14:52:40 +00:00
Gabriel Souza Franco
60e3964322 opengl/gltexture: Fix format for 565 textures
> GL_INVALID_OPERATION is generated if type is one of [...]
> GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, [...]
> and format is not GL_RGB.
2024-08-20 14:28:09 +00:00
Vlad Zahorodnii
6a1db91191 wayland: Check that wl_shm buffer stride is multiple of bytes per pixel
This is needed to ensure that the values passed to GL_UNPACK_ROW_LENGTH
are reasonable. It's not described in the spec but wlroots already does
the same.
2024-08-20 14:05:59 +00:00
Vlad Zahorodnii
49b2b0d001 scene: Drop ItemRendererOpenGL::RenderNode::coordinateType
All render nodes have unnormalized texture coordinates now, so this
field is not needed anymore.
2024-08-20 13:26:37 +00:00
Vlad Zahorodnii
d12112b7a5 scene: Make ImageItem provide device texture coordinates
The main motivation behind this change is to make the ItemRendererOpenGL
use a homogeneous coordinate space for texture coordinates in order to
simplify rendering code.

The device pixels have been chosen because they are more agnostic about
the graphics api.
2024-08-20 13:26:37 +00:00
Vlad Zahorodnii
f002e20354 scene: Make SurfaceItem provide device texture coordinates
The main motivation behind this change is to make the ItemRendererOpenGL
use a homogeneous coordinate space for texture coordinates in order to
simplify rendering code.

The device pixels have been chosen because they are more agnostic about
the graphics api.
2024-08-20 13:26:37 +00:00
Xaver Hugl
8a5f469f95 backends/drm: implement damage tracking for multi gpu transfers
Doesn't seem to help on my system, but maybe it helps with different drivers
2024-08-20 13:04:18 +00:00
Vlad Zahorodnii
36c447a35a autotests: Add X11 stack tests 2024-08-20 12:42:49 +00:00
Vlad Zahorodnii
9c611ddaea Fix a crash in computeLayer()
On X11, the stack order of a window can be changed in multiple ways:

- Opposite
- TopIf
- BottomIf
- Above
- Below

You would pass either of those modes plus maybe the above window id. For
this crash, the relevant mode is Above.

Since the Workspace only has one restack function that places the given
window right under the reference window, the Above stack mode
implementation performs a quirk: it walks through the stack in order to
find a window right above the reference window and pass it to the
restack() function.

However, it could be that the window that wants to be restacked is already
above the reference window, so that same window would be passed as the
"under" window to the restack() function.

It's nothing but a miracle that we have not received major complaints
about this issue until now.

The restack() function doesn't like `window` and `under` to be the same
because of code like

    unconstrained_stacking_order.removeAll(window);
    unconstrained_stacking_order.insert(unconstrained_stacking_order.indexOf(under), window);

The removeAll() function would effectively remove both `window` and `under`
from the unconstrained stack, which breaks the next line because the
indexOf() would return -1, i.e.

    unconstrained_stacking_order.insert(-1, window);

This is the reason why the unconstrained_stacking_order contains strange
values such as `0xe`.

In order to fix the crash, this change adds some code to short-circuit
the restack() function if the passed in window and the reference window
are the same. It would be great to clean up X11Window::restackWindow()
and also add ergonomic restack functions in the Workspace, but this can
be done later. The major blocker is lack of proper test coverage of
X11 bits at the moment.

Last but not least, I would like to express my profound gratitude to
Peter Strick for filing the crash report AND providing a VM image that
helped massively with reproducing the crash and finally fixing it.

BUG: 491618
2024-08-20 12:27:41 +00:00
Vlad Zahorodnii
d028e3b1e9 Make Workspace::removeUnmanaged() keep the window in the stack
It's leftover after the Deleted type. The unmanaged window will be
removed from the stack when all its references are dropped and
Workspace::removeDeleted() is called.

CCBUG: 491618
2024-08-20 12:09:40 +00:00
Vlad Zahorodnii
315fff68e9 opengl: Drop unnecessary 16 bit texture support checks
16 bit textures are supported universally in OpenGL.
2024-08-20 11:57:19 +00:00
Vlad Zahorodnii
f3406a033c opengl: Set GL_UNPACK_ROW_LENGTH in GLTexture::upload()
The image stride can be other than "width * bpp". In order to properly
handle such a case, we need to set GL_UNPACK_ROW_LENGTH to skip the right
amount of pixels between consecutive rows.

Co-authored-by: Gabriel Souza Franco <gabrielfrancosouza@gmail.com>
2024-08-20 11:57:19 +00:00
Vlad Zahorodnii
31adedba3a opengl: Re-arrange code in GLTexture::upload()
Re-arrange the code so it's easier to set GL_UNPACK_ROW_LENGTH.
2024-08-20 11:57:19 +00:00
Xaver Hugl
def0bde5e9 scene/workspacescene: do occlusion testing for direct scanout
Some clients have two or more completely opaque surfaces stacked on top of each other,
optimizing the lower ones out makes direct scanout happen more often and more efficiently
when multiple planes are involved
2024-08-20 13:05:02 +02:00
Xaver Hugl
4ebb8530e6 scene/workspacescene: remove unused function 2024-08-20 11:04:44 +00:00
l10n daemon script
7f1f62e53e GIT_SILENT Sync po/docbooks with svn 2024-08-20 01:42:58 +00:00
l10n daemon script
a9e85cd540 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-08-20 01:24:48 +00:00
Xaver Hugl
f9e6ecd298 core/colorpipeline: improve optimization with differing reference luminances
This is done by
- fixing isFuzzyScalingOnly to not check the [3, 3] component, which is always 1
- making the comparison between transfer functions fuzzy, so small floating point
  errors don't prevent two practically identical functions to be optimized out
- switching manual optimizations to use addMatrix instead, which removes the
  matrix or replaces it with a multiplier

and the autotest is expanded to test transformations between color descriptions with
transfer functions and reference luminances that are just scaled versions of each
other
2024-08-19 16:39:11 +02:00
Xaver Hugl
e2c7cf2bb3 autotest/colorspaces: test identity transformations with bpc 2024-08-19 16:38:54 +02:00
Jie Liu
8233bb9de5 colorblindesscorrection: fix incorrect variable name in shader program
Signed-off-by: Jie Liu <liujie01@kylinos.cn>
2024-08-19 14:16:13 +00:00
Yifan Zhu
0eba9e631e debug_console: correct name scancode to keycode
QKeyEvent()->nativeScanCode() actually reports the keycode generated by
the kernel, not the scancode generated by the hardware.
2024-08-19 13:59:17 +00:00
Xaver Hugl
d07ce95617 effect/animationeffect: use a normal d pointer
There's no need for Qt macros to do that
2024-08-19 11:58:22 +00:00
Xaver Hugl
f10a93ce1c effects/animationeffect: clean up the code a bit 2024-08-19 11:58:22 +00:00
Vlad Zahorodnii
8ca94eed44 opengl: Fix a typo in GLTexture::upload()
For glTexStorage2D(), we need to check whether texture storage is
supported, not that ARGB32 textures are supported. Those are two
distinct things.
2024-08-19 11:44:27 +00:00
l10n daemon script
3e3bbd3034 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-08-18 01:21:13 +00:00
Xaver Hugl
74b04d3e4e disable the watchdog by default
The systemd watchdog has three big problems:
- it wrongly restarts KWin in some cases after suspend
- it wrongly restarts KWin in some OOM situations
- it wrongly restarts KWin when doing a live upgrade from the watchdog being disabled to it being enabled

Each of those cases can cause users to lose data and in the upgrade case even require repairing
the system manually, which is not acceptable.
This commit keeps the watchdog code in place for now; the decision to remove it or what to
replace it with isn't as urgent.
2024-08-17 23:23:21 +00:00
l10n daemon script
fa35c8bbac GIT_SILENT Sync po/docbooks with svn 2024-08-17 01:28:05 +00:00
Xaver Hugl
b325555e18 workspace: unset brightness devices on outputs that didn't get one assigned
Otherwise, two outputs might end up having the same brightness device
2024-08-16 23:33:13 +00:00
Vlad Zahorodnii
fdff6588c6 opengl: Drop GLTexture::update(QImage, QPoint, QRect) overload 2024-08-16 19:03:48 +03:00
Vlad Zahorodnii
e504f1a711 scene: Port away from GLTexture::update(QImage, QPoint, QRect) overload 2024-08-16 19:03:48 +03:00
Vlad Zahorodnii
46e452127e opengl: Add GLTexture::update() overload that takes a region
This ensures a couple of things:

- avoid pointlessly binding and unbinding the texture
- if the image format needs to be changed, it will be done only once
2024-08-16 19:03:40 +03:00
Vlad Zahorodnii
bfff8ac52a opengl: Simplify GLTexture::update()
Use the unpack code path by default, it lets us to simplify the code and
also fix texture uploading when the image stride is not
"width * bytes per pixel".
2024-08-16 15:35:42 +00:00
Vlad Zahorodnii
98953b0218 opengl: Make GL_EXT_unpack_subimage mandatory
It's widely supported, and other wayland compositors already require it,
so the chances of breaking things should be minimal, although some embedded
GPUs might be affected, in which case kwin will fallback to software
rendering. With the unpack being always available, we can simplify and
also fix bugs in texture uploading.
2024-08-16 15:35:42 +00:00
Xaver Hugl
7ab825cba1 backends/drm: test direct scanout with the same code as presentation
This means that we prefer direct scanout over a specific presentation mode (tearing),
which usually just means we first engage direct scanout and program the relevant
properties, and then switch to tearing afterwards.
It also removes a hack for direct scanout with legacy, and is one step less for
implementing overlay plane support.
2024-08-16 14:26:58 +02:00
David Redondo
df184ebd11 fakeinput: Remove static touches list
We track now touches per device
2024-08-16 08:48:49 +00:00
David Redondo
436211ad45 fakeinput: Keep track of pressed buttons, keys and touches
To prevent having them eternally pressed when the device is
destroyed.
2024-08-16 08:48:49 +00:00
l10n daemon script
82a49d8abc GIT_SILENT Sync po/docbooks with svn 2024-08-16 01:30:23 +00:00
l10n daemon script
ff56041de4 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2024-08-16 01:21:04 +00:00
Xaver Hugl
3aba2cf3da wayland/frog_colormanagement: improve mastering luminance handling
Before we only used max_cll and max_fall, but with some videos they are not provided
and only mastering display luminances are set
2024-08-16 02:36:05 +02:00
Xaver Hugl
f9b88ee2f3 wayland_server: expose xx color management support by default
I'm confident in the implementation and (significant) upstream changes before the protocol
is released as wp-colormanagement-v1 are unlikely, so I think allowing apps to make use of
it in practice is okay at this point.

Once the upstream protocol is released, we'll still drop the xx variant though and apps will
have to use the wp protocol in order to make use of color management features.
2024-08-15 14:47:21 +00:00
David Redondo
9e2326d3ac Generate wayland code with PRIVATE_CODE 2024-08-15 14:16:11 +00:00
Xaver Hugl
fe5db7f97d backends/drm: disable degamma_lut and ctm on NVidia
The NVidia driver maps them to hardware planes, which means they do not
apply to the cursor because the cursor plane doesn't have these color
operations.

BUG: 491634
2024-08-15 15:26:41 +02:00
Xaver Hugl
74c90b727f wayland/xx colormanagement: send max_fall and max_cll 2024-08-15 10:38:02 +00:00
Xaver Hugl
ecd3c673e9 wayland/xx colormanagement: send target primaries 2024-08-15 10:38:02 +00:00
Xaver Hugl
9ed492a17f wayland/xx colormanagement: send named primaries when possible 2024-08-15 10:38:02 +00:00