Skip to content

Commit

Permalink
More printouts in the compute lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorWalter committed Feb 28, 2024
1 parent a02a38c commit 078f142
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/compute_lib/compute_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,20 @@ int compute_lib_init(compute_lib_instance_t* inst)
fprintf(stderr, "[ComputeLib]: Selecting the main renderer path %s", COMPUTE_LIB_GPU_DRI_PATH);
inst->fd = open(COMPUTE_LIB_GPU_DRI_PATH, O_RDWR);
if (inst->fd <= 0) {
fprintf(stderr, "[ComputeLib]: Failed to open main renderer path %s", COMPUTE_LIB_GPU_DRI_PATH);
compute_lib_deinit(inst);
return COMPUTE_LIB_ERROR_GPU_DRI_PATH;
}
} else {
fprintf(stderr, "[ComputeLib]: Selecting the backup renderer path %s", COMPUTE_LIB_GPU_DRI_BACKUP_PATH);
inst->fd = open(COMPUTE_LIB_GPU_DRI_BACKUP_PATH, O_RDWR);
if (inst->fd <= 0) {
fprintf(stderr, "[ComputeLib]: Failed to open backup renderer path %s", COMPUTE_LIB_GPU_DRI_BACKUP_PATH);
compute_lib_deinit(inst);
return COMPUTE_LIB_ERROR_GPU_DRI_BACKUP_PATH;
}
}
fprintf(stderr, "[ComputeLib]: Opened the renderer.");

inst->gbm = gbm_create_device(inst->fd);
if (inst->gbm == NULL) {
Expand Down Expand Up @@ -115,30 +118,38 @@ int compute_lib_init(compute_lib_instance_t* inst)

void compute_lib_deinit(compute_lib_instance_t* inst)
{
fprintf(stderr, "[ComputeLib]: De-initializing Compute lib...");
if (inst->ctx != EGL_NO_CONTEXT && inst->dpy != NULL) {
fprintf(stderr, "[ComputeLib]: Destroying context...");
eglDestroyContext(inst->dpy, inst->ctx);
}
inst->ctx = EGL_NO_CONTEXT;

if (inst->dpy != NULL) {
fprintf(stderr, "[ComputeLib]: Terminating...");
eglTerminate(inst->dpy);
}
inst->dpy = NULL;

if (inst->gbm != NULL) {
fprintf(stderr, "[ComputeLib]: Destroying device...");
gbm_device_destroy(inst->gbm);
}
inst->gbm = NULL;

if (inst->fd > 0) {
fprintf(stderr, "[ComputeLib]: Closing renderer file...");
close(inst->fd);
}
inst->fd = 0;

fprintf(stderr, "[ComputeLib]: Flushing error queue...");
compute_lib_error_queue_flush(inst, NULL);
fprintf(stderr, "[ComputeLib]: Deleting error queue...");
queue_delete(inst->error_queue);

inst->initialised = false;
fprintf(stderr, "[ComputeLib]: De-initialized.");
}

int compute_lib_error_queue_flush(compute_lib_instance_t* inst, FILE* out)
Expand Down

0 comments on commit 078f142

Please sign in to comment.