-
Notifications
You must be signed in to change notification settings - Fork 167
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
DrmOutputManager #1576
base: master
Are you sure you want to change the base?
DrmOutputManager #1576
Conversation
src/backend/drm/output.rs
Outdated
DrmDevice, DrmError, Planes, | ||
}; | ||
|
||
type CompositorList<A, F, U, G> = Arc<RwLock<HashMap<crtc::Handle, RefCell<DrmCompositor<A, F, U, G>>>>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i understand correctly, RefCell
is !Sync
, which would make CompositorList
both !Sync
and !Send
, making Arc<RwLock<>>
pointless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, sigh. !Sync
is intended/expected, it should be Send
, I guess this is blocked on the PixmanRenderer
not being Send
:(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'm a little confused. Arc<T>
is Sync
or Send
requires T
to be both Sync
and Send
, but RefCell<T>
is unconditional !Sync
. I think RefCell<T>
should be removed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RwLock
or Mutex
add the Sync
bound, so our T
is just required to be Send
, which is indeed blocked on pixman-rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at it again we indeed need to use Mutex instead of the Refcell because RwLock requires Sync for read access.
This is the easy part, unfortunately DrmCompositor is not Send atm. Currently looking into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, DrmCompositor
is now Send
as long as the allocator buffer and the framebuffer are Send + Sync
. This allows DrmOutputManager
to be Send
and DrmOutput
to implement Send
and Sync
.
Notes
/// Allow to realize the frame by assigning elements on planes | ||
const SCANOUT = Self::PRIMARY_PLANE_SCANOUT.bits() | Self::OVERLAY_PLANE_SCANOUT.bits() | Self::CURSOR_PLANE_SCANOUT.bits(); | ||
|
||
const ALL = Self::COMPOSITE.bits() | Self::SCANOUT.bits(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to make this even more complicated, but in the future I would really like to have the option to direct scanout a fullscreen surface in cosmic-comp and then composite the rest onto an overlay plane.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I don't think this will fit in the current DrmCompositor API. This will require allowing custom assign algorithms. What I have in mind is that we make something similar to the FrameState public and actually externalize the whole assigning algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. (And is also not a very important problem atm.)
|
||
let current_format = compositor.format(); | ||
if let Err(err) = | ||
compositor.set_format(self.allocator.clone(), current_format, [DrmModifier::Invalid]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want to first disable overlay planes and then fallback to no-modifer instead of doing both at the same time?
The former happens a lot more frequently on recent gpus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, this is more to provide a PoC
542a21a
to
b10a373
Compare
Hey guys I have an idea about getting rid of the We access RwLock::write()In this case, we can be sure that access is unique, RwLock::read()This is the case we really need to care about. From the code I can see While the
Then the
And the
All these are just theoretical and may be too tricky😮💨. I don't know how you guys think about it. |
highly wip of the ideas described here: pop-os/cosmic-comp#969 (comment)
it implements most of the stuff, except:
not extensively tested, but anvil seems to still be able to launch.
returning an error from
DrmCompositor::new
also successfully triggers the format selectionlogic
TODO
A lot...
If this turns out to be problematic we can disable the event for
commit_frame
, but we need to make sureto kick off rendering in this case somehow..