static struct svga_winsys_surface *
vmw_svga_winsys_surface_create(struct svga_winsys_screen *sws,
- SVGA3dSurfaceAllFlags allflags,
+ SVGA3dSurfaceAllFlags flags,
SVGA3dSurfaceFormat format,
unsigned usage,
SVGA3dSize size,
struct vmw_buffer_desc desc;
struct pb_manager *provider;
uint32_t buffer_size;
-
- /* Until the kernel supports 64 bits surface flag, the linux driver
- * only honors the lower 32 bits of the surface flag.
- */
- SVGA3dSurface1Flags flags = (SVGA3dSurface1Flags)allflags;
+ uint32_t num_samples = 1;
+ SVGA3dMSPattern multisample_pattern = SVGA3D_MS_PATTERN_NONE;
memset(&desc, 0, sizeof(desc));
surface = CALLOC_STRUCT(vmw_svga_winsys_surface);
surface->shared = !!(usage & SVGA_SURFACE_USAGE_SHARED);
provider = (surface->shared) ? vws->pools.gmr : vws->pools.mob_fenced;
+ /*
+ * When multisampling is not supported sample count received is 0,
+ * otherwise should have a valid sample count.
+ */
+ if ((flags & SVGA3D_SURFACE_MULTISAMPLE) != 0) {
+ if (sampleCount == 0)
+ goto no_sid;
+ num_samples = sampleCount;
+ multisample_pattern = SVGA3D_MS_PATTERN_STANDARD;
+ }
+
/*
* Used for the backing buffer GB surfaces, and to approximate
* when to flush on non-GB hosts.
*/
- buffer_size = svga3dsurface_get_serialized_size(format, size, numMipLevels,
- numLayers);
+ buffer_size = svga3dsurface_get_serialized_size_extended(format, size,
+ numMipLevels,
+ numLayers,
+ num_samples);
if (flags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT)
buffer_size += sizeof(SVGA3dDXSOState);
size, numLayers,
numMipLevels, sampleCount,
ptr.gmrId,
+ multisample_pattern,
surface->buf ? NULL :
&desc.region);
surface->sid = vmw_ioctl_gb_surface_create(vws, flags, format, usage,
size, numLayers,
numMipLevels, sampleCount,
- 0, &desc.region);
+ 0, multisample_pattern,
+ &desc.region);
if (surface->sid == SVGA3D_INVALID_ID)
goto no_sid;
}
}
}
} else {
- surface->sid = vmw_ioctl_surface_create(vws, flags, format, usage,
- size, numLayers, numMipLevels,
- sampleCount);
+ /* Legacy surface only support 32-bit svga3d flags */
+ surface->sid = vmw_ioctl_surface_create(vws, (SVGA3dSurface1Flags)flags,
+ format, usage, size, numLayers,
+ numMipLevels, sampleCount);
if(surface->sid == SVGA3D_INVALID_ID)
goto no_sid;