mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
backend/drm: add basic support for direct scan-out
This commit is contained in:
parent
3dec88e455
commit
96d6fde5dc
7 changed files with 105 additions and 7 deletions
|
|
@ -163,6 +163,30 @@ void post_drm_surface(struct wlr_drm_surface *surf) {
|
|||
}
|
||||
}
|
||||
|
||||
struct gbm_bo *import_gbm_bo(struct wlr_drm_renderer *renderer,
|
||||
struct wlr_dmabuf_attributes *attribs) {
|
||||
struct gbm_import_fd_modifier_data data = {
|
||||
.width = attribs->width,
|
||||
.height = attribs->height,
|
||||
.format = attribs->format,
|
||||
.num_fds = attribs->n_planes,
|
||||
.modifier = attribs->modifier,
|
||||
};
|
||||
|
||||
if ((size_t)attribs->n_planes > sizeof(data.fds) / sizeof(data.fds[0])) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < (size_t)attribs->n_planes; ++i) {
|
||||
data.fds[i] = attribs->fd[i];
|
||||
data.strides[i] = attribs->stride[i];
|
||||
data.offsets[i] = attribs->offset[i];
|
||||
}
|
||||
|
||||
return gbm_bo_import(renderer->gbm, GBM_BO_IMPORT_FD_MODIFIER,
|
||||
&data, GBM_BO_USE_SCANOUT);
|
||||
}
|
||||
|
||||
bool export_drm_bo(struct gbm_bo *bo, struct wlr_dmabuf_attributes *attribs) {
|
||||
memset(attribs, 0, sizeof(struct wlr_dmabuf_attributes));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue