Skip to content

Commit

Permalink
Revert "[CM] New APIs EnqueueWriteBuffer() & EnqueueReadBuffer()"
Browse files Browse the repository at this point in the history
This reverts commit a46065b.
Change-Id: I1980171fb293fe9960cee336ede5abefaa6a5e5d
  • Loading branch information
hanlong1 authored and intel-mediadev committed Jan 16, 2020
1 parent cca20cb commit 5fb7f2b
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 689 deletions.
108 changes: 2 additions & 106 deletions cmrtlib/agnostic/hardware/cm_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,34 +86,18 @@ struct CM_ENQUEUE_GPUCOPY_L2L_PARAM
void *cmQueueHandle; // [in]
void *srcSysMem; // [in]
void *dstSysMem; // [in]
uint32_t copySize; // [in]
uint32_t copySize; // [in]
uint32_t option; // [in]
void *cmEventHandle; // [out]
uint32_t eventIndex; // [out] index of Event in m_EventArray
int32_t returnValue; // [out]
};


struct CM_ENQUEUE_COPY_BUFFER_PARAM
{
void* cmQueueHandle; // [in]
void* buffer; // [in]
void* sysMem; // [in]
uint32_t offset; // [in]
uint64_t copySize; // [in]
uint32_t copyDir; // [in]
void* wait_event; // [in]
void* cmEventHandle; // [out]
uint32_t option; // [in]
uint32_t eventIndex; // [out] index of Event in m_EventArray
int32_t returnValue; // [out]
};

struct CM_ENQUEUE_2DInit_PARAM
{
void *cmQueueHandle; // [in]
void *cmSurface2d; // [in]
uint32_t initValue; // [in]
uint32_t initValue; // [in]
void *cmEventHandle; // [out]
uint32_t eventIndex; // [out] index of Event in m_EventArray
int32_t returnValue; // [out]
Expand Down Expand Up @@ -876,91 +860,3 @@ CM_RT_API int32_t CmQueue_RT::SetResidentGroupAndParallelThreadNum(uint32_t resi
return CM_NOT_IMPLEMENTED;
}


CM_RT_API int32_t CmQueue_RT::EnqueueReadBuffer(CmBuffer* buffer,
size_t offset,
const unsigned char* sysMem,
uint64_t sysMemSize,
CmEvent* wait_event,
CmEvent*& event,
unsigned option)
{
INSERT_PROFILER_RECORD();
CM_ENQUEUE_COPY_BUFFER_PARAM inParam;
CmSafeMemSet(&inParam, 0, sizeof(inParam));
inParam.cmQueueHandle = m_cmQueueHandle;
inParam.buffer = buffer;
inParam.sysMem = (void*)sysMem;
inParam.copySize = sysMemSize;
inParam.offset = offset;
inParam.copyDir = 0;
inParam.wait_event = wait_event;
inParam.option = option;
inParam.copyDir = CM_FASTCOPY_GPU2CPU;
inParam.cmEventHandle = event;

m_criticalSection.Acquire();

int32_t hr = m_cmDev->OSALExtensionExecute(CM_FN_CMQUEUE_ENQUEUECOPY_BUFFER,
&inParam,
sizeof(inParam));
if (FAILED(hr))
{
CmAssert(0);
m_criticalSection.Release();
return hr;
}
if (inParam.returnValue != CM_SUCCESS)
{
m_criticalSection.Release();
return inParam.returnValue;
}

event = static_cast<CmEvent*>(inParam.cmEventHandle);
m_criticalSection.Release();
return CM_SUCCESS;
}

CM_RT_API int32_t CmQueue_RT::EnqueueWriteBuffer(CmBuffer* buffer,
size_t offset,
const unsigned char* sysMem,
uint64_t sysMemSize,
CmEvent* wait_event,
CmEvent*& event,
unsigned option)
{
INSERT_PROFILER_RECORD();
CM_ENQUEUE_COPY_BUFFER_PARAM inParam;
CmSafeMemSet(&inParam, 0, sizeof(inParam));
inParam.cmQueueHandle = m_cmQueueHandle;
inParam.buffer = buffer;
inParam.sysMem = (void*)sysMem;
inParam.copySize = sysMemSize;
inParam.offset = offset;
inParam.copyDir = 1;
inParam.wait_event = wait_event;
inParam.option = option;
inParam.copyDir = CM_FASTCOPY_CPU2GPU;
inParam.cmEventHandle = event;

m_criticalSection.Acquire();

int32_t hr = m_cmDev->OSALExtensionExecute(CM_FN_CMQUEUE_ENQUEUECOPY_BUFFER,
&inParam,
sizeof(inParam));
if (FAILED(hr))
{
CmAssert(0);
m_criticalSection.Release();
return hr;
}
if (inParam.returnValue != CM_SUCCESS)
{
m_criticalSection.Release();
return inParam.returnValue;
}

event = static_cast<CmEvent*>(inParam.cmEventHandle);
m_criticalSection.Release();
return CM_SUCCESS;
}
39 changes: 10 additions & 29 deletions cmrtlib/agnostic/hardware/cm_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,36 +125,18 @@ class CmQueue_RT : public CmQueue
const CmThreadGroupSpace *threadGroupSpace = nullptr);

CM_RT_API int32_t EnqueueCopyCPUToGPUFullStrideDup(CmSurface2D *surface,
const unsigned char *sysMem,
const uint32_t widthStride,
const uint32_t heightStride,
const uint32_t option,
CmEvent *&event);
const unsigned char *sysMem,
const uint32_t widthStride,
const uint32_t heightStride,
const uint32_t option,
CmEvent *&event);

CM_RT_API int32_t EnqueueCopyGPUToCPUFullStrideDup(CmSurface2D *surface,
unsigned char *sysMem,
const uint32_t widthStride,
const uint32_t heightStride,
const uint32_t option,
CmEvent *&event);

// enqueue CmBuffer read from GPU 1D surface to CPU system memory
CM_RT_API int32_t EnqueueReadBuffer(CmBuffer* buffer,
size_t offset,
const unsigned char* sysMem,
uint64_t sysMemSize,
CmEvent* wait_event,
CmEvent*& event,
unsigned option = 0);

// enqueue CmBuffer write from CPU system memory to GPU 1D surface
CM_RT_API int32_t EnqueueWriteBuffer(CmBuffer* buffer,
size_t offset,
const unsigned char* sysMem,
uint64_t sysMemSize,
CmEvent* wait_event,
CmEvent*& event,
unsigned option = 0);
unsigned char *sysMem,
const uint32_t widthStride,
const uint32_t heightStride,
const uint32_t option,
CmEvent *&event);

CM_RT_API int32_t EnqueueWithHints(CmTask *task,
CmEvent *&event,
Expand All @@ -176,7 +158,6 @@ class CmQueue_RT : public CmQueue

CM_QUEUE_CREATE_OPTION GetQueueOption();


protected:
CmQueue_RT(CmDevice_RT *device, CM_QUEUE_CREATE_OPTION queueCreateOption);

Expand Down
2 changes: 0 additions & 2 deletions cmrtlib/agnostic/share/cm_device_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ enum CM_FUNCTION_ID
CM_FN_CMQUEUE_ENQUEUEFAST = 0x150a,
CM_FN_CMQUEUE_DESTROYEVENTFAST = 0x150b,
CM_FN_CMQUEUE_ENQUEUEWITHGROUPFAST = 0x150c,
CM_FN_CMQUEUE_ENQUEUECOPY_BUFFER = 0x150d,

};

#endif // #ifndef CMRTLIB_AGNOSTIC_SHARE_CM_DEVICE_DEF_H_
70 changes: 0 additions & 70 deletions cmrtlib/agnostic/share/cm_queue_base_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class CmTask;
class CmEvent;
class CmThreadSpace;
class CmThreadGroupSpace;
class CmBuffer;
class CmSurface2D;
class CmKernel;
class CmVebox;
Expand Down Expand Up @@ -527,75 +526,6 @@ class CmQueue
CmEvent *&event,
const CmThreadGroupSpace *threadGroupSpace = nullptr) = 0;

//!
//! \brief Enqueue the kernel to copy memory from video memory buffer/1D surface to system memory.
//! \details This function enqueues a task that contains a pre-defined kernel to copy from
//! video memory buffer/1D surface to system memory. This is a non-blocking call.
//! Buffer read copy task need to wait a CM wait_event to check dependent condition ready
//! status before actual copy starts.
//! Also a Cm notification event is generated each time a task is enqueued.
//! The CmEvent can be used to check the status or other data regarding the task execution.
//! \param [in] buffer
//! CM Buffer as 1D surface is copy source
//! \param [in] offset
//! data copy starting address offset within CM buffer
//! \param [in] sysMem
//! system memory as copy destination, better to be 16-Byte aligned
//! \param [in] sysMemSize
//! data byte count to copy into system memory
//! \param [in] wait_event
//! a wait conditional event before read copy starts
//! \param [in,out] event
//! reference to pointer of CM event generated to notify buffer read copy task status change
//! \param [in] option
//! If it is none-zero, CPU worker thread will be used for buffer read copy
//! \retval CM_SUCCESS if the task is successfully enqueued
//! \retval CM_GPUCOPY_OUT_OF_RESOURCE if runtime runs out of resources
//! \retval CM_FAILURE otherwise
//!
CM_RT_API virtual int32_t EnqueueReadBuffer(CmBuffer* buffer,
size_t offset,
const unsigned char* sysMem,
uint64_t sysMemSize,
CmEvent* wait_event,
CmEvent*& event,
unsigned option = 0) = 0;

//!
//! \brief Enqueue the kernel to copy memory from to system memory to video memory buffer/1D surface
//! \details This function enqueues a task, which contains a pre-defined kernel to copy from system
//! memory to 1D surface.This is a non-blocking call.
//! Buffer write copy task need to wait an CM wait_event to check condition ready status
//! before actual copy starts.
//! Also a Cm notification event is generated each time a task is enqueued.
//! The CmEvent can be used to check the status or other data regarding the task execution.
//! \param [in] buffer
//! CM Buffer as 1D surface is copy destination
//! \param [in] offset
//! data copy starting address offset within CM buffer
//! \param [in] sysMem
//! system memory as copy source, better to be 16-Byte aligned
//! \param [in] sysMemSize
//! data byte count to copy from system memory
//! \param [in] wait_event
//! a wait conditional event before write copy starts
//! \param [in,out] event
//! reference to pointer of CM event generated to notify buffer write copy task status change
//! \param [in] option
//! If it is none-zero, CPU worker thread will be used for buffer copy
//! \retval CM_SUCCESS if the task is successfully enqueued
//! \retval CM_GPUCOPY_OUT_OF_RESOURCE if runtime runs out of resources
//! \retval CM_FAILURE otherwise
//!
CM_RT_API virtual int32_t EnqueueWriteBuffer(CmBuffer* buffer,
size_t offset,
const unsigned char* sysMem,
uint64_t sysMemSize,
CmEvent* wait_event,
CmEvent*& event,
unsigned option = 0) = 0;


//!
//! \brief [Only In Emu Mode] set the resident group number and parallel thread number
//! \details
Expand Down
4 changes: 0 additions & 4 deletions cmrtlib/agnostic/share/cm_rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1523,11 +1523,7 @@ class CmQueue
CmEvent *&event,
const CmThreadGroupSpace *threadGroupSpace = nullptr) = 0;

CM_RT_API virtual int32_t EnqueueReadBuffer(CmBuffer* buffer, size_t offset, const unsigned char* sysMem, uint64_t sysMemSize, CmEvent* wait_event, CmEvent*& event, unsigned option) = 0;
CM_RT_API virtual int32_t EnqueueWriteBuffer(CmBuffer* buffer, size_t offset, const unsigned char* sysMem, uint64_t sysMemSize, CmEvent* wait_event, CmEvent*& event, unsigned option) = 0;

CM_RT_API virtual INT SetResidentGroupAndParallelThreadNum(uint32_t residentGroupNum, uint32_t parallelThreadNum) = 0;

protected:
~CmQueue(){};
};
Expand Down
1 change: 0 additions & 1 deletion media_driver/agnostic/common/cm/cm_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ class CmBufferStateless
WriteSurface(const unsigned char *sysMem,
CmEvent *event,
uint64_t sysMemSize = 0xFFFFFFFFFFFFFFFFULL) = 0;

};

}//namespace
Expand Down
Loading

0 comments on commit 5fb7f2b

Please sign in to comment.