|
|
@ -62,7 +62,7 @@ void finish_drm_renderer(struct wlr_drm_renderer *renderer) {
|
|
|
|
|
|
|
|
|
|
|
|
bool init_drm_surface(struct wlr_drm_surface *surf,
|
|
|
|
bool init_drm_surface(struct wlr_drm_surface *surf,
|
|
|
|
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
|
|
|
|
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
|
|
|
|
uint32_t format, uint32_t flags) {
|
|
|
|
uint32_t format, struct wlr_drm_format_set *set, uint32_t flags) {
|
|
|
|
if (surf->width == width && surf->height == height) {
|
|
|
|
if (surf->width == width && surf->height == height) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -84,8 +84,19 @@ bool init_drm_surface(struct wlr_drm_surface *surf,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
|
|
|
|
wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
|
|
|
|
|
|
|
|
|
|
|
|
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
|
|
|
|
if (!(flags & GBM_BO_USE_LINEAR) && set != NULL) {
|
|
|
|
format, GBM_BO_USE_RENDERING | flags);
|
|
|
|
const struct wlr_drm_format *drm_format =
|
|
|
|
|
|
|
|
wlr_drm_format_set_get(set, format);
|
|
|
|
|
|
|
|
if (drm_format != NULL) {
|
|
|
|
|
|
|
|
surf->gbm = gbm_surface_create_with_modifiers(renderer->gbm,
|
|
|
|
|
|
|
|
width, height, format, drm_format->modifiers, drm_format->len);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (surf->gbm == NULL) {
|
|
|
|
|
|
|
|
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
|
|
|
|
|
|
|
|
format, GBM_BO_USE_RENDERING | flags);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!surf->gbm) {
|
|
|
|
if (!surf->gbm) {
|
|
|
|
wlr_log_errno(WLR_ERROR, "Failed to create GBM surface");
|
|
|
|
wlr_log_errno(WLR_ERROR, "Failed to create GBM surface");
|
|
|
|
goto error_zero;
|
|
|
|
goto error_zero;
|
|
|
@ -279,16 +290,16 @@ bool init_drm_plane_surfaces(struct wlr_drm_plane *plane,
|
|
|
|
uint32_t format) {
|
|
|
|
uint32_t format) {
|
|
|
|
if (!drm->parent) {
|
|
|
|
if (!drm->parent) {
|
|
|
|
return init_drm_surface(&plane->surf, &drm->renderer, width, height,
|
|
|
|
return init_drm_surface(&plane->surf, &drm->renderer, width, height,
|
|
|
|
format, GBM_BO_USE_SCANOUT);
|
|
|
|
format, &plane->formats, GBM_BO_USE_SCANOUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!init_drm_surface(&plane->surf, &drm->parent->renderer,
|
|
|
|
if (!init_drm_surface(&plane->surf, &drm->parent->renderer,
|
|
|
|
width, height, format, GBM_BO_USE_LINEAR)) {
|
|
|
|
width, height, format, NULL, GBM_BO_USE_LINEAR)) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!init_drm_surface(&plane->mgpu_surf, &drm->renderer,
|
|
|
|
if (!init_drm_surface(&plane->mgpu_surf, &drm->renderer,
|
|
|
|
width, height, format, GBM_BO_USE_SCANOUT)) {
|
|
|
|
width, height, format, &plane->formats, GBM_BO_USE_SCANOUT)) {
|
|
|
|
finish_drm_surface(&plane->surf);
|
|
|
|
finish_drm_surface(&plane->surf);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|