mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
render: add wlr_egl_create_from_drm_fd function
This commit is contained in:
parent
62f37ee319
commit
ee31be167b
3 changed files with 147 additions and 44 deletions
|
|
@ -251,22 +251,12 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
|
|||
}
|
||||
|
||||
struct wlr_renderer *wlr_renderer_autocreate_with_drm_fd(int drm_fd) {
|
||||
struct gbm_device *gbm_device = gbm_create_device(drm_fd);
|
||||
if (!gbm_device) {
|
||||
wlr_log(WLR_ERROR, "Failed to create GBM device");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_egl *egl = wlr_egl_create(EGL_PLATFORM_GBM_KHR, gbm_device,
|
||||
NULL);
|
||||
struct wlr_egl *egl = wlr_egl_create_from_drm_fd(drm_fd);
|
||||
if (egl == NULL) {
|
||||
wlr_log(WLR_ERROR, "Could not initialize EGL");
|
||||
gbm_device_destroy(gbm_device);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
egl->gbm_device = gbm_device;
|
||||
|
||||
struct wlr_renderer *renderer = wlr_gles2_renderer_create(egl);
|
||||
if (!renderer) {
|
||||
wlr_log(WLR_ERROR, "Failed to create GLES2 renderer");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue