Skip to content

Commit

Permalink
output-layout: use wlr_texture_from_buffer directly (#1967)
Browse files Browse the repository at this point in the history
Fixes #1408
  • Loading branch information
ammen99 authored Oct 20, 2023
1 parent 0f97986 commit e520c99
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/core/output-layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,28 +626,21 @@ struct output_layout_output_t
return;
}

wlr_dmabuf_attributes attributes;
if (source_back_buffer == NULL)
{
LOGE("Got empty buffer on ", wo->handle->name);
return;
}

if (!wlr_buffer_get_dmabuf(source_back_buffer, &attributes))
auto texture = wlr_texture_from_buffer(get_core().renderer, source_back_buffer);
if (!texture)
{
LOGE("Failed reading mirrored output contents from ", wo->handle->name);

LOGE("Failed to export texture to dmabuf!");
return;
}

/* We export the output to mirror from to a dmabuf, then create
* a texture from this and use it to render "our" output */
auto texture = wlr_texture_from_dmabuf(
get_core().renderer, &attributes);
render_output(texture);

wlr_texture_destroy(texture);
wlr_dmabuf_attributes_finish(&attributes);
}

void set_enabled(bool enabled)
Expand Down

0 comments on commit e520c99

Please sign in to comment.