mirror of
https://github.com/yshui/picom.git
synced 2025-04-14 17:53:25 -04:00
renderer: fix support for xsync fence
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
98559f5985
commit
709a253621
3 changed files with 26 additions and 6 deletions
|
@ -1850,8 +1850,9 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) {
|
|||
(struct geometry){.width = ps->root_width,
|
||||
.height = ps->root_height});
|
||||
bool succeeded = renderer_render(
|
||||
ps->renderer, ps->backend_data, ps->root_image, ps->layout_manager,
|
||||
ps->command_builder, ps->backend_blur_context, render_start_us,
|
||||
ps->renderer, ps->backend_data, ps->root_image,
|
||||
ps->layout_manager, ps->command_builder,
|
||||
ps->backend_blur_context, render_start_us, ps->sync_fence,
|
||||
ps->o.use_damage, ps->o.monitor_repaint, ps->o.force_win_blend,
|
||||
ps->o.blur_background_frame, ps->o.inactive_dim_fixed,
|
||||
ps->o.max_brightness, ps->o.inactive_dim, &ps->shadow_exclude_reg,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "renderer.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <xcb/xcb_aux.h>
|
||||
|
||||
#include "../picom.h"
|
||||
#include "backend/backend.h"
|
||||
|
@ -424,11 +425,17 @@ static bool renderer_prepare_commands(struct renderer *r, struct backend_base *b
|
|||
bool renderer_render(struct renderer *r, struct backend_base *backend,
|
||||
image_handle root_image, struct layout_manager *lm,
|
||||
struct command_builder *cb, void *blur_context,
|
||||
uint64_t render_start_us, bool use_damage attr_unused,
|
||||
uint64_t render_start_us, xcb_sync_fence_t xsync_fence, bool use_damage,
|
||||
bool monitor_repaint, bool force_blend, bool blur_frame,
|
||||
bool inactive_dim_fixed, double max_brightness, double inactive_dim,
|
||||
const region_t *shadow_exclude, const struct x_monitors *monitors,
|
||||
const struct win_option *wintype_options, uint64_t *after_damage_us) {
|
||||
if (xsync_fence != XCB_NONE) {
|
||||
// Trigger the fence but don't immediately wait on it. Let it run
|
||||
// concurrent with our CPU tasks to save time.
|
||||
set_cant_fail_cookie(backend->c,
|
||||
xcb_sync_trigger_fence(backend->c->c, xsync_fence));
|
||||
}
|
||||
// TODO(yshui) In some cases we can render directly into the back buffer, and
|
||||
// don't need the intermediate back_image. Several conditions need to be met: no
|
||||
// dithered present; no blur, with blur we will render areas that's just for blur
|
||||
|
@ -512,6 +519,16 @@ bool renderer_render(struct renderer *r, struct backend_base *backend,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (xsync_fence != XCB_NONE) {
|
||||
set_cant_fail_cookie(
|
||||
backend->c, xcb_sync_await_fence(backend->c->c, 1, &xsync_fence));
|
||||
// Making sure the wait is completed by receiving a response from the X
|
||||
// server
|
||||
xcb_aux_sync(backend->c->c);
|
||||
set_cant_fail_cookie(backend->c,
|
||||
xcb_sync_reset_fence(backend->c->c, xsync_fence));
|
||||
}
|
||||
|
||||
if (backend->ops->prepare) {
|
||||
backend->ops->prepare(backend, &layout->commands[0].mask.region);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <xcb/sync.h>
|
||||
#include "types.h"
|
||||
|
||||
struct renderer;
|
||||
|
@ -18,9 +19,10 @@ typedef struct pixman_region32 region_t;
|
|||
void renderer_free(struct backend_base *backend, struct renderer *r);
|
||||
struct renderer *renderer_new(struct backend_base *backend, double shadow_radius,
|
||||
struct color shadow_color, bool dithered_present);
|
||||
bool renderer_render(struct renderer *r, struct backend_base *backend, image_handle root_image,
|
||||
struct layout_manager *lm, struct command_builder *cb,
|
||||
void *blur_context, uint64_t render_start_us, bool use_damage,
|
||||
bool renderer_render(struct renderer *r, struct backend_base *backend,
|
||||
image_handle root_image, struct layout_manager *lm,
|
||||
struct command_builder *cb, void *blur_context,
|
||||
uint64_t render_start_us, xcb_sync_fence_t xsync_fence, bool use_damage,
|
||||
bool monitor_repaint, bool force_blend, bool blur_frame,
|
||||
bool inactive_dim_fixed, double max_brightness, double inactive_dim,
|
||||
const region_t *shadow_exclude, const struct x_monitors *monitors,
|
||||
|
|
Loading…
Add table
Reference in a new issue