Minor fixes
This commit is contained in:
parent
009c3747a8
commit
f6f9c40965
|
@ -143,7 +143,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
|||
goto error_event;
|
||||
}
|
||||
|
||||
if (!wlr_drm_renderer_init(&drm->renderer, drm->fd)) {
|
||||
if (!wlr_drm_renderer_init(drm, &drm->renderer)) {
|
||||
wlr_log(L_ERROR, "Failed to initialize renderer");
|
||||
goto error_event;
|
||||
}
|
||||
|
|
|
@ -856,9 +856,13 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
|
|||
case WLR_DRM_CONN_CLEANUP:;
|
||||
struct wlr_drm_crtc *crtc = conn->crtc;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (!crtc->planes[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wlr_drm_surface_finish(&crtc->planes[i]->surf);
|
||||
wlr_drm_surface_finish(&crtc->planes[i]->mgpu_surf);
|
||||
if (crtc->planes[i] && crtc->planes[i]->id == 0) {
|
||||
if (crtc->planes[i]->id == 0) {
|
||||
free(crtc->planes[i]);
|
||||
crtc->planes[i] = NULL;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
#include <wlr/render.h>
|
||||
#include "backend/drm/drm.h"
|
||||
|
||||
bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer, int fd) {
|
||||
renderer->gbm = gbm_create_device(fd);
|
||||
bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
|
||||
struct wlr_drm_renderer *renderer) {
|
||||
renderer->gbm = gbm_create_device(drm->fd);
|
||||
if (!renderer->gbm) {
|
||||
wlr_log(L_ERROR, "Failed to create GBM device");
|
||||
return false;
|
||||
|
@ -24,15 +25,23 @@ bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer, int fd) {
|
|||
|
||||
if (!wlr_egl_init(&renderer->egl, EGL_PLATFORM_GBM_MESA,
|
||||
GBM_FORMAT_ARGB8888, renderer->gbm)) {
|
||||
gbm_device_destroy(renderer->gbm);
|
||||
return false;
|
||||
goto error_gbm;
|
||||
}
|
||||
|
||||
struct wlr_drm_backend *drm = wl_container_of(renderer, drm, renderer);
|
||||
renderer->wlr_rend = wlr_gles2_renderer_create(&drm->backend);
|
||||
if (!renderer->wlr_rend) {
|
||||
wlr_log(L_ERROR, "Failed to create WLR renderer");
|
||||
goto error_egl;
|
||||
}
|
||||
|
||||
renderer->fd = fd;
|
||||
renderer->fd = drm->fd;
|
||||
return true;
|
||||
|
||||
error_egl:
|
||||
wlr_egl_free(&renderer->egl);
|
||||
error_gbm:
|
||||
gbm_device_destroy(renderer->gbm);
|
||||
return false;
|
||||
}
|
||||
|
||||
void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) {
|
||||
|
@ -40,6 +49,7 @@ void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) {
|
|||
return;
|
||||
}
|
||||
|
||||
wlr_renderer_destroy(renderer->wlr_rend);
|
||||
wlr_egl_free(&renderer->egl);
|
||||
gbm_device_destroy(renderer->gbm);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <wlr/render.h>
|
||||
|
||||
struct wlr_drm_backend;
|
||||
struct wlr_drm_plane;
|
||||
|
||||
struct wlr_drm_renderer {
|
||||
|
@ -32,7 +33,8 @@ struct wlr_drm_surface {
|
|||
struct gbm_bo *back;
|
||||
};
|
||||
|
||||
bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer, int fd);
|
||||
bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
|
||||
struct wlr_drm_renderer *renderer);
|
||||
void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer);
|
||||
|
||||
bool wlr_drm_surface_init(struct wlr_drm_surface *surf,
|
||||
|
|
Loading…
Reference in New Issue