-
Notifications
You must be signed in to change notification settings - Fork 341
Conversation
I've gotten to the point where |
Reminder that this design:
BTW, here is a WIP patch that advertises devices in linux-dmabuf: https://lists.freedesktop.org/archives/wayland-devel/2018-November/039577.html (note that devices are advertised per surface, not globally) |
This is a use case I'm really not interested in. Considering there are no known (relevant) compositors that don't support this, it's a lot of effort for nobody.
Not impossible; just not 100% guaranteed to work. gbm_bos are mmapable in most cases.
Considering it hasn't been touched in over 8 months, I've given up on it for the time being. Right now, GBM is the only viable option, so I'm completely fine with depending on that. |
You still need to get a render node. This isn't even in the current linux-dmabuf protocol.
This would not be viable, as you'll end up doing roundtrips between the GPU and the main memory all the time. I'd like to implement a software renderer for a display manager.
This means the FD needs to be per-output, not per-backend. |
Sure. Obviously I'll add that when it's actually made part of the protocol.
I suppose. The allocation model for software renderers is completely different than what's here (backend allocated instead of renderer allocated), and it seems like trying to cram the allocations into the same API would be a mistake. I have an idea about how that may work, but I'll think about it some more.
That certainly causes some issues. That basically mandates that multiple renderers becomes a solved problem. |
backend/backend.c
Outdated
return -1; | ||
} | ||
|
||
struct wlr_format_set *wlr_backend_get_formats(struct wlr_backend *backend) { |
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.
This can probably be const
backend/wayland/output.c
Outdated
return false; | ||
} | ||
if (output->scheduled) { | ||
struct wlr_wl_buffer *buffer = gbm_bo_get_user_data(output->scheduled); |
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.
This is pretty weird. The frame event means "please render", not "please commit". Instead we should call wlr_output_send_frame
here, and let the compositor swap buffers to commit.
backend/wayland/output.c
Outdated
* our rendering loop, so we start it again by sending a frame event. | ||
*/ | ||
if (!output->frame_callback) { | ||
wlr_output_send_frame(&output->wlr_output); |
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.
This is pretty fragile.
backend/wayland/output.c
Outdated
free(buffer); | ||
} | ||
|
||
static bool output_schedule_frame(struct wlr_output *wlr_output, struct gbm_bo *bo, |
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.
output_schedule_frame
should schedule a frame event, and should not submit a frame.
8eaba28
to
caa5903
Compare
Now I've gotten the X11 backend to successfully render I also "ported" the multi backend to this, but it made me realise that it REALLY doesn't play nicely with this interface. We need to direct allocations to a specific backend, and the multi backend just can't know who it's supposed to be destined for. |
Please don't make so massive that it becomes impossible to review (it's already). You can open another PR if you want to do this. ;_;
Yeah I'm not sure how we can fix this. |
Speaking of the size of this PR, what's your plan to get this merged? Do you just use this as a experimentation playground and intend to break it into smaller chunks? (I can help doing that) I'm afraid about what happened to the other "renderer redesign" PRs, last time they were just closed and it took quite some time to gradually port changes. |
I'll probably rebase it pretty soon so there is a sane commit history to review and work off of. Perhaps I could also change things so it's more of a "introduce new thing -> gradually change everything to use it -> remove old thing" instead of "change everything at once". |
Note that this doesn't necessarily mean multiple renderers. The compositor could still use only one GPU for rendering, and the others just for direct scan-out. We still need to advertise multiple GPUs to clients. |
Mesa uses |
render/egl.c
Outdated
}; | ||
eglDebugMessageControlKHR(egl_log, debug_attribs); | ||
// This implies EGL_EXT_platform_base | ||
if (!strstr(client_exts, "EGL_MESA_platform_gbm")) { |
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.
Don't use strstr
, some extension names are prefixes of other extensions, this has caused issues in the past.
render/gles2/renderer.c
Outdated
.vert_src = quad_vertex_src, | ||
.frag_src = quad_fragment_src, | ||
.num_uniforms = 2, | ||
.uniforms = (struct uniform []) { |
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.
Does this work? All elements aren't of the same size anymore…
Have you designed the API such that the DRM |
This is something I was planning to do. We don't need to expose our modesetting FD over the API. at least not over that function.
Yes, I believe that would work. It was also something I was thinking about doing as part of this PR. |
caa5903
to
4a84b46
Compare
It no longer removes old interfaces, which will instead be delayed until the very end. |
I've added some functions to |
* This is not applied until the next call to wlr_output_present. | ||
* | ||
* Not every backend supports this. | ||
* TODO: Add a way to query if it's supported ahead of time. |
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.
This function should probably return a bool
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.
Yeah, I was originally thinking that, but if this ends up being not supported, this affects how you're going to render things, and you'd probably call this function after you've done that.
I think the way to check needs to be done earlier and without changing the output state.
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 see. Then just add a function that checks that impl->set_viewport != NULL
and assert this in wlr_output_set_viewport
?
Maybe we could rename
Yeah that sounds good. |
c4cb676
to
4e2e5e8
Compare
This types adds a container for formats + modifiers. A list that is of [format [modifier]] was chosen instead of [format modifer] because that is how GBM accepts them.
This has a _2 suffix to not conflict with the current API, which can be removed later.
This fixes the build on FreeBSD, which does not have these.
This just contains a couple of utility functions for interacting with wlroots' types.
Needs rebase |
@ascent12 Any chance at a rebase my friend? |
@panaman67 I intend to try and get most of this merged through separate PRs; it'll be too monstrously massive doing it this way. Maybe when I get to the point of actually changing wlr_renderer after laying all of the groundwork elsewhere, I could do that here to tie everything in a nice little bow, but this is mainly just sitting here for me to cherry-pick commits off. I've been very fickle about what I've been working on, and have only been working on this on-and-off in my own spare time mainly, so it's been slow progress. I'd certainly accept any help from anybody who is interested in getting their hands dirty in wlroots internals and wants to get work like this done more quickly. |
Almost all of this has now been merged, incrementally and slightly updated (mostly to accommodate for the software renderer). Thanks for working on this PR, it's been instrumental for the renderer v6 refactoring! |
Closes #1352
Just to be clear, this is still VERY much a work-in-progress. If I were to guess, I would say that it's only about
5%10%20% done.I'm posting this now just to let people see what I'm doing and get feedback before I go too deep into changing everything.
The code compiles, but that's about it. At this point, the entirety of the backends, examples, and rootston have been removed, just until they're updated. There are several #if 0 blocks around, as a "I'll get to it later" thing.I'm intending to build a mailbox swapchain (Vulkan terminology), which arises quite naturally from using dmabufs, and can allow for people who want to write renderers that go faster than the display's refresh rate. Here is a pretty good explanation of different swapchain types.