Skip to content

Commit

Permalink
Add dmabuf copy to pipewire_screencast.c
Browse files Browse the repository at this point in the history
  • Loading branch information
columbarius committed Sep 13, 2020
1 parent a78bf2b commit 85d7c2b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/screencast/pipewire_screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ void pwr_copy_screencast(struct spa_buffer *spa_buf, struct xdpw_screencast_inst
logprint(TRACE, "pipewire: height %d", cast->xdpw_frames.screencopy_frame.height);
logprint(TRACE, "pipewire: y_invert %d", cast->xdpw_frames.screencopy_frame.y_invert);
break;
case XDPW_INSTANCE_SCP_DMABUF:
d[0].type = SPA_DATA_DmaBuf;
d[0].maxsize = cast->xdpw_frames.screencopy_frame.size;
d[0].mapoffset = 0;
d[0].chunk->size = cast->xdpw_frames.screencopy_frame.size;
d[0].chunk->stride = cast->xdpw_frames.screencopy_frame.stride;
d[0].chunk->offset = 0;
d[0].flags = 0;
d[0].fd = gbm_bo_get_fd(cast->xdpw_frames.screencopy_frame.bo);

logprint(TRACE, "pipewire: fd %p", d[0].fd);
logprint(TRACE, "pipewire: size %d", d[0].maxsize);
logprint(TRACE, "pipewire: stride %d", d[0].chunk->stride);
logprint(TRACE, "pipewire: width %d", cast->xdpw_frames.screencopy_frame.width);
logprint(TRACE, "pipewire: height %d", cast->xdpw_frames.screencopy_frame.height);
break;
default:
abort();
}
Expand All @@ -84,6 +100,7 @@ static void pwr_on_event(void *data, uint64_t expirations) {

switch (cast->type) {
case XDPW_INSTANCE_SCP_SHM:
case XDPW_INSTANCE_SCP_DMABUF:
pwr_copy_screencast(pw_buf->buffer, cast);
break;
default:
Expand Down

0 comments on commit 85d7c2b

Please sign in to comment.