Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8f392d0

Browse files
committedMay 22, 2024·
[Decode] Add mos bufmgr api to set and get fences
Signed-off-by: Xu, Zhengguo <zhengguo.xu@intel.com>
1 parent d8b2184 commit 8f392d0

File tree

3 files changed

+71
-5
lines changed

3 files changed

+71
-5
lines changed
 

‎media_driver/linux/common/ddi/media_libva_common.cpp

+18-5
Original file line numberDiff line numberDiff line change
@@ -478,18 +478,31 @@ void MovePriorityBufferIdToEnd (VABufferID *buffers, int32_t priorityIndexInBuf,
478478
VAStatus DdiMedia_SetSyncFences(VADriverContextP ctx, VAContextID context, int32_t *fences, int32_t count)
479479
{
480480
VAStatus vaStatus = VA_STATUS_SUCCESS;
481-
//todo: get bufmgr
482-
//todo: struct mos_exec_fences exec_fences = {.fences = fences, .count = count};
483-
//todo: int ret = mos_bufmgr_set_fences(bufmgr, &exec_fences);
481+
PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx);
482+
struct mos_exec_fences exec_fences;
483+
exec_fences.fences = fences;
484+
exec_fences.count = count;
485+
int ret = mos_bufmgr_set_fences(mediaCtx->pDrmBufMgr, &exec_fences);
486+
487+
if (ret)
488+
{
489+
vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
490+
}
484491

485492
return vaStatus;
486493
}
487494

488495
VAStatus DdiMedia_GetSyncFenceOut(VADriverContextP ctx, VAContextID context, int32_t *fence_out)
489496
{
490497
VAStatus vaStatus = VA_STATUS_SUCCESS;
491-
//todo: get bufmgr
492-
//todo: int ret = mos_bufmgr_get_fence(bufmgr, fence_out);
498+
PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx);
499+
int ret = mos_bufmgr_get_fence(mediaCtx->pDrmBufMgr, fence_out);
500+
501+
if (ret)
502+
{
503+
vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
504+
*fence_out = 0;
505+
}
493506

494507
return vaStatus;
495508
}

‎media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h

+9
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ struct mos_drm_uc_version {
252252
uint32_t minor_version;
253253
};
254254

255+
struct mos_exec_fences
256+
{
257+
int32_t *fences;
258+
int32_t count;
259+
};
260+
255261
struct mos_linux_bo *mos_bo_alloc(struct mos_bufmgr *bufmgr,
256262
struct mos_drm_bo_alloc *alloc);
257263
struct mos_linux_bo *mos_bo_alloc_userptr(struct mos_bufmgr *bufmgr,
@@ -312,6 +318,9 @@ int mos_bufmgr_get_memory_info(struct mos_bufmgr *bufmgr, char *info, uint32_t l
312318
int mos_bufmgr_get_devid(struct mos_bufmgr *bufmgr);
313319
void mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode);
314320

321+
int mos_bufmgr_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences);
322+
int mos_bufmgr_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out);
323+
315324
int mos_bo_map_unsynchronized(struct mos_linux_bo *bo);
316325
int mos_bo_map_gtt(struct mos_linux_bo *bo);
317326
int mos_bo_unmap_gtt(struct mos_linux_bo *bo);

‎media_softlet/linux/common/os/i915/mos_bufmgr_api.c

+44
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,50 @@ mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode)
12231223
}
12241224
}
12251225

1226+
int
1227+
mos_bufmgr_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences)
1228+
{
1229+
if(!bufmgr)
1230+
{
1231+
MOS_OS_CRITICALMESSAGE("Input null ptr\n");
1232+
return -EINVAL;
1233+
}
1234+
1235+
return 0;
1236+
//todo: add func pointer to bufmgr
1237+
//if (bufmgr->set_fences)
1238+
//{
1239+
// return bufmgr->set_fences(bufmgr, exec_fences);
1240+
//}
1241+
//else
1242+
//{
1243+
// MOS_OS_CRITICALMESSAGE("Unsupported\n");
1244+
//}
1245+
1246+
}
1247+
1248+
int
1249+
mos_bufmgr_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out)
1250+
{
1251+
if(!bufmgr)
1252+
{
1253+
MOS_OS_CRITICALMESSAGE("Input null ptr\n");
1254+
return -EINVAL;
1255+
}
1256+
1257+
return 0;
1258+
//todo: add func pointer to bufmgr
1259+
//if (bufmgr->get_fence)
1260+
//{
1261+
// return bufmgr->get_fence(bufmgr, fence_out);
1262+
//}
1263+
//else
1264+
//{
1265+
// MOS_OS_CRITICALMESSAGE("Unsupported\n");
1266+
//}
1267+
1268+
}
1269+
12261270
int
12271271
mos_query_engines_count(struct mos_bufmgr *bufmgr,
12281272
unsigned int *nengine)

0 commit comments

Comments
 (0)
Please sign in to comment.