Skip to content

Commit

Permalink
Fix: coverity findings. Improve logging of GPU direct (#991)
Browse files Browse the repository at this point in the history
Improve logging of GPU direct and fix issues from coverity.
  • Loading branch information
PanKaker authored Oct 2, 2024
1 parent f33cc15 commit c74fe35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions app/src/rx_fastmetadata_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ static int app_rx_fmd_compare_with_ref(struct st_app_rx_fmd_session* session, vo
int frame_size) {
int ret = -1;
uint32_t last_zeros = 0; /* 4 bytes with 0 */
uint32_t st41_ref_remaining_length =
session ? session->st41_ref_end - session->st41_ref_cursor : 0;
uint32_t st41_ref_remaining_length = session->st41_ref_end - session->st41_ref_cursor;

if (frame_size <= st41_ref_remaining_length) {
ret = memcmp(frame, session->st41_ref_cursor, frame_size);
Expand Down Expand Up @@ -264,8 +263,7 @@ static int app_rx_fmd_init(struct st_app_context* ctx,
s->st41_ref_fd = -1;
if (fmd) {
if (strcmp(fmd->info.fmd_url, "")) {
snprintf(s->st41_ref_url, sizeof(s->st41_ref_url), "%s",
fmd ? fmd->info.fmd_url : "null");
snprintf(s->st41_ref_url, sizeof(s->st41_ref_url), "%s", fmd->info.fmd_url);

ret = app_rx_fmd_open_ref(s);
if (ret < 0) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/st2110/st_rx_video_session.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,11 @@ static int rv_alloc_frames(struct mtl_main_impl* impl,
} else {
#ifdef MTL_GPU_DIRECT_ENABLED
if (rv_framebuffer_in_gpu_direct_vram(s)) {
info("%s: using gpu direct feature.\n", __func__);
info("%s: using GPU direct feature.\n", __func__);
GpuContext* gpu = s->ops.gpu_context;
ret = gpu_allocate_shared_buffer(gpu, &frame, size);
if (ret < 0) {
err("%s: failed to allocate gpu memory on vram. ret: %d\n", __func__, ret);
err("%s: failed to allocate GPU memory on vram. ret: %d\n", __func__, ret);
return -ENOMEM;
}
} else
Expand Down

0 comments on commit c74fe35

Please sign in to comment.