mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
wlr_scene: Wrap render_list nodes in struct
We will be able to add more state here
This commit is contained in:
parent
9c2c906518
commit
9613b3bc8a
1 changed files with 26 additions and 17 deletions
|
@ -1394,6 +1394,10 @@ struct render_list_constructor_data {
|
||||||
bool calculate_visibility;
|
bool calculate_visibility;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct render_list_entry {
|
||||||
|
struct wlr_scene_node *node;
|
||||||
|
};
|
||||||
|
|
||||||
static bool construct_render_list_iterator(struct wlr_scene_node *node,
|
static bool construct_render_list_iterator(struct wlr_scene_node *node,
|
||||||
int lx, int ly, void *_data) {
|
int lx, int ly, void *_data) {
|
||||||
struct render_list_constructor_data *data = _data;
|
struct render_list_constructor_data *data = _data;
|
||||||
|
@ -1426,11 +1430,15 @@ static bool construct_render_list_iterator(struct wlr_scene_node *node,
|
||||||
|
|
||||||
pixman_region32_fini(&intersection);
|
pixman_region32_fini(&intersection);
|
||||||
|
|
||||||
struct wlr_scene_node **entry = wl_array_add(data->render_list,
|
struct render_list_entry *entry = wl_array_add(data->render_list, sizeof(*entry));
|
||||||
sizeof(struct wlr_scene_node *));
|
if (!entry) {
|
||||||
if (entry) {
|
return false;
|
||||||
*entry = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*entry = (struct render_list_entry){
|
||||||
|
.node = node,
|
||||||
|
};
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1649,8 +1657,8 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
construct_render_list_iterator, &list_con);
|
construct_render_list_iterator, &list_con);
|
||||||
array_realloc(list_con.render_list, list_con.render_list->size);
|
array_realloc(list_con.render_list, list_con.render_list->size);
|
||||||
|
|
||||||
int list_len = list_con.render_list->size / sizeof(struct wlr_scene_node *);
|
struct render_list_entry *list_data = list_con.render_list->data;
|
||||||
struct wlr_scene_node **list_data = list_con.render_list->data;
|
int list_len = list_con.render_list->size / sizeof(*list_data);
|
||||||
|
|
||||||
bool sent_direct_scanout_feedback = false;
|
bool sent_direct_scanout_feedback = false;
|
||||||
|
|
||||||
|
@ -1658,10 +1666,10 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
// directly scanned out
|
// directly scanned out
|
||||||
bool scanout = false;
|
bool scanout = false;
|
||||||
if (list_len == 1) {
|
if (list_len == 1) {
|
||||||
struct wlr_scene_node *node = list_data[0];
|
struct render_list_entry *entry = &list_data[0];
|
||||||
|
|
||||||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
if (entry->node->type == WLR_SCENE_NODE_BUFFER) {
|
||||||
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(node);
|
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(entry->node);
|
||||||
|
|
||||||
if (scene_buffer_can_consider_direct_scanout(buffer, state, &render_data)) {
|
if (scene_buffer_can_consider_direct_scanout(buffer, state, &render_data)) {
|
||||||
if (buffer->primary_output == scene_output) {
|
if (buffer->primary_output == scene_output) {
|
||||||
|
@ -1769,9 +1777,10 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
// never see the background.
|
// never see the background.
|
||||||
if (scene_output->scene->calculate_visibility) {
|
if (scene_output->scene->calculate_visibility) {
|
||||||
for (int i = list_len - 1; i >= 0; i--) {
|
for (int i = list_len - 1; i >= 0; i--) {
|
||||||
struct wlr_scene_node *node = list_data[i];
|
struct render_list_entry *entry = &list_data[i];
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
wlr_scene_node_coords(node, &x, &y);
|
wlr_scene_node_coords(entry->node, &x, &y);
|
||||||
|
|
||||||
// We must only cull opaque regions that are visible by the node.
|
// We must only cull opaque regions that are visible by the node.
|
||||||
// The node's visibility will have the knowledge of a black rect
|
// The node's visibility will have the knowledge of a black rect
|
||||||
|
@ -1780,8 +1789,8 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
// rendering in that black rect region, consider the node's visibility.
|
// rendering in that black rect region, consider the node's visibility.
|
||||||
pixman_region32_t opaque;
|
pixman_region32_t opaque;
|
||||||
pixman_region32_init(&opaque);
|
pixman_region32_init(&opaque);
|
||||||
scene_node_opaque_region(node, x, y, &opaque);
|
scene_node_opaque_region(entry->node, x, y, &opaque);
|
||||||
pixman_region32_intersect(&opaque, &opaque, &node->visible);
|
pixman_region32_intersect(&opaque, &opaque, &entry->node->visible);
|
||||||
|
|
||||||
pixman_region32_translate(&opaque, -scene_output->x, -scene_output->y);
|
pixman_region32_translate(&opaque, -scene_output->x, -scene_output->y);
|
||||||
wlr_region_scale(&opaque, &opaque, render_data.scale);
|
wlr_region_scale(&opaque, &opaque, render_data.scale);
|
||||||
|
@ -1807,11 +1816,11 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
|
||||||
pixman_region32_fini(&background);
|
pixman_region32_fini(&background);
|
||||||
|
|
||||||
for (int i = list_len - 1; i >= 0; i--) {
|
for (int i = list_len - 1; i >= 0; i--) {
|
||||||
struct wlr_scene_node *node = list_data[i];
|
struct render_list_entry *entry = &list_data[i];
|
||||||
scene_node_render(node, &render_data);
|
scene_node_render(entry->node, &render_data);
|
||||||
|
|
||||||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
if (entry->node->type == WLR_SCENE_NODE_BUFFER) {
|
||||||
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(node);
|
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(entry->node);
|
||||||
|
|
||||||
if (buffer->primary_output == scene_output && !sent_direct_scanout_feedback) {
|
if (buffer->primary_output == scene_output && !sent_direct_scanout_feedback) {
|
||||||
struct wlr_linux_dmabuf_feedback_v1_init_options options = {
|
struct wlr_linux_dmabuf_feedback_v1_init_options options = {
|
||||||
|
|
Loading…
Reference in a new issue