Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use correct pointer type for CUdeviceptr on aarch64 in nvdec filter #2781

Conversation

rathann
Copy link
Contributor

@rathann rathann commented Mar 12, 2024

This fixes the following warnings:

...
filters/dec_nvdec.c: In function ‘nvdec_flush_frame’:
filters/dec_nvdec.c:1031:98: warning: passing argument 3 of ‘cuvidMapVideoFrame’ from incompatible pointer type [-Wincompatible-pointer-types]
 1031 |                 res = cuvidMapVideoFrame(ctx->dec_inst->cu_decoder, f->frame_info.picture_index, &map_mem, &pitch, &params);
      |                                                                                                  ^~~~~~~~
      |                                                                                                  |
      |                                                                                                  CUdeviceptr * {aka long long unsigned int *}
filters/dec_nvdec.c:1031:98: note: expected ‘unsigned int *’ but argument is of type ‘CUdeviceptr *’ {aka ‘long long unsigned int *’}
filters/dec_nvdec.c: In function ‘nvframe_get_gl_texture’:
filters/dec_nvdec.c:1209:90: warning: passing argument 3 of ‘cuvidMapVideoFrame’ from incompatible pointer type [-Wincompatible-pointer-types]
 1209 |         res = cuvidMapVideoFrame(ctx->dec_inst->cu_decoder, f->frame_info.picture_index, &vid_data, &vid_pitch, &params);
      |                                                                                          ^~~~~~~~~
      |                                                                                          |
      |                                                                                          CUdeviceptr * {aka long long unsigned int *}
filters/dec_nvdec.c:1209:90: note: expected ‘unsigned int *’ but argument is of type ‘CUdeviceptr *’ {aka ‘long long unsigned int *’}
filters/dec_nvdec.c: In function ‘nvframe_get_frame’:
filters/dec_nvdec.c:1319:98: warning: passing argument 3 of ‘cuvidMapVideoFrame’ from incompatible pointer type [-Wincompatible-pointer-types]
 1319 |                 res = cuvidMapVideoFrame(ctx->dec_inst->cu_decoder, f->frame_info.picture_index, &map_mem, &pitch, &params);
      |                                                                                                  ^~~~~~~~
      |                                                                                                  |
      |                                                                                                  CUdeviceptr * {aka long long unsigned int *}
filters/dec_nvdec.c:1319:98: note: expected ‘unsigned int *’ but argument is of type ‘CUdeviceptr *’ {aka ‘long long unsigned int *’}

These became errors in GCC 14. Note: CUdeviceptr was already defined to long long unsingned int * on aarch64:
https://github.com/gpac/gpac/blob/master/src/filters/dec_nvdec_sdk.h#L59 but the condition enabling the use of 64-bit pointers was missing in other places.

This fixes the following warnings:
```
...
filters/dec_nvdec.c: In function ‘nvdec_flush_frame’:
filters/dec_nvdec.c:1031:98: warning: passing argument 3 of ‘cuvidMapVideoFrame’ from incompatible pointer type [-Wincompatible-pointer-types]
 1031 |                 res = cuvidMapVideoFrame(ctx->dec_inst->cu_decoder, f->frame_info.picture_index, &map_mem, &pitch, &params);
      |                                                                                                  ^~~~~~~~
      |                                                                                                  |
      |                                                                                                  CUdeviceptr * {aka long long unsigned int *}
filters/dec_nvdec.c:1031:98: note: expected ‘unsigned int *’ but argument is of type ‘CUdeviceptr *’ {aka ‘long long unsigned int *’}
filters/dec_nvdec.c: In function ‘nvframe_get_gl_texture’:
filters/dec_nvdec.c:1209:90: warning: passing argument 3 of ‘cuvidMapVideoFrame’ from incompatible pointer type [-Wincompatible-pointer-types]
 1209 |         res = cuvidMapVideoFrame(ctx->dec_inst->cu_decoder, f->frame_info.picture_index, &vid_data, &vid_pitch, &params);
      |                                                                                          ^~~~~~~~~
      |                                                                                          |
      |                                                                                          CUdeviceptr * {aka long long unsigned int *}
filters/dec_nvdec.c:1209:90: note: expected ‘unsigned int *’ but argument is of type ‘CUdeviceptr *’ {aka ‘long long unsigned int *’}
filters/dec_nvdec.c: In function ‘nvframe_get_frame’:
filters/dec_nvdec.c:1319:98: warning: passing argument 3 of ‘cuvidMapVideoFrame’ from incompatible pointer type [-Wincompatible-pointer-types]
 1319 |                 res = cuvidMapVideoFrame(ctx->dec_inst->cu_decoder, f->frame_info.picture_index, &map_mem, &pitch, &params);
      |                                                                                                  ^~~~~~~~
      |                                                                                                  |
      |                                                                                                  CUdeviceptr * {aka long long unsigned int *}
filters/dec_nvdec.c:1319:98: note: expected ‘unsigned int *’ but argument is of type ‘CUdeviceptr *’ {aka ‘long long unsigned int *’}
```

These became errors in GCC 14. Note: `CUdeviceptr` was already defined to
`long long unsingned int *` on aarch64:
https://github.com/gpac/gpac/blob/master/src/filters/dec_nvdec_sdk.h#L59
but the condition enabling the use of 64-bit pointers was missing in
other places.
@jeanlf jeanlf merged commit 175bb55 into gpac:master Mar 13, 2024
@jeanlf
Copy link
Member

jeanlf commented Mar 13, 2024

thanks !

@rathann rathann deleted the fix-incompatible-nvdec-pointer-assignment-on-aarch64 branch March 13, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants