screencast: add fallback for linear modifier

This commit is contained in:
vaxerski 2023-04-14 17:14:41 +01:00
parent 2366b4d415
commit 78dee83d77
2 changed files with 9 additions and 0 deletions

View file

@ -241,6 +241,9 @@ static void pwr_handle_stream_param_changed(void *data, uint32_t id,
flags = cast->ctx->state->config->screencast_conf.force_mod_linear ?
GBM_BO_USE_RENDERING | GBM_BO_USE_LINEAR : GBM_BO_USE_RENDERING;
break;
case DRM_FORMAT_MOD_LINEAR:
flags = GBM_BO_USE_RENDERING | GBM_BO_USE_LINEAR;
break;
default:
continue;
}

View file

@ -153,6 +153,12 @@ struct xdpw_buffer *xdpw_buffer_create(struct xdpw_screencast_instance *cast,
frame_info->format, flags);
}
// Fallback for linear buffers via the implicit api
if (buffer->bo == NULL && cast->pwr_format.modifier == DRM_FORMAT_MOD_LINEAR) {
buffer->bo = gbm_bo_create(cast->ctx->gbm, frame_info->width, frame_info->height,
frame_info->format, flags | GBM_BO_USE_LINEAR);
}
if (buffer->bo == NULL) {
logprint(ERROR, "xdpw: failed to create gbm_bo");
free(buffer);