aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-12-06 12:00:33 +0100
committerAlexander Orzechowski <alex@ozal.ski>2024-02-21 08:54:35 +0000
commitcf7b91cc5fb02836956ea4323a4230171edea5e2 (patch)
tree8eaa94095f342e277ae06062dbb7750b0780e28a
parent431e8a7fd7d459d740e14f3ad9fd7a6aab62eeb8 (diff)
buffer: add single-pixel-buffer-v1 special case in buffer_is_opaque()
-rw-r--r--types/buffer/buffer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/types/buffer/buffer.c b/types/buffer/buffer.c
index b85518c1..953207a2 100644
--- a/types/buffer/buffer.c
+++ b/types/buffer/buffer.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <drm_fourcc.h>
#include <string.h>
#include <wlr/interfaces/wlr_buffer.h>
#include "render/pixel_format.h"
@@ -111,7 +112,16 @@ bool buffer_is_opaque(struct wlr_buffer *buffer) {
format = shm.format;
} else if (wlr_buffer_begin_data_ptr_access(buffer,
WLR_BUFFER_DATA_PTR_ACCESS_READ, &data, &format, &stride)) {
+ bool opaque = false;
+ if (buffer->width == 1 && buffer->height == 1 && format == DRM_FORMAT_ARGB8888) {
+ // Special case for single-pixel-buffer-v1
+ const uint8_t *argb8888 = data; // little-endian byte order
+ opaque = argb8888[3] == 0xFF;
+ }
wlr_buffer_end_data_ptr_access(buffer);
+ if (opaque) {
+ return true;
+ }
} else {
return false;
}