Skip to content

Commit

Permalink
screencast: add fallback for linear modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Apr 14, 2023
1 parent 2366b4d commit 78dee83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/screencast/pipewire_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions src/screencast/screencast_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 78dee83

Please sign in to comment.