mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
render/pixman: Add dmabuf support
Adds linux-dmabuf support to the pixman renderer. The main reason is so
clients can use GPU-accelerated rendering even if the compositor is
using the pixman renderer for whatever reason. This also allows the
pixman renderer to import dmabufs (only RGB/ARGB formats, not YUV for
now).
Since after this change all renderers store a DRM FD, I move the drm_fd
from the individual implementations to the shared wlr_renderer base.
This means that renderer_autocreate() can set pixman's drm_fd for it and
the pixman renderer doesn't have to know about DRM at all.
Originally based on
961edfe44e
This commit is contained in:
parent
27bbb91abf
commit
e4ccc8e822
10 changed files with 36 additions and 42 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <drm_fourcc.h>
|
||||
#include <pixman.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-util.h>
|
||||
#include <wlr/render/interface.h>
|
||||
#include <wlr/util/box.h>
|
||||
|
|
@ -252,6 +253,11 @@ static struct wlr_texture *pixman_texture_from_buffer(
|
|||
&data, &drm_format, &stride)) {
|
||||
return NULL;
|
||||
}
|
||||
// This looks bad, because we're saying "end access" but also storing the
|
||||
// pointer for later use. However, we only access the texture data from
|
||||
// render_pass_add_texture() which does a begin/end access, and
|
||||
// begin_pixman_data_ptr_access() will handle if the data pointer changes
|
||||
// between accesses. So everything should be fine.
|
||||
wlr_buffer_end_data_ptr_access(buffer);
|
||||
|
||||
struct wlr_pixman_texture *texture = pixman_texture_create(renderer,
|
||||
|
|
@ -335,8 +341,9 @@ struct wlr_renderer *wlr_pixman_renderer_create(void) {
|
|||
const uint32_t *formats = get_pixman_drm_formats(&len);
|
||||
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
wlr_drm_format_set_add(&renderer->drm_formats, formats[i],
|
||||
DRM_FORMAT_MOD_INVALID);
|
||||
// Only support linear buffers. MOD_INVALID could mean the driver
|
||||
// can do whatever it thinks appropriate, but pixman definitely
|
||||
// only supports linear.
|
||||
wlr_drm_format_set_add(&renderer->drm_formats, formats[i],
|
||||
DRM_FORMAT_MOD_LINEAR);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue