mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
backend/drm: make drm_fb_acquire return a FB ID
This commit is contained in:
parent
d09abe86c1
commit
5ee8b12dc3
5 changed files with 36 additions and 44 deletions
|
|
@ -170,21 +170,7 @@ const char *conn_get_name(uint32_t type_id) {
|
|||
}
|
||||
}
|
||||
|
||||
static void free_fb(struct gbm_bo *bo, void *data) {
|
||||
uint32_t id = (uintptr_t)data;
|
||||
|
||||
if (id) {
|
||||
struct gbm_device *gbm = gbm_bo_get_device(bo);
|
||||
drmModeRmFB(gbm_device_get_fd(gbm), id);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_fb_for_bo(struct gbm_bo *bo, bool with_modifiers) {
|
||||
uint32_t id = (uintptr_t)gbm_bo_get_user_data(bo);
|
||||
if (id) {
|
||||
return id;
|
||||
}
|
||||
|
||||
struct gbm_device *gbm = gbm_bo_get_device(bo);
|
||||
|
||||
int fd = gbm_device_get_fd(gbm);
|
||||
|
|
@ -204,6 +190,7 @@ uint32_t get_fb_for_bo(struct gbm_bo *bo, bool with_modifiers) {
|
|||
modifiers[i] = gbm_bo_get_modifier(bo);
|
||||
}
|
||||
|
||||
uint32_t id = 0;
|
||||
if (with_modifiers && gbm_bo_get_modifier(bo) != DRM_FORMAT_MOD_INVALID) {
|
||||
if (drmModeAddFB2WithModifiers(fd, width, height, format, handles,
|
||||
strides, offsets, modifiers, &id, DRM_MODE_FB_MODIFIERS)) {
|
||||
|
|
@ -216,8 +203,6 @@ uint32_t get_fb_for_bo(struct gbm_bo *bo, bool with_modifiers) {
|
|||
}
|
||||
}
|
||||
|
||||
gbm_bo_set_user_data(bo, (void *)(uintptr_t)id, free_fb);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue