From 815d98c22d407b9a3a3377d829152ed8649260fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 28 Mar 2021 06:23:02 -0400 Subject: [PATCH] gallium/pb: remove 8 bytes from pb_buffer by packing variables Only svga used usages beyond 16 bits. All other drivers are OK with 16 bits. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/auxiliary/pipebuffer/pb_buffer.h | 15 +++++++-------- src/gallium/winsys/svga/drm/vmw_buffer.h | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index 6ae26e1df17..8c0545505d5 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -112,24 +112,23 @@ struct pb_buffer { struct pipe_reference reference; + /* For internal driver use. It's here so as not to waste space due to + * type alignment. (pahole) + */ + uint8_t placement; + /* Alignments are powers of two, so store only the bit position. * alignment_log2 = util_logbase2(alignment); * alignment = 1 << alignment_log2; */ uint8_t alignment_log2; - pb_size size; - /** * Used with pb_usage_flags or driver-specific flags, depending on drivers. */ - unsigned usage; + uint16_t usage; - /** - * For internal driver use. It's here so as not to waste space due to - * type alignment. (pahole) - */ - unsigned placement; + pb_size size; /** * Pointer to the virtual function table. diff --git a/src/gallium/winsys/svga/drm/vmw_buffer.h b/src/gallium/winsys/svga/drm/vmw_buffer.h index 8ed56d4aa1e..9e452e7e807 100644 --- a/src/gallium/winsys/svga/drm/vmw_buffer.h +++ b/src/gallium/winsys/svga/drm/vmw_buffer.h @@ -34,8 +34,8 @@ /* These extra flags are used wherever the pb_usage_flags enum type is used */ -#define VMW_BUFFER_USAGE_SHARED (1 << 20) -#define VMW_BUFFER_USAGE_SYNC (1 << 21) +#define VMW_BUFFER_USAGE_SHARED (1 << 14) +#define VMW_BUFFER_USAGE_SYNC (1 << 15) struct SVGAGuestPtr; struct pb_buffer;