Skip to content

Commit 3d5a2d3

Browse files
Jexuintel-mediadev
authored andcommitted
[Decode] Remove sync mode none
Keep timeline synchronization only and remove all other sync mode plus some debug code
1 parent cfce3b7 commit 3d5a2d3

File tree

4 files changed

+34
-168
lines changed

4 files changed

+34
-168
lines changed

media_softlet/linux/common/os/xe/include/mos_bufmgr_xe.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,17 @@ static int64_t __xe_bufmgr_debug__;
9797
}
9898

9999
enum ENV_KEYS {
100-
INTEL_SYNCHRONIZATION_MODE = 0,
100+
RESERVED_0 = 0,
101101
INTEL_TILE_INSTANCE = 1,
102102
INTEL_XE_BUFMGR_DEBUG = 2,
103-
INTEL_DEFER_CREATION_AND_BINDING = 3,
103+
RESERVED_3 = 3,
104104
INTEL_ENGINE_TIMESLICE=4,
105105
INTEL_ENV_COUNT,
106106
};
107107

108108
static std::map<uint32_t, std::string> ENV_VARIABLE_TABLE = {
109-
{INTEL_SYNCHRONIZATION_MODE, "INTEL_SYNCHRONIZATION_MODE"},
110109
{INTEL_TILE_INSTANCE, "INTEL_TILE_INSTANCE"},
111110
{INTEL_XE_BUFMGR_DEBUG, "INTEL_XE_BUFMGR_DEBUG"},
112-
{INTEL_DEFER_CREATION_AND_BINDING, "INTEL_DEFER_CREATION_AND_BINDING"},
113111
{INTEL_ENGINE_TIMESLICE, "INTEL_ENGINE_TIMESLICE"}
114112
};
115113

media_softlet/linux/common/os/xe/include/mos_synchronization_xe.h

-10
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@
3939
extern "C" {
4040
#endif
4141

42-
enum mos_sync_mode {
43-
MOS_SYNC_NONE = 0,
44-
MOS_SYNC_RESERVED = 1,
45-
MOS_SYNC_TIMELINE = 2,
46-
MOS_SYNC_MAX,
47-
};
48-
4942
struct mos_xe_dep {
5043
/**
5144
* Maximun count of dependency;
@@ -97,9 +90,6 @@ struct mos_xe_bo_dep
9790
uint64_t exec_timeline_index;
9891
};
9992

100-
void mos_sync_set_synchronization_mode(uint32_t mode);
101-
uint32_t mos_sync_get_synchronization_mode();
102-
10393
int mos_sync_syncobj_create(int fd, uint32_t flags);
10494
int mos_sync_syncobj_destroy(int fd, uint32_t handle);
10595
int mos_sync_syncobj_reset(int fd, uint32_t *handles, uint32_t count);

media_softlet/linux/common/os/xe/mos_bufmgr_xe.c

+32-138
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ typedef struct mos_xe_bufmgr_gem {
218218
*/
219219
bool is_disable_synchronization;
220220

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-
224221
/** indicate to exec_queue property of timeslice */
225222
#define EXEC_QUEUE_TIMESLICE_DEFAULT -1
226223
#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
12321229
}
12331230

12341231
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)
12361233
{
1237-
if (is_defer)
1238-
{
1239-
return 0;
1240-
}
12411234
struct drm_xe_sync sync;
12421235

12431236
memclear(sync);
@@ -1322,10 +1315,6 @@ mos_bo_alloc_xe(struct mos_bufmgr *bufmgr,
13221315
//Note: We suggest vm_id=0 here as default, otherwise this bo cannot be exported as prelim fd.
13231316
create.vm_id = 0;
13241317
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-
}
13291318

13301319
/**
13311320
* 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,
13831372
bo_gem->bo.offset64,
13841373
bo_gem->bo.size,
13851374
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);
13881376
if (ret)
13891377
{
13901378
MOS_DRM_ASSERTMESSAGE("mos_vm_bind_sync_xe ret: %d", ret);
@@ -1552,8 +1540,7 @@ mos_bo_alloc_userptr_xe(struct mos_bufmgr *bufmgr,
15521540
bo_gem->bo.offset64,
15531541
bo_gem->bo.size,
15541542
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);
15571544

15581545
if (ret)
15591546
{
@@ -1658,8 +1645,7 @@ mos_bo_create_from_prime_xe(struct mos_bufmgr *bufmgr, int prime_fd, int size)
16581645
bo_gem->bo.offset64,
16591646
bo_gem->bo.size,
16601647
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);
16631649
if (ret)
16641650
{
16651651
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)
18851871
mos_xe_bufmgr_gem *bufmgr_gem = (mos_xe_bufmgr_gem *)bo->bufmgr;
18861872
MOS_DRM_CHK_NULL_RETURN_VALUE(bufmgr_gem, -EINVAL)
18871873

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;
18931877

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);
18951879

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)
19061884
{
1907-
//free
1908-
return false;
1885+
MOS_DRM_ASSERTMESSAGE("bo_busy_xe ret:%d, error:%d", ret, -errno);
19091886
}
1887+
return true;
19101888
}
1911-
else if (!bufmgr_gem->is_defer_creation_and_binding)
1889+
else if (MOS_XE_SUCCESS == ret)
19121890
{
1913-
//Note: hard code here for non-synchronization and remove after switch done.
1914-
usleep(5000);
1891+
//free
1892+
return false;
19151893
}
1894+
19161895
return false;
19171896
}
19181897

@@ -1932,23 +1911,15 @@ mos_gem_bo_wait_rendering_xe(struct mos_linux_bo *bo)
19321911
}
19331912
mos_xe_bufmgr_gem *bufmgr_gem = (mos_xe_bufmgr_gem *)bo->bufmgr;
19341913

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;
19401917

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);
19421919

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)
19491921
{
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);
19521923
}
19531924
}
19541925

@@ -1990,23 +1961,15 @@ mos_bo_map_xe(struct mos_linux_bo *bo, int write_enable)
19901961
struct mos_xe_bo_gem *bo_gem = (struct mos_xe_bo_gem *) bo;
19911962
int ret;
19921963

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;
19981967

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);
20001969

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)
20071971
{
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);
20101973
}
20111974

20121975
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
25752538
return ret;
25762539
}
25772540

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-
26312541
/**
26322542
* Get the DEVICE ID for the device. This can be overridden by setting the
26332543
* INTEL_DEVID_OVERRIDE environment variable to the desired ID.
@@ -3063,8 +2973,7 @@ mos_bo_free_xe(struct mos_linux_bo *bo)
30632973
bo->offset64,
30642974
bo->size,
30652975
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);
30682977
if (ret)
30692978
{
30702979
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)
34493358

34503359
struct mos_xe_bufmgr_gem *bufmgr_gem;
34513360
int ret, tmp;
3452-
int32_t sync_mode = MOS_SYNC_TIMELINE; //current default mode
34533361

34543362
pthread_mutex_lock(&bufmgr_list_mutex);
34553363

@@ -3511,21 +3419,7 @@ mos_bufmgr_gem_init_xe(int fd, int batch_size)
35113419
bufmgr_gem->bufmgr.set_object_capture = mos_bo_set_object_capture_xe;
35123420
bufmgr_gem->bufmgr.set_object_async = mos_bo_set_object_async_xe;
35133421

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;
35293423

35303424
bufmgr_gem->exec_queue_timeslice = EXEC_QUEUE_TIMESLICE_DEFAULT;
35313425
MOS_READ_ENV_VARIABLE(INTEL_ENGINE_TIMESLICE, MOS_USER_FEATURE_VALUE_TYPE_INT32, bufmgr_gem->exec_queue_timeslice);

media_softlet/linux/common/os/xe/mos_synchronization_xe.c

-16
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@
3535
#include "mos_utilities.h"
3636
#include "mos_bufmgr_util_debug.h"
3737

38-
/**
39-
* This is global synchronizarion mode for media umd, umd should alway select
40-
* a sync mode when init bufmgr
41-
*/
42-
static uint32_t SYNCHRONIZATION_MODE;
43-
44-
void mos_sync_set_synchronization_mode(uint32_t mode)
45-
{
46-
SYNCHRONIZATION_MODE = mode;
47-
}
48-
49-
uint32_t mos_sync_get_synchronization_mode()
50-
{
51-
return SYNCHRONIZATION_MODE;
52-
}
53-
5438
/**
5539
* @flags indicates to create opration:
5640
* If flags=0(recommended), it will create a syncobj with not signaled.

0 commit comments

Comments
 (0)