@@ -1345,6 +1345,23 @@ static void g4x_invalidate_wms(struct intel_crtc *crtc,
1345
1345
}
1346
1346
}
1347
1347
1348
+ static bool g4x_compute_fbc_en (const struct g4x_wm_state * wm_state ,
1349
+ int level )
1350
+ {
1351
+ if (level < G4X_WM_LEVEL_SR )
1352
+ return false;
1353
+
1354
+ if (level >= G4X_WM_LEVEL_SR &&
1355
+ wm_state -> sr .fbc > g4x_fbc_fifo_size (G4X_WM_LEVEL_SR ))
1356
+ return false;
1357
+
1358
+ if (level >= G4X_WM_LEVEL_HPLL &&
1359
+ wm_state -> hpll .fbc > g4x_fbc_fifo_size (G4X_WM_LEVEL_HPLL ))
1360
+ return false;
1361
+
1362
+ return true;
1363
+ }
1364
+
1348
1365
static int g4x_compute_pipe_wm (struct intel_crtc_state * crtc_state )
1349
1366
{
1350
1367
struct intel_crtc * crtc = to_intel_crtc (crtc_state -> uapi .crtc );
@@ -1384,7 +1401,6 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
1384
1401
wm_state -> wm .plane [plane_id ] = raw -> plane [plane_id ];
1385
1402
1386
1403
level = G4X_WM_LEVEL_SR ;
1387
-
1388
1404
if (!g4x_raw_crtc_wm_is_valid (crtc_state , level ))
1389
1405
goto out ;
1390
1406
@@ -1396,7 +1412,6 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
1396
1412
wm_state -> cxsr = num_active_planes == BIT (PLANE_PRIMARY );
1397
1413
1398
1414
level = G4X_WM_LEVEL_HPLL ;
1399
-
1400
1415
if (!g4x_raw_crtc_wm_is_valid (crtc_state , level ))
1401
1416
goto out ;
1402
1417
@@ -1419,17 +1434,11 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
1419
1434
/*
1420
1435
* Determine if the FBC watermark(s) can be used. IF
1421
1436
* this isn't the case we prefer to disable the FBC
1422
- ( watermark(s) rather than disable the SR/HPLL
1423
- * level(s) entirely.
1437
+ * watermark(s) rather than disable the SR/HPLL
1438
+ * level(s) entirely. 'level-1' is the highest valid
1439
+ * level here.
1424
1440
*/
1425
- wm_state -> fbc_en = level > G4X_WM_LEVEL_NORMAL ;
1426
-
1427
- if (level >= G4X_WM_LEVEL_SR &&
1428
- wm_state -> sr .fbc > g4x_fbc_fifo_size (G4X_WM_LEVEL_SR ))
1429
- wm_state -> fbc_en = false;
1430
- else if (level >= G4X_WM_LEVEL_HPLL &&
1431
- wm_state -> hpll .fbc > g4x_fbc_fifo_size (G4X_WM_LEVEL_HPLL ))
1432
- wm_state -> fbc_en = false;
1441
+ wm_state -> fbc_en = g4x_compute_fbc_en (wm_state , level - 1 );
1433
1442
1434
1443
return 0 ;
1435
1444
}
0 commit comments