@@ -1082,6 +1082,10 @@ static int vmw_gb_surface_create(struct vmw_resource *res)
1082
1082
SVGA3dCmdHeader header ;
1083
1083
SVGA3dCmdDefineGBSurface_v3 body ;
1084
1084
} * cmd3 ;
1085
+ struct {
1086
+ SVGA3dCmdHeader header ;
1087
+ SVGA3dCmdDefineGBSurface_v4 body ;
1088
+ } * cmd4 ;
1085
1089
1086
1090
if (likely (res -> id != -1 ))
1087
1091
return 0 ;
@@ -1098,7 +1102,11 @@ static int vmw_gb_surface_create(struct vmw_resource *res)
1098
1102
goto out_no_fifo ;
1099
1103
}
1100
1104
1101
- if (has_sm4_1_context (dev_priv ) && metadata -> array_size > 0 ) {
1105
+ if (has_sm5_context (dev_priv ) && metadata -> array_size > 0 ) {
1106
+ cmd_id = SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 ;
1107
+ cmd_len = sizeof (cmd4 -> body );
1108
+ submit_len = sizeof (* cmd4 );
1109
+ } else if (has_sm4_1_context (dev_priv ) && metadata -> array_size > 0 ) {
1102
1110
cmd_id = SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 ;
1103
1111
cmd_len = sizeof (cmd3 -> body );
1104
1112
submit_len = sizeof (* cmd3 );
@@ -1116,12 +1124,29 @@ static int vmw_gb_surface_create(struct vmw_resource *res)
1116
1124
cmd = VMW_FIFO_RESERVE (dev_priv , submit_len );
1117
1125
cmd2 = (typeof (cmd2 ))cmd ;
1118
1126
cmd3 = (typeof (cmd3 ))cmd ;
1127
+ cmd4 = (typeof (cmd4 ))cmd ;
1119
1128
if (unlikely (!cmd )) {
1120
1129
ret = - ENOMEM ;
1121
1130
goto out_no_fifo ;
1122
1131
}
1123
1132
1124
- if (has_sm4_1_context (dev_priv ) && metadata -> array_size > 0 ) {
1133
+ if (has_sm5_context (dev_priv ) && metadata -> array_size > 0 ) {
1134
+ cmd4 -> header .id = cmd_id ;
1135
+ cmd4 -> header .size = cmd_len ;
1136
+ cmd4 -> body .sid = srf -> res .id ;
1137
+ cmd4 -> body .surfaceFlags = metadata -> flags ;
1138
+ cmd4 -> body .format = metadata -> format ;
1139
+ cmd4 -> body .numMipLevels = metadata -> mip_levels [0 ];
1140
+ cmd4 -> body .multisampleCount = metadata -> multisample_count ;
1141
+ cmd4 -> body .multisamplePattern = metadata -> multisample_pattern ;
1142
+ cmd4 -> body .qualityLevel = metadata -> quality_level ;
1143
+ cmd4 -> body .autogenFilter = metadata -> autogen_filter ;
1144
+ cmd4 -> body .size .width = metadata -> base_size .width ;
1145
+ cmd4 -> body .size .height = metadata -> base_size .height ;
1146
+ cmd4 -> body .size .depth = metadata -> base_size .depth ;
1147
+ cmd4 -> body .arraySize = metadata -> array_size ;
1148
+ cmd4 -> body .bufferByteStride = metadata -> buffer_byte_stride ;
1149
+ } else if (has_sm4_1_context (dev_priv ) && metadata -> array_size > 0 ) {
1125
1150
cmd3 -> header .id = cmd_id ;
1126
1151
cmd3 -> header .size = cmd_len ;
1127
1152
cmd3 -> body .sid = srf -> res .id ;
@@ -1341,6 +1366,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
1341
1366
req_ext .svga3d_flags_upper_32_bits = 0 ;
1342
1367
req_ext .multisample_pattern = SVGA3D_MS_PATTERN_NONE ;
1343
1368
req_ext .quality_level = SVGA3D_MS_QUALITY_NONE ;
1369
+ req_ext .buffer_byte_stride = 0 ;
1344
1370
req_ext .must_be_zero = 0 ;
1345
1371
1346
1372
return vmw_gb_surface_define_internal (dev , & req_ext , rep , file_priv );
@@ -1467,6 +1493,11 @@ vmw_gb_surface_define_internal(struct drm_device *dev,
1467
1493
}
1468
1494
}
1469
1495
1496
+ if (req -> buffer_byte_stride > 0 && !has_sm5_context (dev_priv )) {
1497
+ VMW_DEBUG_USER ("SM5 surface not supported.\n" );
1498
+ return - EINVAL ;
1499
+ }
1500
+
1470
1501
if ((svga3d_flags_64 & SVGA3D_SURFACE_MULTISAMPLE ) &&
1471
1502
req -> base .multisample_count == 0 ) {
1472
1503
VMW_DEBUG_USER ("Invalid sample count.\n" );
@@ -1491,6 +1522,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev,
1491
1522
metadata .multisample_pattern = req -> multisample_pattern ;
1492
1523
metadata .quality_level = req -> quality_level ;
1493
1524
metadata .array_size = req -> base .array_size ;
1525
+ metadata .buffer_byte_stride = req -> buffer_byte_stride ;
1494
1526
metadata .num_sizes = 1 ;
1495
1527
metadata .base_size = req -> base .base_size ;
1496
1528
metadata .scanout = req -> base .drm_surface_flags &
0 commit comments