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

Use strong references to gbm_device in Surface/BufferObject #25

Merged
merged 4 commits into from
Dec 2, 2024

Conversation

ids1024
Copy link
Member

@ids1024 ids1024 commented Aug 17, 2023

Using a strong reference is the most obvious way to address Smithay/smithay#1102. And getting rid of DeviceDestroyedError makes the API a fair bit cleaner.

Though Device.fd will also need to be reference counted for this to fix the issue here. Presumably. And this will need testing. Leaving as a draft at the moment.

Any reason not to do this, or why it may cause problems? I guess Device will require T: Sync...

Eliminates `DeviceDestroyedError` from the API, which makes the crate
easier to use.
ids1024 added a commit to ids1024/smithay that referenced this pull request Nov 21, 2024
@ids1024 ids1024 changed the title WIP Use strong references to gbm_device in Surface/BufferObject Use strong references to gbm_device in Surface/BufferObject Nov 21, 2024
@ids1024 ids1024 marked this pull request as ready for review November 21, 2024 18:14
@ids1024
Copy link
Member Author

ids1024 commented Nov 21, 2024

Rebased, and updated Smithay to use this in Smithay/smithay#1594 for testing. This doesn't change much in Smithay, but is a bit neater.

src/buffer_object.rs Outdated Show resolved Hide resolved
src/buffer_object.rs Outdated Show resolved Hide resolved
src/buffer_object.rs Outdated Show resolved Hide resolved
src/surface.rs Outdated Show resolved Hide resolved
This appears to serve no purpose when we already have a strong reference
to the device.

And it's nice to get rid of the `Result<Result<..>, ..>`
Now this only has one variant, there's no need for an enum.
@ids1024 ids1024 requested a review from Drakulix December 2, 2024 17:11
@Drakulix Drakulix merged commit 9b5ab6a into Smithay:master Dec 2, 2024
16 checks passed
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