Skip to content

Commit

Permalink
[Decode] Add mos bufmgr api to set and get fences
Browse files Browse the repository at this point in the history
Signed-off-by: Xu, Zhengguo <zhengguo.xu@intel.com>
  • Loading branch information
Jexu committed May 22, 2024
1 parent d8b2184 commit 8f392d0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 5 deletions.
23 changes: 18 additions & 5 deletions media_driver/linux/common/ddi/media_libva_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,31 @@ void MovePriorityBufferIdToEnd (VABufferID *buffers, int32_t priorityIndexInBuf,
VAStatus DdiMedia_SetSyncFences(VADriverContextP ctx, VAContextID context, int32_t *fences, int32_t count)
{
VAStatus vaStatus = VA_STATUS_SUCCESS;
//todo: get bufmgr
//todo: struct mos_exec_fences exec_fences = {.fences = fences, .count = count};
//todo: int ret = mos_bufmgr_set_fences(bufmgr, &exec_fences);
PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx);
struct mos_exec_fences exec_fences;
exec_fences.fences = fences;
exec_fences.count = count;
int ret = mos_bufmgr_set_fences(mediaCtx->pDrmBufMgr, &exec_fences);

if (ret)
{
vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
}

return vaStatus;
}

VAStatus DdiMedia_GetSyncFenceOut(VADriverContextP ctx, VAContextID context, int32_t *fence_out)
{
VAStatus vaStatus = VA_STATUS_SUCCESS;
//todo: get bufmgr
//todo: int ret = mos_bufmgr_get_fence(bufmgr, fence_out);
PDDI_MEDIA_CONTEXT mediaCtx = DdiMedia_GetMediaContext(ctx);
int ret = mos_bufmgr_get_fence(mediaCtx->pDrmBufMgr, fence_out);

if (ret)
{
vaStatus = VA_STATUS_ERROR_OPERATION_FAILED;
*fence_out = 0;
}

return vaStatus;
}
9 changes: 9 additions & 0 deletions media_softlet/linux/common/os/i915/include/mos_bufmgr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ struct mos_drm_uc_version {
uint32_t minor_version;
};

struct mos_exec_fences
{
int32_t *fences;
int32_t count;
};

struct mos_linux_bo *mos_bo_alloc(struct mos_bufmgr *bufmgr,
struct mos_drm_bo_alloc *alloc);
struct mos_linux_bo *mos_bo_alloc_userptr(struct mos_bufmgr *bufmgr,
Expand Down Expand Up @@ -312,6 +318,9 @@ int mos_bufmgr_get_memory_info(struct mos_bufmgr *bufmgr, char *info, uint32_t l
int mos_bufmgr_get_devid(struct mos_bufmgr *bufmgr);
void mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode);

int mos_bufmgr_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences);
int mos_bufmgr_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out);

int mos_bo_map_unsynchronized(struct mos_linux_bo *bo);
int mos_bo_map_gtt(struct mos_linux_bo *bo);
int mos_bo_unmap_gtt(struct mos_linux_bo *bo);
Expand Down
44 changes: 44 additions & 0 deletions media_softlet/linux/common/os/i915/mos_bufmgr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,50 @@ mos_bufmgr_realloc_cache(struct mos_bufmgr *bufmgr, uint8_t alloc_mode)
}
}

int
mos_bufmgr_set_fences(struct mos_bufmgr *bufmgr, struct mos_exec_fences *exec_fences)
{
if(!bufmgr)
{
MOS_OS_CRITICALMESSAGE("Input null ptr\n");
return -EINVAL;
}

return 0;
//todo: add func pointer to bufmgr
//if (bufmgr->set_fences)
//{
// return bufmgr->set_fences(bufmgr, exec_fences);
//}
//else
//{
// MOS_OS_CRITICALMESSAGE("Unsupported\n");
//}

}

int
mos_bufmgr_get_fence(struct mos_bufmgr *bufmgr, int32_t *fence_out)
{
if(!bufmgr)
{
MOS_OS_CRITICALMESSAGE("Input null ptr\n");
return -EINVAL;
}

return 0;
//todo: add func pointer to bufmgr
//if (bufmgr->get_fence)
//{
// return bufmgr->get_fence(bufmgr, fence_out);
//}
//else
//{
// MOS_OS_CRITICALMESSAGE("Unsupported\n");
//}

}

int
mos_query_engines_count(struct mos_bufmgr *bufmgr,
unsigned int *nengine)
Expand Down

0 comments on commit 8f392d0

Please sign in to comment.