weston_buffer: Add type field

Rather than open-coding various resource -> type accessors, just stick a
type enum in the buffer struct.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone
2022-01-14 01:09:51 +00:00
parent 1d5f8af82e
commit 34cd0d114f
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -1177,10 +1177,18 @@ struct weston_buffer {
struct wl_signal destroy_signal;
struct wl_listener destroy_listener;
enum {
WESTON_BUFFER_SHM,
WESTON_BUFFER_DMABUF,
WESTON_BUFFER_RENDERER_OPAQUE,
} type;
union {
struct wl_shm_buffer *shm_buffer;
void *dmabuf;
void *legacy_buffer;
};
int32_t width, height;
uint32_t busy_count;
int y_inverted;