mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
wlr_scene: Remove usage of wlr_client_buffer
This commit is contained in:
parent
99eaf7006f
commit
19b1b44230
1 changed files with 8 additions and 46 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
#include <wlr/types/wlr_fractional_scale_v1.h>
|
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||||
#include <wlr/types/wlr_linux_drm_syncobj_v1.h>
|
#include <wlr/types/wlr_linux_drm_syncobj_v1.h>
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
#include <wlr/types/wlr_presentation_time.h>
|
||||||
|
#include <wlr/types/wlr_raster.h>
|
||||||
#include <wlr/util/transform.h>
|
#include <wlr/util/transform.h>
|
||||||
#include "types/wlr_scene.h"
|
#include "types/wlr_scene.h"
|
||||||
|
|
||||||
|
|
@ -76,28 +77,6 @@ static void scene_surface_handle_surface_destroy(
|
||||||
wlr_scene_node_destroy(&surface->buffer->node);
|
wlr_scene_node_destroy(&surface->buffer->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is used for wlr_scene where it unconditionally locks buffers preventing
|
|
||||||
// reuse of the existing texture for shm clients. With the usage pattern of
|
|
||||||
// wlr_scene surface handling, we can mark its locked buffer as safe
|
|
||||||
// for mutation.
|
|
||||||
static void client_buffer_mark_next_can_damage(struct wlr_client_buffer *buffer) {
|
|
||||||
buffer->n_ignore_locks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void scene_buffer_unmark_client_buffer(struct wlr_scene_buffer *scene_buffer) {
|
|
||||||
if (!scene_buffer->buffer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_client_buffer *buffer = wlr_client_buffer_get(scene_buffer->buffer);
|
|
||||||
if (!buffer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(buffer->n_ignore_locks > 0);
|
|
||||||
buffer->n_ignore_locks--;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int min(int a, int b) {
|
static int min(int a, int b) {
|
||||||
return a < b ? a : b;
|
return a < b ? a : b;
|
||||||
}
|
}
|
||||||
|
|
@ -160,38 +139,23 @@ static void surface_reconfigure(struct wlr_scene_surface *scene_surface) {
|
||||||
wlr_scene_buffer_set_transform(scene_buffer, state->transform);
|
wlr_scene_buffer_set_transform(scene_buffer, state->transform);
|
||||||
wlr_scene_buffer_set_opacity(scene_buffer, opacity);
|
wlr_scene_buffer_set_opacity(scene_buffer, opacity);
|
||||||
|
|
||||||
scene_buffer_unmark_client_buffer(scene_buffer);
|
struct wlr_raster *raster = wlr_raster_from_surface(surface);
|
||||||
|
if (raster) {
|
||||||
if (surface->buffer) {
|
wlr_scene_buffer_set_raster_with_damage(scene_buffer,
|
||||||
client_buffer_mark_next_can_damage(surface->buffer);
|
raster, &surface->buffer_damage);
|
||||||
|
|
||||||
struct wlr_linux_drm_syncobj_surface_v1_state *syncobj_surface_state =
|
struct wlr_linux_drm_syncobj_surface_v1_state *syncobj_surface_state =
|
||||||
wlr_linux_drm_syncobj_v1_get_surface_state(surface);
|
wlr_linux_drm_syncobj_v1_get_surface_state(surface);
|
||||||
|
if (syncobj_surface_state != NULL && raster->buffer &&
|
||||||
struct wlr_drm_syncobj_timeline *wait_timeline = NULL;
|
|
||||||
uint64_t wait_point = 0;
|
|
||||||
if (syncobj_surface_state != NULL) {
|
|
||||||
wait_timeline = syncobj_surface_state->acquire_timeline;
|
|
||||||
wait_point = syncobj_surface_state->acquire_point;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_scene_buffer_set_buffer_options options = {
|
|
||||||
.damage = &surface->buffer_damage,
|
|
||||||
.wait_timeline = wait_timeline,
|
|
||||||
.wait_point = wait_point,
|
|
||||||
};
|
|
||||||
wlr_scene_buffer_set_buffer_with_options(scene_buffer,
|
|
||||||
&surface->buffer->base, &options);
|
|
||||||
|
|
||||||
if (syncobj_surface_state != NULL &&
|
|
||||||
(surface->current.committed & WLR_SURFACE_STATE_BUFFER)) {
|
(surface->current.committed & WLR_SURFACE_STATE_BUFFER)) {
|
||||||
wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
|
wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state,
|
||||||
&surface->buffer->base);
|
raster->buffer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wlr_scene_buffer_set_buffer(scene_buffer, NULL);
|
wlr_scene_buffer_set_buffer(scene_buffer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_raster_unlock(raster);
|
||||||
pixman_region32_fini(&opaque);
|
pixman_region32_fini(&opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,8 +195,6 @@ static bool scene_buffer_point_accepts_input(struct wlr_scene_buffer *scene_buff
|
||||||
static void surface_addon_destroy(struct wlr_addon *addon) {
|
static void surface_addon_destroy(struct wlr_addon *addon) {
|
||||||
struct wlr_scene_surface *surface = wl_container_of(addon, surface, addon);
|
struct wlr_scene_surface *surface = wl_container_of(addon, surface, addon);
|
||||||
|
|
||||||
scene_buffer_unmark_client_buffer(surface->buffer);
|
|
||||||
|
|
||||||
wlr_addon_finish(&surface->addon);
|
wlr_addon_finish(&surface->addon);
|
||||||
|
|
||||||
wl_list_remove(&surface->outputs_update.link);
|
wl_list_remove(&surface->outputs_update.link);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue