From 85d7c2b7d774b621c7921cbdcd38ecb47c44645e Mon Sep 17 00:00:00 2001 From: columbarius Date: Sun, 13 Sep 2020 23:11:55 +0200 Subject: [PATCH] Add dmabuf copy to pipewire_screencast.c --- src/screencast/pipewire_screencast.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/screencast/pipewire_screencast.c b/src/screencast/pipewire_screencast.c index 60c02c7c..36055ccc 100644 --- a/src/screencast/pipewire_screencast.c +++ b/src/screencast/pipewire_screencast.c @@ -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(); } @@ -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: