MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / virtgpu_open

Function virtgpu_open

external/ggml/src/ggml-virtgpu/virtgpu.cpp:235–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235static virt_gpu_result_t virtgpu_open(virtgpu * gpu) {
236 drmDevicePtr devs[8];
237 int count = drmGetDevices2(0, devs, ARRAY_SIZE(devs));
238 if (count < 0) {
239 GGML_LOG_ERROR(GGML_VIRTGPU "%s: failed to enumerate DRM devices\n", __func__);
240 return APIR_ERROR_INITIALIZATION_FAILED;
241 }
242
243 virt_gpu_result_t result = APIR_ERROR_INITIALIZATION_FAILED;
244 for (int i = 0; i < count; i++) {
245 result = virtgpu_open_device(gpu, devs[i]);
246 if (result == APIR_SUCCESS) {
247 break;
248 }
249 }
250
251 drmFreeDevices(devs, count);
252
253 return result;
254}
255
256static virt_gpu_result_t virtgpu_open_device(virtgpu * gpu, const drmDevicePtr dev) {
257 const char * node_path = dev->nodes[DRM_NODE_RENDER];

Callers 1

create_virtgpuFunction · 0.85

Calls 1

virtgpu_open_deviceFunction · 0.85

Tested by

no test coverage detected