mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
backend/drm: add basic support for direct scan-out
This commit is contained in:
parent
3dec88e455
commit
96d6fde5dc
7 changed files with 105 additions and 7 deletions
|
|
@ -184,21 +184,18 @@ uint32_t get_fb_for_bo(struct gbm_bo *bo, uint32_t drm_format) {
|
|||
return id;
|
||||
}
|
||||
|
||||
assert(gbm_bo_get_format(bo) == GBM_FORMAT_ARGB8888);
|
||||
assert(drm_format == DRM_FORMAT_ARGB8888 ||
|
||||
drm_format == DRM_FORMAT_XRGB8888);
|
||||
|
||||
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 handles[4] = {gbm_bo_get_handle(bo).u32};
|
||||
uint32_t pitches[4] = {gbm_bo_get_stride(bo)};
|
||||
uint32_t strides[4] = {gbm_bo_get_stride(bo)};
|
||||
uint32_t offsets[4] = {gbm_bo_get_offset(bo, 0)};
|
||||
uint64_t modifiers[4] = {gbm_bo_get_modifier(bo)};
|
||||
|
||||
if (drmModeAddFB2(fd, width, height, drm_format,
|
||||
handles, pitches, offsets, &id, 0)) {
|
||||
if (drmModeAddFB2WithModifiers(fd, width, height, drm_format,
|
||||
handles, strides, offsets, modifiers, &id, DRM_MODE_FB_MODIFIERS)) {
|
||||
wlr_log_errno(WLR_ERROR, "Unable to add DRM framebuffer");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue