diff options
Diffstat (limited to 'render/allocator')
-rw-r--r-- | render/allocator/drm_dumb.c | 6 | ||||
-rw-r--r-- | render/allocator/shm.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/render/allocator/drm_dumb.c b/render/allocator/drm_dumb.c index 08ee0f0e..684ba2e3 100644 --- a/render/allocator/drm_dumb.c +++ b/render/allocator/drm_dumb.c @@ -44,6 +44,9 @@ static struct wlr_drm_dumb_buffer *create_buffer( wlr_log(WLR_ERROR, "DRM format 0x%"PRIX32" not supported", format->format); return NULL; + } else if (pixel_format_info_pixels_per_block(info) != 1) { + wlr_log(WLR_ERROR, "Block formats are not supported"); + return NULL; } struct wlr_drm_dumb_buffer *buffer = calloc(1, sizeof(*buffer)); @@ -55,7 +58,8 @@ static struct wlr_drm_dumb_buffer *create_buffer( buffer->drm_fd = alloc->drm_fd; - if (drmModeCreateDumbBuffer(alloc->drm_fd, width, height, info->bpp, 0, + uint32_t bpp = 8 * info->bytes_per_block; + if (drmModeCreateDumbBuffer(alloc->drm_fd, width, height, bpp, 0, &buffer->handle, &buffer->stride, &buffer->size) != 0) { wlr_log_errno(WLR_ERROR, "Failed to create DRM dumb buffer"); goto create_destroy; diff --git a/render/allocator/shm.c b/render/allocator/shm.c index 9e49a144..55a8fab2 100644 --- a/render/allocator/shm.c +++ b/render/allocator/shm.c @@ -71,8 +71,7 @@ static struct wlr_buffer *allocator_create_buffer( wlr_buffer_init(&buffer->base, &buffer_impl, width, height); // TODO: consider using a single file for multiple buffers - int bytes_per_pixel = info->bpp / 8; - int stride = width * bytes_per_pixel; // TODO: align? + int stride = pixel_format_info_min_stride(info, width); // TODO: align? buffer->size = stride * height; buffer->shm.fd = allocate_shm_file(buffer->size); if (buffer->shm.fd < 0) { |