mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
Remove unused data from gbm_bo userdata
These aren't used anymore and crashes when the gbm_bo tries to get destroyed (e.g. on hotplug).
This commit is contained in:
parent
4bee710c30
commit
1a2b3445dc
1 changed files with 10 additions and 27 deletions
|
@ -188,46 +188,29 @@ bool export_drm_bo(struct gbm_bo *bo, struct wlr_dmabuf_attributes *attribs) {
|
|||
return true;
|
||||
}
|
||||
|
||||
struct tex {
|
||||
struct wlr_egl *egl;
|
||||
EGLImageKHR img;
|
||||
struct wlr_texture *tex;
|
||||
};
|
||||
|
||||
static void free_eglimage(struct gbm_bo *bo, void *data) {
|
||||
struct tex *tex = data;
|
||||
|
||||
wlr_egl_destroy_image(tex->egl, tex->img);
|
||||
wlr_texture_destroy(tex->tex);
|
||||
free(tex);
|
||||
static void free_tex(struct gbm_bo *bo, void *data) {
|
||||
struct wlr_texture *tex = data;
|
||||
wlr_texture_destroy(tex);
|
||||
}
|
||||
|
||||
static struct wlr_texture *get_tex_for_bo(struct wlr_drm_renderer *renderer,
|
||||
struct gbm_bo *bo) {
|
||||
struct tex *tex = gbm_bo_get_user_data(bo);
|
||||
if (tex != NULL) {
|
||||
return tex->tex;
|
||||
}
|
||||
|
||||
tex = calloc(1, sizeof(struct tex));
|
||||
if (tex == NULL) {
|
||||
return NULL;
|
||||
struct wlr_texture *tex = gbm_bo_get_user_data(bo);
|
||||
if (tex) {
|
||||
return tex;
|
||||
}
|
||||
|
||||
struct wlr_dmabuf_attributes attribs;
|
||||
if (!export_drm_bo(bo, &attribs)) {
|
||||
free(tex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tex->tex = wlr_texture_from_dmabuf(renderer->wlr_rend, &attribs);
|
||||
if (tex->tex == NULL) {
|
||||
free(tex);
|
||||
return NULL;
|
||||
tex = wlr_texture_from_dmabuf(renderer->wlr_rend, &attribs);
|
||||
if (tex) {
|
||||
gbm_bo_set_user_data(bo, tex, free_tex);
|
||||
}
|
||||
|
||||
gbm_bo_set_user_data(bo, tex, free_eglimage);
|
||||
return tex->tex;
|
||||
return tex;
|
||||
}
|
||||
|
||||
struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest,
|
||||
|
|
Loading…
Reference in a new issue