backend-drm: always create gem_handle_refcnt hash table

Devices created via drm_device_create have this hash table, but those
created via drm_backend_create don't.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
This commit is contained in:
Ray Smith 2023-12-19 11:45:45 +00:00 committed by Daniel Stone
parent 80f096d9d2
commit e79600483f

View file

@ -3417,8 +3417,7 @@ drm_destroy(struct weston_backend *backend)
weston_launcher_close(ec->launcher, device->drm.fd);
weston_launcher_destroy(ec->launcher);
if (device->gem_handle_refcnt)
hash_table_destroy(device->gem_handle_refcnt);
hash_table_destroy(device->gem_handle_refcnt);
free(device->drm.filename);
free(device);
@ -3920,10 +3919,13 @@ drm_backend_create(struct weston_compositor *compositor,
device = zalloc(sizeof *device);
if (device == NULL)
return NULL;
goto err_backend;
device->state_invalid = true;
device->drm.fd = -1;
device->backend = b;
device->gem_handle_refcnt = hash_table_create();
if (!device->gem_handle_refcnt)
goto err_device;
b->drm = device;
wl_list_init(&b->kms_list);
@ -4158,6 +4160,10 @@ err_compositor:
if (b->gbm)
gbm_device_destroy(b->gbm);
#endif
hash_table_destroy(device->gem_handle_refcnt);
err_device:
free(device);
err_backend:
free(b);
return NULL;
}