~scoopta/wlrobs

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH v2] Set mode when creating shm object

Jan Beich
Details
Message ID
<zhgq-1a2n-wny@FreeBSD.org>
DKIM signature
missing
Download raw message
Patch: +2 -1
Similar to https://github.com/cyclopsian/wdisplays/pull/6

$ obs
[...]
info: Loaded scenes:
info: - scene 'Scene':
info:     - source: 'Wayland output' (wlrobs)
info: ------------------------------------------------
dup failed: Bad file descriptor
Abort

$ posixshmcontrol ls
MODE            OWNER   GROUP   SIZE    PATH
---------       foo     foo     33177600        /wlrobs
---
 inc/wlr_source.h | 1 +
 src/wlr_source.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/inc/wlr_source.h b/inc/wlr_source.h
index 5b6ba71..91b5615 100644
--- a/inc/wlr_source.h
+++ b/inc/wlr_source.h
@@ -19,16 +19,17 @@
#define WLR_SOURCE_H

#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
#include <sys/mman.h>
#include <sys/stat.h>

#include <obs/obs-module.h>

#include <wayland-client.h>

#include <xdg-output-unstable-v1-client-protocol.h>
#include <wlr-screencopy-unstable-v1-client-protocol.h>

diff --git a/src/wlr_source.c b/src/wlr_source.c
index 29dafdf..1c21a26 100644
--- a/src/wlr_source.c
+++ b/src/wlr_source.c
@@ -179,17 +179,17 @@ static void buffer(void* data, struct zwlr_screencopy_frame_v1* frame, uint32_t
		free(this->frame);
	}
	this->frame = malloc(sizeof(struct wlr_frame));
	this->frame->format = format;
	this->frame->width = width;
	this->frame->height = height;
	this->frame->stride = stride;
	this->frame->size = stride * height;
	this->frame->fd = shm_open("/wlrobs", O_CREAT | O_RDWR, 0);
	this->frame->fd = shm_open("/wlrobs", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
	shm_unlink("/wlrobs");
	ftruncate(this->frame->fd, stride * height);
	this->frame->pool = wl_shm_create_pool(this->shm, this->frame->fd, stride * height);
	this->frame->buffer = wl_shm_pool_create_buffer(this->frame->pool, 0, width, height, stride, format);
	zwlr_screencopy_frame_v1_copy(frame, this->frame->buffer);
}

static void ready(void* data, struct zwlr_screencopy_frame_v1* frame, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec) {
Scoopta
Details
Message ID
<b820b5c8-1aab-12fd-676e-f2b304b9515c@scoopta.email>
In-Reply-To
<zhgq-1a2n-wny@FreeBSD.org> (view parent)
DKIM signature
missing
Download raw message
Thanks for this
Reply to thread Export thread (mbox)