@@ -78,11 +78,13 @@ static const uint8_t isl_to_gen_tiling[] = {
78
78
};
79
79
#endif
80
80
81
+ #if GEN_GEN >= 7
81
82
static const uint32_t isl_to_gen_multisample_layout [] = {
82
83
[ISL_MSAA_LAYOUT_NONE ] = MSFMT_MSS ,
83
84
[ISL_MSAA_LAYOUT_INTERLEAVED ] = MSFMT_DEPTH_STENCIL ,
84
85
[ISL_MSAA_LAYOUT_ARRAY ] = MSFMT_MSS ,
85
86
};
87
+ #endif
86
88
87
89
#if GEN_GEN >= 9
88
90
static const uint32_t isl_to_gen_aux_mode [] = {
@@ -130,7 +132,7 @@ get_surftype(enum isl_surf_dim dim, isl_surf_usage_flags_t usage)
130
132
* hardware. Note that this does NOT give you the actual hardware enum values
131
133
* but an index into the isl_to_gen_[hv]align arrays above.
132
134
*/
133
- static struct isl_extent3d
135
+ static inline struct isl_extent3d
134
136
get_image_alignment (const struct isl_surf * surf )
135
137
{
136
138
if (GEN_GEN >= 9 ) {
@@ -217,6 +219,23 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
217
219
s .Width = info -> surf -> logical_level0_px .width - 1 ;
218
220
s .Height = info -> surf -> logical_level0_px .height - 1 ;
219
221
222
+ /* In the gen6 PRM Volume 1 Part 1: Graphics Core, Section 7.18.3.7.1
223
+ * (Surface Arrays For all surfaces other than separate stencil buffer):
224
+ *
225
+ * "[DevSNB] Errata: Sampler MSAA Qpitch will be 4 greater than the value
226
+ * calculated in the equation above , for every other odd Surface Height
227
+ * starting from 1 i.e. 1,5,9,13"
228
+ *
229
+ * Since this Qpitch errata only impacts the sampler, we have to adjust the
230
+ * input for the rendering surface to achieve the same qpitch. For the
231
+ * affected heights, we increment the height by 1 for the rendering
232
+ * surface.
233
+ */
234
+ if (GEN_GEN == 6 && (info -> view -> usage & ISL_SURF_USAGE_RENDER_TARGET_BIT ) &&
235
+ info -> surf -> samples > 1 &&
236
+ (info -> surf -> logical_level0_px .height % 4 ) == 1 )
237
+ s .Height ++ ;
238
+
220
239
switch (s .SurfaceType ) {
221
240
case SURFTYPE_1D :
222
241
case SURFTYPE_2D :
@@ -283,7 +302,9 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
283
302
unreachable ("bad SurfaceType" );
284
303
}
285
304
305
+ #if GEN_GEN >= 7
286
306
s .SurfaceArray = info -> surf -> dim != ISL_SURF_DIM_3D ;
307
+ #endif
287
308
288
309
if (info -> view -> usage & ISL_SURF_USAGE_RENDER_TARGET_BIT ) {
289
310
/* For render target surfaces, the hardware interprets field
@@ -311,9 +332,13 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
311
332
s .MipTailStartLOD = 15 ;
312
333
#endif
313
334
335
+ #if GEN_GEN >= 6
314
336
const struct isl_extent3d image_align = get_image_alignment (info -> surf );
315
337
s .SurfaceVerticalAlignment = isl_to_gen_valign [image_align .height ];
338
+ #if GEN_GEN >= 7
316
339
s .SurfaceHorizontalAlignment = isl_to_gen_halign [image_align .width ];
340
+ #endif
341
+ #endif
317
342
318
343
if (info -> surf -> dim_layout == ISL_DIM_LAYOUT_GEN9_1D ) {
319
344
/* For gen9 1-D textures, surface pitch is ignored */
@@ -356,9 +381,13 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
356
381
#endif
357
382
}
358
383
384
+ #if GEN_GEN >= 6
385
+ s .NumberofMultisamples = ffs (info -> surf -> samples ) - 1 ;
386
+ #if GEN_GEN >= 7
359
387
s .MultisampledSurfaceStorageFormat =
360
388
isl_to_gen_multisample_layout [info -> surf -> msaa_layout ];
361
- s .NumberofMultisamples = ffs (info -> surf -> samples ) - 1 ;
389
+ #endif
390
+ #endif
362
391
363
392
#if (GEN_GEN >= 8 || GEN_IS_HASWELL )
364
393
s .ShaderChannelSelectRed = info -> view -> channel_select [0 ];
@@ -368,7 +397,10 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
368
397
#endif
369
398
370
399
s .SurfaceBaseAddress = info -> address ;
400
+
401
+ #if GEN_GEN >= 6
371
402
s .MOCS = info -> mocs ;
403
+ #endif
372
404
373
405
#if GEN_GEN >= 7
374
406
if (info -> aux_surf && info -> aux_usage != ISL_AUX_USAGE_NONE ) {
@@ -480,15 +512,31 @@ isl_genX(buffer_fill_state_s)(void *state,
480
512
struct GENX (RENDER_SURFACE_STATE ) s = { 0 , };
481
513
482
514
s .SurfaceType = SURFTYPE_BUFFER ;
483
- s .SurfaceArray = false;
484
515
s .SurfaceFormat = info -> format ;
516
+
517
+ #if GEN_GEN >= 6
485
518
s .SurfaceVerticalAlignment = isl_to_gen_valign [4 ];
519
+ #if GEN_GEN >= 7
486
520
s .SurfaceHorizontalAlignment = isl_to_gen_halign [4 ];
521
+ s .SurfaceArray = false;
522
+ #endif
523
+ #endif
524
+
525
+ #if GEN_GEN >= 7
487
526
s .Height = ((num_elements - 1 ) >> 7 ) & 0x3fff ;
488
527
s .Width = (num_elements - 1 ) & 0x7f ;
489
528
s .Depth = ((num_elements - 1 ) >> 21 ) & 0x3ff ;
529
+ #else
530
+ s .Height = ((num_elements - 1 ) >> 7 ) & 0x1fff ;
531
+ s .Width = (num_elements - 1 ) & 0x7f ;
532
+ s .Depth = ((num_elements - 1 ) >> 20 ) & 0x7f ;
533
+ #endif
534
+
490
535
s .SurfacePitch = info -> stride - 1 ;
536
+
537
+ #if GEN_GEN >= 6
491
538
s .NumberofMultisamples = MULTISAMPLECOUNT_1 ;
539
+ #endif
492
540
493
541
#if (GEN_GEN >= 8 )
494
542
s .TileMode = LINEAR ;
@@ -503,7 +551,9 @@ isl_genX(buffer_fill_state_s)(void *state,
503
551
#endif
504
552
505
553
s .SurfaceBaseAddress = info -> address ;
554
+ #if GEN_GEN >= 6
506
555
s .MOCS = info -> mocs ;
556
+ #endif
507
557
508
558
#if (GEN_GEN >= 8 || GEN_IS_HASWELL )
509
559
s .ShaderChannelSelectRed = SCS_RED ;
0 commit comments