render: introduce private wlr_renderer_autocreate_with_drm_fd
This commit is contained in:
parent
32c30481d3
commit
2f11914613
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically select and create a renderer suitable for the DRM FD.
|
||||||
|
*/
|
||||||
|
struct wlr_renderer *wlr_renderer_autocreate_with_drm_fd(int drm_fd);
|
||||||
/**
|
/**
|
||||||
* Bind a buffer to the renderer.
|
* Bind a buffer to the renderer.
|
||||||
*
|
*
|
||||||
|
|
|
@ -250,14 +250,8 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend) {
|
struct wlr_renderer *wlr_renderer_autocreate_with_drm_fd(int drm_fd) {
|
||||||
int fd = backend_get_drm_fd(backend);
|
struct gbm_device *gbm_device = gbm_create_device(drm_fd);
|
||||||
if (fd < 0) {
|
|
||||||
wlr_log(WLR_ERROR, "Failed to get DRM FD from backend");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct gbm_device *gbm_device = gbm_create_device(fd);
|
|
||||||
if (!gbm_device) {
|
if (!gbm_device) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create GBM device");
|
wlr_log(WLR_ERROR, "Failed to create GBM device");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -282,6 +276,16 @@ struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend) {
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend) {
|
||||||
|
int drm_fd = backend_get_drm_fd(backend);
|
||||||
|
if (drm_fd < 0) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to get DRM FD from backend");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wlr_renderer_autocreate_with_drm_fd(drm_fd);
|
||||||
|
}
|
||||||
|
|
||||||
int wlr_renderer_get_drm_fd(struct wlr_renderer *r) {
|
int wlr_renderer_get_drm_fd(struct wlr_renderer *r) {
|
||||||
if (!r->impl->get_drm_fd) {
|
if (!r->impl->get_drm_fd) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue