svga: add sample count to the surface_can_create interface
authorCharmaine Lee <charmainel@vmware.com>
Tue, 26 Sep 2017 23:23:58 +0000 (16:23 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 10 Sep 2018 19:07:30 +0000 (13:07 -0600)
With this patch, sample count is also taken into account
when determining if a resource can be created.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_resource.c
src/gallium/drivers/svga/svga_winsys.h
src/gallium/winsys/svga/drm/vmw_screen_svga.c

index 874cfa072235448daab64822f16360263a4d011e..b9dca1ede2bcba3d5a7a2d2a6e4fef69e1fd8e4a 100644 (file)
@@ -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);
 }
 
 
index e8fe3e205a9c3f3e264480e8fee41dcc61d403d4..a067a7ba09d04514bf32c8932f516c3d26d90394 100644 (file)
@@ -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.
index 9decf0c70530b9f689ee8ee6b90fae7853a05cf1..0157f60c855a7399160912e5e537cff801acebb3 100644 (file)
@@ -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;
    }