From 8088cb6f53ddf6313fefce2789f657e595f3a489 Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Tue, 26 Sep 2017 16:23:58 -0700 Subject: [PATCH] svga: add sample count to the surface_can_create interface With this patch, sample count is also taken into account when determining if a resource can be created. Reviewed-by: Brian Paul --- src/gallium/drivers/svga/svga_resource.c | 5 ++++- src/gallium/drivers/svga/svga_winsys.h | 3 ++- src/gallium/winsys/svga/drm/vmw_screen_svga.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index 874cfa07223..b9dca1ede2b 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -85,6 +85,7 @@ svga_can_create_resource(struct pipe_screen *screen, SVGA3dSize base_level_size; uint32 numMipLevels; uint32 arraySize; + uint32 numSamples; if (res->target == PIPE_BUFFER) { format = SVGA3D_BUFFER; @@ -93,6 +94,7 @@ svga_can_create_resource(struct pipe_screen *screen, base_level_size.depth = 1; numMipLevels = 1; arraySize = 1; + numSamples = 0; } else { if (res->target == PIPE_TEXTURE_CUBE) @@ -107,10 +109,11 @@ svga_can_create_resource(struct pipe_screen *screen, base_level_size.depth = res->depth0; numMipLevels = res->last_level + 1; arraySize = res->array_size; + numSamples = res->nr_samples; } return sws->surface_can_create(sws, format, base_level_size, - arraySize, numMipLevels); + arraySize, numMipLevels, numSamples); } diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h index e8fe3e205a9..a067a7ba09d 100644 --- a/src/gallium/drivers/svga/svga_winsys.h +++ b/src/gallium/drivers/svga/svga_winsys.h @@ -583,7 +583,8 @@ struct svga_winsys_screen SVGA3dSurfaceFormat format, SVGA3dSize size, uint32 numLayers, - uint32 numMipLevels); + uint32 numMipLevels, + uint32 numSamples); /** * Buffer management. Buffer attributes are mostly fixed over its lifetime. diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c index 9decf0c7053..0157f60c855 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c @@ -309,7 +309,8 @@ vmw_svga_winsys_surface_can_create(struct svga_winsys_screen *sws, SVGA3dSurfaceFormat format, SVGA3dSize size, uint32 numLayers, - uint32 numMipLevels) + uint32 numMipLevels, + uint32 numSamples) { struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); uint32_t buffer_size; @@ -317,6 +318,9 @@ vmw_svga_winsys_surface_can_create(struct svga_winsys_screen *sws, buffer_size = svga3dsurface_get_serialized_size(format, size, numMipLevels, numLayers); + if (numSamples > 1) + buffer_size *= numSamples; + if (buffer_size > vws->ioctl.max_texture_size) { return FALSE; } -- 2.30.2