screencast: support allocation of buffers with explicit modifiers

This commit is contained in:
columbarius 2021-07-10 23:00:53 +02:00
parent 1a7276068b
commit 77bcd14ad2

View file

@ -139,12 +139,18 @@ struct xdpw_buffer *xdpw_buffer_create(struct xdpw_screencast_instance *cast,
break; break;
case DMABUF:; case DMABUF:;
uint32_t flags = GBM_BO_USE_RENDERING; uint32_t flags = GBM_BO_USE_RENDERING;
if (cast->ctx->state->config->screencast_conf.force_mod_linear) { if (cast->pwr_format.modifier != DRM_FORMAT_MOD_INVALID) {
flags |= GBM_BO_USE_LINEAR; uint64_t *modifiers = (uint64_t*)&cast->pwr_format.modifier;
buffer->bo = gbm_bo_create_with_modifiers2(cast->ctx->gbm, frame_info->width, frame_info->height,
frame_info->format, modifiers, 1, flags);
} else {
if (cast->ctx->state->config->screencast_conf.force_mod_linear) {
flags |= GBM_BO_USE_LINEAR;
}
buffer->bo = gbm_bo_create(cast->ctx->gbm, frame_info->width, frame_info->height,
frame_info->format, flags);
} }
buffer->bo = gbm_bo_create(cast->ctx->gbm, frame_info->width, frame_info->height,
frame_info->format, flags);
if (buffer->bo == NULL) { if (buffer->bo == NULL) {
logprint(ERROR, "xdpw: failed to create gbm_bo"); logprint(ERROR, "xdpw: failed to create gbm_bo");
free(buffer); free(buffer);