aboutsummaryrefslogtreecommitdiff
path: root/render/allocator
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-01 17:47:56 +0200
committerAlexander Orzechowski <orzechowski.alexander@gmail.com>2022-10-01 19:45:29 +0000
commitd81f68d2b47f9794532c4650c912a386fbd3eefb (patch)
treea6e78ddb2a5809bec9528a5857ebe24e8c971560 /render/allocator
parent5ef8a18a2927e91db2c63a5e89c028f8aaa71443 (diff)
render/allocator/drm_dumb: check modifier list
Check that the modifier list passed as input contains either INVALID or LINEAR. We don't support others.
Diffstat (limited to 'render/allocator')
-rw-r--r--render/allocator/drm_dumb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/render/allocator/drm_dumb.c b/render/allocator/drm_dumb.c
index f477ce09..27aa1a8d 100644
--- a/render/allocator/drm_dumb.c
+++ b/render/allocator/drm_dumb.c
@@ -17,6 +17,7 @@
#include <xf86drmMode.h>
#include "render/allocator/drm_dumb.h"
+#include "render/drm_format_set.h"
#include "render/pixel_format.h"
static const struct wlr_buffer_impl buffer_impl;
@@ -47,6 +48,13 @@ static void finish_buffer(struct wlr_drm_dumb_buffer *buf) {
static struct wlr_drm_dumb_buffer *create_buffer(
struct wlr_drm_dumb_allocator *alloc, int width, int height,
const struct wlr_drm_format *format) {
+ if (!wlr_drm_format_has(format, DRM_FORMAT_MOD_INVALID) &&
+ !wlr_drm_format_has(format, DRM_FORMAT_MOD_LINEAR)) {
+ wlr_log(WLR_ERROR, "DRM dumb allocator only supports INVALID and "
+ "LINEAR modifiers");
+ return NULL;
+ }
+
struct wlr_drm_dumb_buffer *buffer = calloc(1, sizeof(*buffer));
if (buffer == NULL) {
return NULL;