12
12
13
13
#include "common.xml.h"
14
14
#include "state.xml.h"
15
+ #include "state_blt.xml.h"
15
16
#include "state_hi.xml.h"
16
17
#include "state_3d.xml.h"
17
18
#include "cmdstream.xml.h"
@@ -233,6 +234,8 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
233
234
struct etnaviv_cmdbuf * buffer = & gpu -> buffer ;
234
235
unsigned int waitlink_offset = buffer -> user_size - 16 ;
235
236
u32 link_target , flush = 0 ;
237
+ bool has_blt = !!(gpu -> identity .minor_features5 &
238
+ chipMinorFeatures5_BLT_ENGINE );
236
239
237
240
lockdep_assert_held (& gpu -> lock );
238
241
@@ -248,16 +251,38 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
248
251
if (flush ) {
249
252
unsigned int dwords = 7 ;
250
253
254
+ if (has_blt )
255
+ dwords += 10 ;
256
+
251
257
link_target = etnaviv_buffer_reserve (gpu , buffer , dwords );
252
258
253
259
CMD_SEM (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_PE );
254
260
CMD_STALL (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_PE );
261
+ if (has_blt ) {
262
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x1 );
263
+ CMD_SEM (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_BLT );
264
+ CMD_STALL (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_BLT );
265
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x0 );
266
+ }
255
267
CMD_LOAD_STATE (buffer , VIVS_GL_FLUSH_CACHE , flush );
256
- if (gpu -> exec_state == ETNA_PIPE_3D )
257
- CMD_LOAD_STATE (buffer , VIVS_TS_FLUSH_CACHE ,
258
- VIVS_TS_FLUSH_CACHE_FLUSH );
268
+ if (gpu -> exec_state == ETNA_PIPE_3D ) {
269
+ if (has_blt ) {
270
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x1 );
271
+ CMD_LOAD_STATE (buffer , VIVS_BLT_SET_COMMAND , 0x1 );
272
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x0 );
273
+ } else {
274
+ CMD_LOAD_STATE (buffer , VIVS_TS_FLUSH_CACHE ,
275
+ VIVS_TS_FLUSH_CACHE_FLUSH );
276
+ }
277
+ }
259
278
CMD_SEM (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_PE );
260
279
CMD_STALL (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_PE );
280
+ if (has_blt ) {
281
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x1 );
282
+ CMD_SEM (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_BLT );
283
+ CMD_STALL (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_BLT );
284
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x0 );
285
+ }
261
286
CMD_END (buffer );
262
287
263
288
etnaviv_buffer_replace_wait (buffer , waitlink_offset ,
@@ -323,6 +348,8 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
323
348
bool switch_mmu_context = gpu -> mmu_context != mmu_context ;
324
349
unsigned int new_flush_seq = READ_ONCE (gpu -> mmu_context -> flush_seq );
325
350
bool need_flush = switch_mmu_context || gpu -> flush_seq != new_flush_seq ;
351
+ bool has_blt = !!(gpu -> identity .minor_features5 &
352
+ chipMinorFeatures5_BLT_ENGINE );
326
353
327
354
lockdep_assert_held (& gpu -> lock );
328
355
@@ -433,6 +460,15 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
433
460
* 2 semaphore stall + 1 event + 1 wait + 1 link.
434
461
*/
435
462
return_dwords = 7 ;
463
+
464
+ /*
465
+ * When the BLT engine is present we need 6 more dwords in the return
466
+ * target: 3 enable/flush/disable + 4 enable/semaphore stall/disable,
467
+ * but we don't need the normal TS flush state.
468
+ */
469
+ if (has_blt )
470
+ return_dwords += 6 ;
471
+
436
472
return_target = etnaviv_buffer_reserve (gpu , buffer , return_dwords );
437
473
CMD_LINK (cmdbuf , return_dwords , return_target );
438
474
@@ -447,11 +483,25 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
447
483
CMD_LOAD_STATE (buffer , VIVS_GL_FLUSH_CACHE ,
448
484
VIVS_GL_FLUSH_CACHE_DEPTH |
449
485
VIVS_GL_FLUSH_CACHE_COLOR );
450
- CMD_LOAD_STATE (buffer , VIVS_TS_FLUSH_CACHE ,
451
- VIVS_TS_FLUSH_CACHE_FLUSH );
486
+ if (has_blt ) {
487
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x1 );
488
+ CMD_LOAD_STATE (buffer , VIVS_BLT_SET_COMMAND , 0x1 );
489
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x0 );
490
+ } else {
491
+ CMD_LOAD_STATE (buffer , VIVS_TS_FLUSH_CACHE ,
492
+ VIVS_TS_FLUSH_CACHE_FLUSH );
493
+ }
452
494
}
453
495
CMD_SEM (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_PE );
454
496
CMD_STALL (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_PE );
497
+
498
+ if (has_blt ) {
499
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x1 );
500
+ CMD_SEM (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_BLT );
501
+ CMD_STALL (buffer , SYNC_RECIPIENT_FE , SYNC_RECIPIENT_BLT );
502
+ CMD_LOAD_STATE (buffer , VIVS_BLT_ENABLE , 0x0 );
503
+ }
504
+
455
505
CMD_LOAD_STATE (buffer , VIVS_GL_EVENT , VIVS_GL_EVENT_EVENT_ID (event ) |
456
506
VIVS_GL_EVENT_FROM_PE );
457
507
CMD_WAIT (buffer );
0 commit comments