diff options
Diffstat (limited to 'backend/drm/util.c')
-rw-r--r-- | backend/drm/util.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/backend/drm/util.c b/backend/drm/util.c index 69748fcf..5041ab9a 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -2,7 +2,6 @@ #include <drm_fourcc.h> #include <drm_mode.h> #include <drm.h> -#include <gbm.h> #include <stdio.h> #include <string.h> #include <wlr/util/log.h> @@ -175,56 +174,6 @@ const char *conn_get_name(uint32_t type_id) { } } -uint32_t get_fb_for_bo(struct gbm_bo *bo, bool with_modifiers) { - struct gbm_device *gbm = gbm_bo_get_device(bo); - - int fd = gbm_device_get_fd(gbm); - uint32_t width = gbm_bo_get_width(bo); - uint32_t height = gbm_bo_get_height(bo); - uint32_t format = gbm_bo_get_format(bo); - - uint32_t handles[4] = {0}; - uint32_t strides[4] = {0}; - uint32_t offsets[4] = {0}; - uint64_t modifiers[4] = {0}; - for (int i = 0; i < gbm_bo_get_plane_count(bo); i++) { - handles[i] = gbm_bo_get_handle_for_plane(bo, i).u32; - strides[i] = gbm_bo_get_stride_for_plane(bo, i); - offsets[i] = gbm_bo_get_offset(bo, i); - // KMS requires all BO planes to have the same modifier - 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)) { - wlr_log_errno(WLR_ERROR, "Unable to add DRM framebuffer"); - } - } else { - int ret = drmModeAddFB2(fd, width, height, format, handles, strides, - offsets, &id, 0); - if (ret != 0 && gbm_bo_get_format(bo) == GBM_FORMAT_ARGB8888 && - gbm_bo_get_plane_count(bo) == 1) { - // Some big-endian machines don't support drmModeAddFB2. Try a - // last-resort fallback for ARGB8888 buffers, like Xorg's - // modesetting driver does. - wlr_log(WLR_DEBUG, "drmModeAddFB2 failed (%s), falling back to " - "legacy drmModeAddFB", strerror(-ret)); - - uint32_t depth = 32; - uint32_t bpp = gbm_bo_get_bpp(bo); - ret = drmModeAddFB(fd, width, height, depth, bpp, strides[0], - handles[0], &id); - } - if (ret != 0) { - wlr_log(WLR_ERROR, "Unable to add DRM framebuffer: %s", strerror(-ret)); - } - } - - return id; -} - static bool is_taken(size_t n, const uint32_t arr[static n], uint32_t key) { for (size_t i = 0; i < n; ++i) { if (arr[i] == key) { |