primitives: use host pointers for openCL

Using host pointers may skip the need for copying buffers.
This commit is contained in:
David Fort 2019-11-29 08:52:37 +01:00 committed by akallabeth
parent 35691c155b
commit 22f954970a
3 changed files with 8 additions and 17 deletions

View File

@ -906,22 +906,22 @@ static BOOL rdp_write_info_packet(rdpRdp* rdp, wStream* s)
/* the mandatory null terminator */ /* the mandatory null terminator */
Stream_Write_UINT16(s, 0); Stream_Write_UINT16(s, 0);
Stream_Write(s, userNameW, cbUserName); Stream_Write(s, userNameW, cbUserName);
/* the mandatory null terminator */ /* the mandatory null terminator */
Stream_Write_UINT16(s, 0); Stream_Write_UINT16(s, 0);
Stream_Write(s, passwordW, cbPassword); Stream_Write(s, passwordW, cbPassword);
/* the mandatory null terminator */ /* the mandatory null terminator */
Stream_Write_UINT16(s, 0); Stream_Write_UINT16(s, 0);
Stream_Write(s, alternateShellW, cbAlternateShell); Stream_Write(s, alternateShellW, cbAlternateShell);
/* the mandatory null terminator */ /* the mandatory null terminator */
Stream_Write_UINT16(s, 0); Stream_Write_UINT16(s, 0);
Stream_Write(s, workingDirW, cbWorkingDir); Stream_Write(s, workingDirW, cbWorkingDir);
/* the mandatory null terminator */ /* the mandatory null terminator */
Stream_Write_UINT16(s, 0); Stream_Write_UINT16(s, 0);

View File

@ -57,7 +57,6 @@ static pstatus_t opencl_YUVToRGB(const char* kernelName, const BYTE* const pSrc[
cl_mem objs[3] = { NULL, NULL, NULL }; cl_mem objs[3] = { NULL, NULL, NULL };
cl_mem destObj; cl_mem destObj;
cl_kernel kernel; cl_kernel kernel;
cl_event events[3];
size_t indexes[2]; size_t indexes[2];
const char* sourceNames[] = { "Y", "U", "V" }; const char* sourceNames[] = { "Y", "U", "V" };
primitives_opencl_context* cl = primitives_get_opencl_context(); primitives_opencl_context* cl = primitives_get_opencl_context();
@ -71,21 +70,13 @@ static pstatus_t opencl_YUVToRGB(const char* kernelName, const BYTE* const pSrc[
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
objs[i] = objs[i] = clCreateBuffer(cl->context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR,
clCreateBuffer(cl->context, CL_MEM_READ_ONLY, srcStep[i] * roi->height, NULL, &ret); srcStep[i] * roi->height, (char*)pSrc[i], &ret);
if (ret != CL_SUCCESS) if (ret != CL_SUCCESS)
{ {
WLog_ERR(TAG, "unable to create %sobj", sourceNames[i]); WLog_ERR(TAG, "unable to create %sobj", sourceNames[i]);
goto error_objs; goto error_objs;
} }
ret = clEnqueueWriteBuffer(cl->commandQueue, objs[i], CL_FALSE, 0, srcStep[i] * roi->height,
pSrc[i], 0, NULL, &events[i]);
if (ret != CL_SUCCESS)
{
WLog_ERR(TAG, "unable to enqueue write command for %sobj", sourceNames[i]);
goto error_objs;
}
} }
destObj = clCreateBuffer(cl->context, CL_MEM_WRITE_ONLY, dstStep * roi->height, NULL, &ret); destObj = clCreateBuffer(cl->context, CL_MEM_WRITE_ONLY, dstStep * roi->height, NULL, &ret);
@ -129,7 +120,7 @@ static pstatus_t opencl_YUVToRGB(const char* kernelName, const BYTE* const pSrc[
indexes[0] = roi->width; indexes[0] = roi->width;
indexes[1] = roi->height; indexes[1] = roi->height;
ret = clEnqueueNDRangeKernel(cl->commandQueue, kernel, 2, NULL, indexes, NULL, 3, events, NULL); ret = clEnqueueNDRangeKernel(cl->commandQueue, kernel, 2, NULL, indexes, NULL, 0, NULL, NULL);
if (ret != CL_SUCCESS) if (ret != CL_SUCCESS)
{ {
WLog_ERR(TAG, "unable to enqueue call kernel"); WLog_ERR(TAG, "unable to enqueue call kernel");

View File

@ -247,7 +247,7 @@ static BOOL primitives_autodetect_best(primitives_t* prims)
goto out; goto out;
} }
WLog_DBG(TAG, " * %s\t= %" PRIu32, cur->name, cur->count); WLog_DBG(TAG, " * %s= %" PRIu32, cur->name, cur->count);
if (!best || (best->count < cur->count)) if (!best || (best->count < cur->count))
best = cur; best = cur;
} }