@@ -218,9 +218,6 @@ typedef struct mos_xe_bufmgr_gem {
218
218
*/
219
219
bool is_disable_synchronization ;
220
220
221
- // Note: this is for test_va_api case because of high cost of sync vm bind and bo creation during initialization
222
- bool is_defer_creation_and_binding ;
223
-
224
221
/** indicate to exec_queue property of timeslice */
225
222
#define EXEC_QUEUE_TIMESLICE_DEFAULT -1
226
223
#define EXEC_QUEUE_TIMESLICE_MAX 100000 //100ms
@@ -1232,12 +1229,8 @@ static int __mos_vm_bind_xe(int fd, uint32_t vm_id, uint32_t exec_queue_id, uint
1232
1229
}
1233
1230
1234
1231
static int mos_vm_bind_sync_xe (int fd , uint32_t vm_id , uint32_t bo , uint64_t offset ,
1235
- uint64_t addr , uint64_t size , uint16_t pat_index , uint32_t op , bool is_defer )
1232
+ uint64_t addr , uint64_t size , uint16_t pat_index , uint32_t op )
1236
1233
{
1237
- if (is_defer )
1238
- {
1239
- return 0 ;
1240
- }
1241
1234
struct drm_xe_sync sync ;
1242
1235
1243
1236
memclear (sync );
@@ -1322,10 +1315,6 @@ mos_bo_alloc_xe(struct mos_bufmgr *bufmgr,
1322
1315
//Note: We suggest vm_id=0 here as default, otherwise this bo cannot be exported as prelim fd.
1323
1316
create .vm_id = 0 ;
1324
1317
create .size = ALIGN (alloc -> size , bo_align );
1325
- if (bufmgr_gem -> is_defer_creation_and_binding )
1326
- {
1327
- create .flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING ;
1328
- }
1329
1318
1330
1319
/**
1331
1320
* Note: current, it only supports WB/ WC while UC and other cache are not allowed.
@@ -1383,8 +1372,7 @@ mos_bo_alloc_xe(struct mos_bufmgr *bufmgr,
1383
1372
bo_gem -> bo .offset64 ,
1384
1373
bo_gem -> bo .size ,
1385
1374
bo_gem -> pat_index ,
1386
- DRM_XE_VM_BIND_OP_MAP ,
1387
- bufmgr_gem -> is_defer_creation_and_binding );
1375
+ DRM_XE_VM_BIND_OP_MAP );
1388
1376
if (ret )
1389
1377
{
1390
1378
MOS_DRM_ASSERTMESSAGE ("mos_vm_bind_sync_xe ret: %d" , ret );
@@ -1552,8 +1540,7 @@ mos_bo_alloc_userptr_xe(struct mos_bufmgr *bufmgr,
1552
1540
bo_gem -> bo .offset64 ,
1553
1541
bo_gem -> bo .size ,
1554
1542
bo_gem -> pat_index ,
1555
- DRM_XE_VM_BIND_OP_MAP_USERPTR ,
1556
- bufmgr_gem -> is_defer_creation_and_binding );
1543
+ DRM_XE_VM_BIND_OP_MAP_USERPTR );
1557
1544
1558
1545
if (ret )
1559
1546
{
@@ -1658,8 +1645,7 @@ mos_bo_create_from_prime_xe(struct mos_bufmgr *bufmgr, int prime_fd, int size)
1658
1645
bo_gem -> bo .offset64 ,
1659
1646
bo_gem -> bo .size ,
1660
1647
bo_gem -> pat_index ,
1661
- DRM_XE_VM_BIND_OP_MAP ,
1662
- bufmgr_gem -> is_defer_creation_and_binding );
1648
+ DRM_XE_VM_BIND_OP_MAP );
1663
1649
if (ret )
1664
1650
{
1665
1651
MOS_DRM_ASSERTMESSAGE ("mos_vm_bind_sync_xe ret: %d" , ret );
@@ -1885,34 +1871,27 @@ mos_gem_bo_busy_xe(struct mos_linux_bo *bo)
1885
1871
mos_xe_bufmgr_gem * bufmgr_gem = (mos_xe_bufmgr_gem * )bo -> bufmgr ;
1886
1872
MOS_DRM_CHK_NULL_RETURN_VALUE (bufmgr_gem , - EINVAL )
1887
1873
1888
- if (mos_sync_get_synchronization_mode () != MOS_SYNC_NONE )
1889
- {
1890
- int64_t timeout_nsec = 0 ;
1891
- uint32_t wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL ;
1892
- uint32_t rw_flags = EXEC_OBJECT_READ_XE | EXEC_OBJECT_WRITE_XE ;
1874
+ int64_t timeout_nsec = 0 ;
1875
+ uint32_t wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL ;
1876
+ uint32_t rw_flags = EXEC_OBJECT_READ_XE | EXEC_OBJECT_WRITE_XE ;
1893
1877
1894
- int ret = __mos_gem_bo_wait_timeline_rendering_with_flags_xe (bo , timeout_nsec , wait_flags , rw_flags , nullptr );
1878
+ int ret = __mos_gem_bo_wait_timeline_rendering_with_flags_xe (bo , timeout_nsec , wait_flags , rw_flags , nullptr );
1895
1879
1896
- if (ret )
1897
- {
1898
- //busy
1899
- if (errno != ETIME )
1900
- {
1901
- MOS_DRM_ASSERTMESSAGE ("bo_busy_xe ret:%d, error:%d" , ret , - errno );
1902
- }
1903
- return true;
1904
- }
1905
- else if (MOS_XE_SUCCESS == ret )
1880
+ if (ret )
1881
+ {
1882
+ //busy
1883
+ if (errno != ETIME )
1906
1884
{
1907
- //free
1908
- return false;
1885
+ MOS_DRM_ASSERTMESSAGE ("bo_busy_xe ret:%d, error:%d" , ret , - errno );
1909
1886
}
1887
+ return true;
1910
1888
}
1911
- else if (! bufmgr_gem -> is_defer_creation_and_binding )
1889
+ else if (MOS_XE_SUCCESS == ret )
1912
1890
{
1913
- //Note: hard code here for non-synchronization and remove after switch done.
1914
- usleep ( 5000 ) ;
1891
+ //free
1892
+ return false ;
1915
1893
}
1894
+
1916
1895
return false;
1917
1896
}
1918
1897
@@ -1932,23 +1911,15 @@ mos_gem_bo_wait_rendering_xe(struct mos_linux_bo *bo)
1932
1911
}
1933
1912
mos_xe_bufmgr_gem * bufmgr_gem = (mos_xe_bufmgr_gem * )bo -> bufmgr ;
1934
1913
1935
- if (mos_sync_get_synchronization_mode () != MOS_SYNC_NONE )
1936
- {
1937
- int64_t timeout_nsec = INT64_MAX ;
1938
- uint32_t wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL ;
1939
- uint32_t rw_flags = EXEC_OBJECT_READ_XE | EXEC_OBJECT_WRITE_XE ;
1914
+ int64_t timeout_nsec = INT64_MAX ;
1915
+ uint32_t wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL ;
1916
+ uint32_t rw_flags = EXEC_OBJECT_READ_XE | EXEC_OBJECT_WRITE_XE ;
1940
1917
1941
- int ret = __mos_gem_bo_wait_timeline_rendering_with_flags_xe (bo , timeout_nsec , wait_flags , rw_flags , nullptr );
1918
+ int ret = __mos_gem_bo_wait_timeline_rendering_with_flags_xe (bo , timeout_nsec , wait_flags , rw_flags , nullptr );
1942
1919
1943
- if (ret )
1944
- {
1945
- MOS_DRM_ASSERTMESSAGE ("bo_wait_rendering_xe ret:%d, error:%d" , ret , - errno );
1946
- }
1947
- }
1948
- else if (!bufmgr_gem -> is_defer_creation_and_binding )
1920
+ if (ret )
1949
1921
{
1950
- //Note: hard code here for non-synchronization and remove after switch done.
1951
- usleep (5000 );
1922
+ MOS_DRM_ASSERTMESSAGE ("bo_wait_rendering_xe ret:%d, error:%d" , ret , - errno );
1952
1923
}
1953
1924
}
1954
1925
@@ -1990,23 +1961,15 @@ mos_bo_map_xe(struct mos_linux_bo *bo, int write_enable)
1990
1961
struct mos_xe_bo_gem * bo_gem = (struct mos_xe_bo_gem * ) bo ;
1991
1962
int ret ;
1992
1963
1993
- if (mos_sync_get_synchronization_mode () != MOS_SYNC_NONE )
1994
- {
1995
- int64_t timeout_nsec = INT64_MAX ;
1996
- uint32_t wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL ;
1997
- uint32_t rw_flags = write_enable ? EXEC_OBJECT_WRITE_XE : EXEC_OBJECT_READ_XE ;
1964
+ int64_t timeout_nsec = INT64_MAX ;
1965
+ uint32_t wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL ;
1966
+ uint32_t rw_flags = write_enable ? EXEC_OBJECT_WRITE_XE : EXEC_OBJECT_READ_XE ;
1998
1967
1999
- ret = __mos_gem_bo_wait_timeline_rendering_with_flags_xe (bo , timeout_nsec , wait_flags , rw_flags , nullptr );
1968
+ ret = __mos_gem_bo_wait_timeline_rendering_with_flags_xe (bo , timeout_nsec , wait_flags , rw_flags , nullptr );
2000
1969
2001
- if (ret )
2002
- {
2003
- MOS_DRM_ASSERTMESSAGE ("bo wait rendering error(%d ns)" , - errno );
2004
- }
2005
- }
2006
- else if (!bufmgr_gem -> is_defer_creation_and_binding )
1970
+ if (ret )
2007
1971
{
2008
- //Note: hard code here for non-synchronization and remove after switch done.
2009
- usleep (5000 );
1972
+ MOS_DRM_ASSERTMESSAGE ("bo wait rendering error(%d ns)" , - errno );
2010
1973
}
2011
1974
2012
1975
if (bo_gem -> is_userptr )
@@ -2575,59 +2538,6 @@ mos_bo_context_exec_with_sync_xe(struct mos_linux_bo **bo, int num_bo, struct mo
2575
2538
return ret ;
2576
2539
}
2577
2540
2578
- static int
2579
- mos_bo_context_exec_xe (struct mos_linux_bo * * bo , int num_bo , struct mos_linux_context * ctx ,
2580
- struct drm_clip_rect * cliprects , int num_cliprects , int DR4 ,
2581
- unsigned int flags , int * fence )
2582
- {
2583
- if ((nullptr == bo ) || (nullptr == ctx ) || num_bo <= 0 )
2584
- {
2585
- return - EINVAL ;
2586
- }
2587
-
2588
- struct mos_xe_bufmgr_gem * bufmgr_gem = (struct mos_xe_bufmgr_gem * ) bo [0 ]-> bufmgr ;
2589
- struct mos_xe_context * context = (struct mos_xe_context * ) ctx ;
2590
- struct drm_xe_sync sync ;
2591
- struct drm_xe_exec exec ;
2592
- int ret = 0 ;
2593
- uint64_t batch_addrs [num_bo ];
2594
-
2595
- for (int i = 0 ; i < num_bo ; i ++ )
2596
- {
2597
- MOS_DRM_CHK_NULL_RETURN_VALUE (bo [i ], - EINVAL )
2598
- batch_addrs [i ] = bo [i ]-> offset64 ;
2599
- }
2600
- memclear (sync );
2601
- sync .handle = mos_sync_syncobj_create (bufmgr_gem -> fd , 0 );
2602
- sync .flags = DRM_XE_SYNC_FLAG_SIGNAL ;
2603
- sync .type = DRM_XE_SYNC_TYPE_SYNCOBJ ;
2604
-
2605
- memclear (exec );
2606
- exec .extensions = 0 ;
2607
- exec .exec_queue_id = ctx -> ctx_id ;
2608
- exec .num_syncs = 1 ;
2609
- exec .syncs = (uint64_t )& sync ;
2610
- exec .address = (num_bo == 1 ? batch_addrs [0 ] : (uint64_t )batch_addrs );
2611
- exec .num_batch_buffer = num_bo ;
2612
- ret = drmIoctl (bufmgr_gem -> fd , DRM_IOCTL_XE_EXEC , & exec );
2613
- if (ret )
2614
- {
2615
- MOS_DRM_ASSERTMESSAGE ("error:%d" , - errno );
2616
- mos_sync_syncobj_destroy (bufmgr_gem -> fd , sync .handle );
2617
- return ret ;
2618
- }
2619
-
2620
- ret = mos_sync_syncobj_wait_err (bufmgr_gem -> fd , & sync .handle , 1 , INT64_MAX , 0 , NULL );
2621
- if (ret )
2622
- {
2623
- MOS_DRM_ASSERTMESSAGE ("syncobj_wait error:%d" , - errno );
2624
- }
2625
-
2626
- mos_sync_syncobj_destroy (bufmgr_gem -> fd , sync .handle );
2627
-
2628
- return ret ;
2629
- }
2630
-
2631
2541
/**
2632
2542
* Get the DEVICE ID for the device. This can be overridden by setting the
2633
2543
* INTEL_DEVID_OVERRIDE environment variable to the desired ID.
@@ -3063,8 +2973,7 @@ mos_bo_free_xe(struct mos_linux_bo *bo)
3063
2973
bo -> offset64 ,
3064
2974
bo -> size ,
3065
2975
bo_gem -> pat_index ,
3066
- DRM_XE_VM_BIND_OP_UNMAP ,
3067
- bufmgr_gem -> is_defer_creation_and_binding );
2976
+ DRM_XE_VM_BIND_OP_UNMAP );
3068
2977
if (ret )
3069
2978
{
3070
2979
MOS_DRM_ASSERTMESSAGE ("mos_gem_bo_free mos_vm_unbind ret error. bo:0x%lx, vm_id:%d\r" ,
@@ -3449,7 +3358,6 @@ mos_bufmgr_gem_init_xe(int fd, int batch_size)
3449
3358
3450
3359
struct mos_xe_bufmgr_gem * bufmgr_gem ;
3451
3360
int ret , tmp ;
3452
- int32_t sync_mode = MOS_SYNC_TIMELINE ; //current default mode
3453
3361
3454
3362
pthread_mutex_lock (& bufmgr_list_mutex );
3455
3363
@@ -3511,21 +3419,7 @@ mos_bufmgr_gem_init_xe(int fd, int batch_size)
3511
3419
bufmgr_gem -> bufmgr .set_object_capture = mos_bo_set_object_capture_xe ;
3512
3420
bufmgr_gem -> bufmgr .set_object_async = mos_bo_set_object_async_xe ;
3513
3421
3514
- MOS_READ_ENV_VARIABLE (INTEL_SYNCHRONIZATION_MODE , MOS_USER_FEATURE_VALUE_TYPE_INT32 , sync_mode );
3515
-
3516
- if (sync_mode != MOS_SYNC_NONE )
3517
- {
3518
- sync_mode = MOS_SYNC_TIMELINE ;
3519
- bufmgr_gem -> bufmgr .bo_context_exec3 = mos_bo_context_exec_with_sync_xe ;
3520
- }
3521
- else
3522
- {
3523
- bufmgr_gem -> bufmgr .bo_context_exec3 = mos_bo_context_exec_xe ;
3524
- }
3525
- mos_sync_set_synchronization_mode (sync_mode );
3526
- MOS_DRM_NORMALMESSAGE ("exec with synchronization mode: %d" , sync_mode );
3527
- bufmgr_gem -> is_defer_creation_and_binding = false;
3528
- MOS_READ_ENV_VARIABLE (INTEL_DEFER_CREATION_AND_BINDING , MOS_USER_FEATURE_VALUE_TYPE_BOOL , bufmgr_gem -> is_defer_creation_and_binding );
3422
+ bufmgr_gem -> bufmgr .bo_context_exec3 = mos_bo_context_exec_with_sync_xe ;
3529
3423
3530
3424
bufmgr_gem -> exec_queue_timeslice = EXEC_QUEUE_TIMESLICE_DEFAULT ;
3531
3425
MOS_READ_ENV_VARIABLE (INTEL_ENGINE_TIMESLICE , MOS_USER_FEATURE_VALUE_TYPE_INT32 , bufmgr_gem -> exec_queue_timeslice );
0 commit comments