mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
render/allocator: add allocator_autocreate_with_drm_fd
Same as wlr_allocator_autocreate, but allows the caller to force a DRM FD. Similar to renderer_autocreate_with_drm_fd.
This commit is contained in:
parent
619a975025
commit
5be76bb047
2 changed files with 13 additions and 3 deletions
|
@ -46,4 +46,7 @@ struct wlr_buffer *wlr_allocator_create_buffer(struct wlr_allocator *alloc,
|
||||||
void wlr_allocator_init(struct wlr_allocator *alloc,
|
void wlr_allocator_init(struct wlr_allocator *alloc,
|
||||||
const struct wlr_allocator_interface *impl);
|
const struct wlr_allocator_interface *impl);
|
||||||
|
|
||||||
|
struct wlr_allocator *allocator_autocreate_with_drm_fd(
|
||||||
|
struct wlr_backend *backend, struct wlr_renderer *renderer, int drm_fd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,11 +18,11 @@ void wlr_allocator_init(struct wlr_allocator *alloc,
|
||||||
wl_signal_init(&alloc->events.destroy);
|
wl_signal_init(&alloc->events.destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
|
struct wlr_allocator *allocator_autocreate_with_drm_fd(
|
||||||
struct wlr_renderer *renderer) {
|
struct wlr_backend *backend, struct wlr_renderer *renderer,
|
||||||
|
int drm_fd) {
|
||||||
uint32_t backend_caps = backend_get_buffer_caps(backend);
|
uint32_t backend_caps = backend_get_buffer_caps(backend);
|
||||||
uint32_t renderer_caps = renderer_get_render_buffer_caps(renderer);
|
uint32_t renderer_caps = renderer_get_render_buffer_caps(renderer);
|
||||||
int drm_fd = wlr_backend_get_drm_fd(backend);
|
|
||||||
|
|
||||||
struct wlr_allocator *alloc = NULL;
|
struct wlr_allocator *alloc = NULL;
|
||||||
uint32_t gbm_caps = WLR_BUFFER_CAP_DMABUF;
|
uint32_t gbm_caps = WLR_BUFFER_CAP_DMABUF;
|
||||||
|
@ -51,6 +51,13 @@ struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
|
||||||
|
struct wlr_renderer *renderer) {
|
||||||
|
// Note, drm_fd may be negative if unavailable
|
||||||
|
int drm_fd = wlr_backend_get_drm_fd(backend);
|
||||||
|
return allocator_autocreate_with_drm_fd(backend, renderer, drm_fd);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_allocator_destroy(struct wlr_allocator *alloc) {
|
void wlr_allocator_destroy(struct wlr_allocator *alloc) {
|
||||||
if (alloc == NULL) {
|
if (alloc == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue