diff options
author | Rodeo <[email protected]> | 2013-10-11 12:00:04 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-10-11 12:00:04 +0000 |
commit | 54fde2698cac2a49a0ce786ec04a13fd7360e529 (patch) | |
tree | b8ebbf6953df7779755cc62a374a675448e90d0b /libhb/openclwrapper.c | |
parent | 51497bc0ea176b4f60a4f1bdbd818c4f7c05cb6f (diff) |
scan: print CPU info, GPU info, then QSV info.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5830 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/openclwrapper.c')
-rw-r--r-- | libhb/openclwrapper.c | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/libhb/openclwrapper.c b/libhb/openclwrapper.c index 43da091e1..9c45ea145 100644 --- a/libhb/openclwrapper.c +++ b/libhb/openclwrapper.c @@ -1103,23 +1103,6 @@ int hb_get_opencl_env() devices, NULL ); - for (i = 0; i < numDevices; i++) - { - if (devices[i] != NULL) - { - char deviceVendor[100], deviceName[1024], driverVersion[1024]; - clGetDeviceInfo(devices[i], CL_DEVICE_VENDOR, sizeof(deviceVendor), - deviceVendor, NULL); - clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(deviceName), - deviceName, NULL); - clGetDeviceInfo(devices[i], CL_DRIVER_VERSION, sizeof(driverVersion), - driverVersion, NULL); - hb_log("hb_get_opencl_env: GPU #%d, Device Vendor: %s", i + 1, deviceVendor); - hb_log("hb_get_opencl_env: GPU #%d, Device Name: %s", i + 1, deviceName); - hb_log("hb_get_opencl_env: GPU #%d, Driver Version: %s", i + 1, driverVersion); - } - } - if( devices != NULL ) { free( devices ); @@ -1199,6 +1182,54 @@ void hb_opencl_init() hb_get_opencl_env(); } +void hb_opencl_info_print() +{ + cl_uint i, numDevices; + cl_device_id *devices; + + if (hb_init_opencl_env(&gpu_env)) + { + return; + } + + if (clGetContextInfo(gpu_env.context, CL_CONTEXT_NUM_DEVICES, + sizeof(numDevices), &numDevices, NULL) != CL_SUCCESS) + { + return; + } + + if ((devices = malloc(sizeof(cl_device_id) * numDevices)) == NULL) + { + return; + } + + if (clGetContextInfo(gpu_env.context, CL_CONTEXT_DEVICES, + sizeof(cl_device_id) * numDevices, devices, NULL) != CL_SUCCESS) + { + return; + } + + for (i = 0; i < numDevices; i++) + { + if (devices[i] != NULL) + { + char vendor[100], name[1024], version[1024]; + + clGetDeviceInfo(devices[i], CL_DEVICE_VENDOR, sizeof(vendor), + vendor, NULL); + clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(name), + name, NULL); + clGetDeviceInfo(devices[i], CL_DRIVER_VERSION, sizeof(version), + version, NULL); + + hb_log("GPU #%d: %s %s", i + 1, vendor, name); + hb_log(" - OpenCL driver version: %s", version); + } + } + + free(devices); +} + int hb_use_buffers() { return useBuffers; |