Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support shm key and drm for rawfb option, this will support both x11 and wayland. #227

Merged
merged 4 commits into from
Aug 1, 2023

Conversation

linex-cd
Copy link
Contributor

@linex-cd linex-cd commented Jun 6, 2023

Sometime shmid is not same on different time or system, we should use a constant ID for shm. Here use shm key to instead.

Sometime shmid is not same on different time or system, we should use a constant ID for shm. Here use shm key to instead.
@linex-cd linex-cd changed the title Add support shm key for rawfb option Support shm key for rawfb option Jun 6, 2023
@linex-cd
Copy link
Contributor Author

linex-cd commented Jun 6, 2023

@bk138 Do you have time to look at this?

@bk138
Copy link
Member

bk138 commented Jun 6, 2023

@bk138 Do you have time to look at this?

Hi! I don't consider myself the maintainer anymore, but am willing to invest some time to hand things over, see #186.

access GPU with DRM, this will support x11 and wayland
@linex-cd linex-cd changed the title Support shm key for rawfb option Support shm key and drm for rawfb option, this will support both x11 and wayland. Jun 7, 2023
src/screen.c Outdated

shmkey = shmid;
size = w * h * b / 8;
newshmid = shmget(shmkey, size, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the man page,

A new shared memory segment, with size equal to the value of size rounded up to a multiple of PAGE_SIZE, is created if key has the value IPC_PRIVATE or key isn't IPC_PRIVATE, no
shared memory segment corresponding to key exists, and IPC_CREAT is specified in shmflg.

So this likely breaks the original behaviour where the user enters some shmid and expects the shmat() down below to attach this. With this change, it's very likely that a new shared memory segment is created; this is not what the users expect.

Copy link
Contributor Author

@linex-cd linex-cd Jun 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I made a mistake. For an existed shared memory, the size for shmget should be 0. Then this will not alloc new shared memory segment and use the old way to seek shmid.
The change has committed, thanks for your review!

shmget should be 0 otherwise it would alloc a new shared memory but not for the frame buffer.
@linex-cd linex-cd requested a review from bk138 June 9, 2023 06:50
@linex-cd
Copy link
Contributor Author

#229 Using drm backend will have a better performance.

src/screen.c Show resolved Hide resolved
src/x11vnc.h Show resolved Hide resolved
src/screen.c Show resolved Hide resolved
@linex-cd linex-cd requested a review from bk138 July 31, 2023 10:35
@bk138 bk138 merged commit a61f364 into LibVNC:master Aug 1, 2023
Stefichen5 pushed a commit to StefanMayrhofer/x11vnc that referenced this pull request Sep 18, 2023
This will support both x11 and Wayland. (LibVNC#227)

* Add support shm key for rawfb option

Sometime shmid is not same on different time or system, we should use a constant ID for shm. Here use shm key to instead.

* Add DRM support

access GPU with DRM, this will support x11 and wayland

* Fix a bug for shmget params.

shmget should be 0 otherwise it would alloc a new shared memory but not for the frame buffer.

* fix drm configure while compiling.
Stefichen5 pushed a commit to StefanMayrhofer/x11vnc that referenced this pull request Sep 18, 2023
This will support both x11 and Wayland. (LibVNC#227)

* Add support shm key for rawfb option

Sometime shmid is not same on different time or system, we should use a constant ID for shm. Here use shm key to instead.

* Add DRM support

access GPU with DRM, this will support x11 and wayland

* Fix a bug for shmget params.

shmget should be 0 otherwise it would alloc a new shared memory but not for the frame buffer.

* fix drm configure while compiling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants