summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libhb/hb.c15
-rw-r--r--libhb/openclwrapper.c65
-rw-r--r--libhb/openclwrapper.h1
3 files changed, 59 insertions, 22 deletions
diff --git a/libhb/hb.c b/libhb/hb.c
index 18859de95..4186fa65a 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -620,11 +620,6 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
hb_title_close( &title );
}
-#ifdef USE_QSV
- /* Print QSV info here so that it's in all scan and encode logs */
- hb_qsv_info_print();
-#endif
-
/* Print CPU info here so that it's in all scan and encode logs */
const char *cpu_name = hb_get_cpu_name();
const char *cpu_type = hb_get_cpu_platform_name();
@@ -635,6 +630,16 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
}
hb_log(" - logical processor count: %d", hb_get_cpu_count());
+#ifdef USE_OPENCL
+ /* Print OpenCL info here so that it's in all scan and encode logs */
+ hb_opencl_info_print();
+#endif
+
+#ifdef USE_QSV
+ /* Print QSV info here so that it's in all scan and encode logs */
+ hb_qsv_info_print();
+#endif
+
hb_log( "hb_scan: path=%s, title_index=%d", path, title_index );
h->scan_thread = hb_scan_init( h, &h->scan_die, path, title_index,
&h->title_set, preview_count,
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;
diff --git a/libhb/openclwrapper.h b/libhb/openclwrapper.h
index c7606afc0..1ee081da9 100644
--- a/libhb/openclwrapper.h
+++ b/libhb/openclwrapper.h
@@ -71,6 +71,7 @@ int hb_create_kernel( char * kernelname, KernelEnv * env );
int hb_release_kernel( KernelEnv * env );
void hb_opencl_init();
+void hb_opencl_info_print();
int hb_get_opencl_env();