libxcoder 5.8.0
Loading...
Searching...
No Matches
ni_rsrc_api.h
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Copyright (C) 2022 NETINT Technologies
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 * SOFTWARE.
19 *
20 ******************************************************************************/
21
22/*!*****************************************************************************
23 * \file ni_rsrc_api.h
24 *
25 * \brief Public definitions for managing NETINT video processing devices
26 ******************************************************************************/
27
28#pragma once
29
30#include "ni_defs.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define NI_PROFILES_SUPP_STR_LEN 128
37#define NI_LEVELS_SUPP_STR_LEN 64
38#define NI_ADDITIONAL_INFO_STR_LEN 64
39
46
57
58extern bool g_device_in_ctxt;
59extern ni_device_handle_t g_dev_handle;
60
66
72
85
95
101
102typedef struct _ni_device_info
103{
106 int hw_id;
108 int load;
111 int fw_ver_compat_warning; // fw revision is not fully supported by this libxcoder
112 uint8_t fl_ver_nor_flash[8]; // firmware loader version stored in nor flash
113 uint8_t fl_ver_last_ran[8];
114 uint8_t fw_rev_nor_flash[8]; // fw revision stored in nor flash
115 uint8_t fw_rev[8]; // fw revision loaded, i.e., running
116 uint8_t fw_branch_name[256];
117 uint8_t fw_commit_time[26];
118 uint8_t fw_commit_hash[41];
119 uint8_t fw_build_time[26];
120 uint8_t fw_build_id[256];
121
122 uint8_t serial_number[20];
123 uint8_t model_number[40];
124
133
135 ni_lock_handle_t lock;
136 int pcie_gen3_on_gen4_host; /* 1=Gen3 FW on Gen4 host, 0=no, -1=unknown */
137 uint8_t fw_flavour; /* FW flavour byte, '-' if unsupported */
139
140// This structure is very big (2.6MB). Recommend storing in heap
146
153
164
175
177{
178 uint32_t fps;
179 uint32_t h;
180 uint32_t w;
181 uint32_t code_format;
183 uint32_t rdoLevel;
185 uint32_t bit_8_10;
186 int uploader;/*1 for uploader,0 for not uploader*/
187 int rgba;/*1 for rgba,0 for not*/
189
191{
192 uint32_t fps;
193 uint32_t h;
194 uint32_t w;
195 uint32_t bit_8_10;
196 int rgba;
197 int hw_frame;/*if out=hw,1 for out = hw_frame,0 for not*/
199
207
215
222
232{
233 uint16_t vf_id;
234 uint16_t ns_id;
236
243
255
261
269
280
281/*!******************************************************************************
282 * \brief Initialize and create all resources required to work with NETINT NVMe
283 * transcoder devices. This is a high level API function which is used
284 * mostly with user application like FFmpeg that relies on those resources.
285 * In case of custom application integration, revised functionality might
286 * be necessary utilizing coresponding API functions.
287 *
288 * \param[in] should_match_rev 0: transcoder firmware revision matching the
289 * library's version is NOT required for placing
290 * the transcoder into resource pool; 1: otherwise
291 * timeout_seconds 0: No timeout amount, loop until init success
292 * or fail; else: timeout will fail init once reached
293 *
294 * \return
295 * NI_RETCODE_SUCCESS on success
296 * NI_RETCODE_FAILURE on failure
297 *
298 *******************************************************************************/
299LIB_API int ni_rsrc_init(int should_match_rev, int timeout_seconds);
300
301/*!*****************************************************************************
302 * \brief Scan and refresh all resources on the host, taking into account
303 * hot-plugged and pulled out cards.
304 *
305 * \param[in] should_match_rev 0: transcoder firmware revision matching the
306 * library's version is NOT required for placing
307 * the transcoder into resource pool; 1: otherwise
308 *
309 * \return
310 * NI_RETCODE_SUCCESS on success
311 * NI_RETCODE_FAILURE on failure
312 *
313 ******************************************************************************/
314LIB_API ni_retcode_t ni_rsrc_refresh(int should_match_rev);
315
316#ifndef DEPRECATION_AS_ERROR
317/*!******************************************************************************
318 * \brief Scans system for all NVMe devices and returns the system device
319 * names to the user which were identified as NETINT transcoder deivices.
320 * Names are suitable for OpenFile api usage afterwards
321 * This function had been replaced by ni_rsrc_get_local_device_list2
322 * This function can't be callback with multi thread
323 *
324 *
325 * \param[out] ni_devices List of device names identified as NETINT NVMe transcoders
326 * \param[in] max_handles Max number of device names to return
327 *
328 * \return Number if devices found if successfull operation completed
329 * 0 if no NETINT NVMe transcoder devices were found
330 * NI_RETCODE_ERROR_MEM_ALOC if memory allocation failed
331 *******************************************************************************/
333 int max_handles);
334#endif
335
336/*!*****************************************************************************
337 * \brief Scans system for all NVMe devices and returns the system device
338 * names to the user which were identified as NETINT transcoder
339 * devices. Names are suitable for resource management API usage
340 * afterwards
341 * This function had replaced ni_rsrc_get_local_device_list
342 * This function can be callback with multi thread
343 *
344 * \param[out] ni_devices List of device names identified as NETINT NVMe
345 * transcoders
346 * \param[in] max_handles Max number of device names to return
347 * \param[in] xcoder_refresh_dev_names Xcoder fresh device name
348 * \param[in] xcoder_refresh_dev_count Xcoder fresh device number count
349 *
350 * \return Number of devices found. 0 if unsucessful.
351 ******************************************************************************/
353 int max_handles, char **xcoder_refresh_dev_names,
354 int xcoder_refresh_dev_count);
355
356/*!******************************************************************************
357* \brief Allocates and returns a pointer to ni_device_context_t struct
358* based on provided device_type and guid.
359* To be used for load update and codec query.
360*
361 * \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
362 * \param[in] guid GUID of the encoder or decoder device
363*
364* \return pointer to ni_device_context_t if found, NULL otherwise
365*
366* Note: The returned ni_device_context_t content is not supposed to be used by
367* caller directly: should only be passed to API in the subsequent
368* calls; also after its use, the context should be released by
369* calling ni_rsrc_free_device_context.
370*******************************************************************************/
372
373/*!******************************************************************************
374 * \brief Free previously allocated device context
375 *
376 * \param p_device_context Pointer to previously allocated device context
377 *
378 * \return None
379 *******************************************************************************/
381
382/*!******************************************************************************
383* \brief List device(s) based on device type with full information
384* including s/w instances on the system.
385*
386* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
387* \param[out] p_device The device information returned.
388* \param[out] p_device_count The number of ni_device_info_t structs returned.
389*
390* \return
391* NI_RETCODE_SUCCESS
392* NI_RETCODE_FAILURE
393*
394* Note: Caller is responsible for allocating memory for "p_device".
395*******************************************************************************/
397 ni_device_info_t* p_device_info, int* p_device_count);
398
399/*!******************************************************************************
400* \brief List all devices with full information including s/w instances
401* on the system.
402
403* \param[out] p_device The device information returned.
404*
405* \return
406* NI_RETCODE_SUCCESS
407* NI_RETCODE_INVALID_PARAM
408* NI_RETCODE_FAILURE
409*
410* Note: Caller is responsible for allocating memory for "p_device".
411*******************************************************************************/
413
414/*!******************************************************************************
415* \brief Grabs information for every initialized and uninitialized
416* device.
417
418* \param[out] p_device The device information returned.
419* \param list_uninitialized Flag to determine if uninitialized devices
420* should be grabbed.
421*
422* \return
423* NI_RETCODE_SUCCESS
424* NI_RETCODE_INVALID_PARAM
425* NI_RETCODE_FAILURE
426*
427* Note: Caller is responsible for allocating memory for "p_device".
428*******************************************************************************/
429LIB_API ni_retcode_t ni_rsrc_list_all_devices2(ni_device_t* p_device, bool list_uninitialized);
430
431/*!*****************************************************************************
432* \brief Print detailed capability information of all devices
433* on the system.
434
435* \param none
436*
437* \return none
438*
439*******************************************************************************/
441
442/*!*****************************************************************************
443* \brief Prints detailed capability information for all initialized
444* devices and general information about uninitialized devices.
445
446* \param list_uninitialized Flag to determine if uninitialized devices
447* should be grabbed.
448*
449* \return none
450*
451*******************************************************************************/
452LIB_API void ni_rsrc_print_all_devices_capability2(bool list_uninitialized);
453
454/*!******************************************************************************
455* \brief Query a specific device with detailed information on the system
456
457* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
458* \param[in] guid unique device(decoder or encoder) id
459*
460* \return
461* pointer to ni_device_info_t if found
462* NULL otherwise
463*
464* Note: Caller is responsible for releasing memory that was allocated for the
465* returned pointer
466*******************************************************************************/
468
469/*!****************************************************************************
470* \brief Get GUID of the device by block device name and type
471*
472* \param[in] blk_name device's block name
473* \param[in] type device type
474*
475* \return device GUID (>= 0) if found, NI_RETCODE_FAILURE (-1) otherwise
476*******************************************************************************/
477LIB_API int ni_rsrc_get_device_by_block_name(const char *blk_name,
478 ni_device_type_t device_type);
479
480/*!*****************************************************************************
481* \brief Update the load value and s/w instances info of a specific decoder or
482* encoder. This is used by resource management daemon to update periodically.
483*
484* \param[in] p_ctxt The device context returned by ni_rsrc_get_device_context
485* \param[in] p_load The latest load value to update
486* \param[in] sw_instance_cnt Number of s/w instances
487* \param[in] sw_instance_info Info of s/w instances
488*
489* \return
490* NI_RETCODE_SUCCESS
491* NI_RETCODE_FAILURE
492*******************************************************************************/
494 int sw_instance_cnt, const ni_sw_instance_info_t sw_instance_info[]);
495
496/*!*****************************************************************************
497* \brief Allocate resources for decoding/encoding, by designating explicitly
498* the device to use. do not track the load on the host side
499*
500* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
501* \param[in] guid unique device (decoder or encoder) module id
502* \return pointer to ni_device_context_t if found, NULL otherwise
503*
504* Note: only need to specify the device type and guid and codec type
505*
506*
507* Note: the returned ni_device_context_t content is not supposed to be used by
508* caller directly: should only be passed to API in the subsequent
509* calls; also after its use, the context should be released by
510* calling ni_rsrc_free_device_context.
511*******************************************************************************/
513(
514 ni_device_type_t device_type,
515 int guid
516);
517
518/*!*****************************************************************************
519* \brief Release resources allocated for decoding/encoding.
520* function This *must* be called at the end of transcoding
521* with previously assigned load value by allocate* functions.
522*
523* \param[in/out] p_ctxt the device context
524* \param[in] load the load value returned by allocate* functions
525*
526* \return None
527*******************************************************************************/
529 uint64_t load);
530
531/*!*****************************************************************************
532* \brief check the NetInt h/w device in resource pool on the host.
533*
534* \param[in] guid the global unique device index in resource pool
535* device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
536*
537* \return
538* NI_RETCODE_SUCCESS
539*******************************************************************************/
540LIB_API int ni_rsrc_check_hw_available(int guid, ni_device_type_t device_type);
541
542/*!*****************************************************************************
543* \brief Remove an NetInt h/w device from resource pool on the host.
544*
545* \param[in] p_dev the NVMe device name
546*
547* \return
548* NI_RETCODE_SUCCESS
549* NI_RETCODE_FAILURE
550*******************************************************************************/
551LIB_API int ni_rsrc_remove_device(const char* p_dev);
552
553/*!*****************************************************************************
554* \brief Remove all NetInt h/w devices from resource pool on the host.
555*
556* \param none
557*
558* \return
559* NI_RETCODE_SUCCESS
560* NI_RETCODE_FAILURE
561*******************************************************************************/
563
564/*!*****************************************************************************
565* \brief Add an NetInt h/w device into resource pool on the host.
566*
567* \param[in] p_dev the NVMe device name
568* \param[in] should_match_rev 0: transcoder firmware revision matching the
569* library's version is NOT required for placing
570* the transcoder into resource pool; 1: otherwise
571*
572* \return
573* NI_RETCODE_SUCCESS
574* NI_RETCODE_INVALID_PARAM
575* NI_RETCODE_FAILURE
576*******************************************************************************/
577LIB_API int ni_rsrc_add_device(const char* p_dev, int should_match_rev);
578
579/*!*****************************************************************************
580 * \brief Create and return the allocated ni_device_pool_t struct
581 *
582 * \param None
583 *
584 * \return Pointer to ni_device_pool_t struct on success, or NULL on failure
585 *******************************************************************************/
587
588/*!*****************************************************************************
589* \brief Free all resources taken by the device pool
590*
591* \param[in] p_device_pool Poiner to a device pool struct
592*
593* \return None
594*******************************************************************************/
596
597/*!*****************************************************************************
598 * \brief Print the content of the ni_device_info_t struct
599 *
600 * \param p_device_info - pointer to the ni_device_info_t struct to print
601 *
602 * \return None
603 *******************************************************************************/
604LIB_API void ni_rsrc_print_device_info(const ni_device_info_t* p_device_info);
605
606/*!*****************************************************************************
607 * \brief lock a file lock and open a session on a device
608 *
609 * \param device_type
610 * \param lock
611 *
612 * \return None
613 *******************************************************************************/
614LIB_API int ni_rsrc_lock_and_open(int device_type, ni_lock_handle_t* lock);
615
616/*!*****************************************************************************
617 * \brief unlock a file lock
618 *
619 * \param device_type
620 * \param lock
621 *
622 * \return None
623 *******************************************************************************/
624LIB_API int ni_rsrc_unlock(int device_type, ni_lock_handle_t lock);
625
626/*!*****************************************************************************
627* \brief check if device FW revision is compatible with SW API
628*
629* \param fw_rev
630*
631* \return 1 for full compatibility, 2 for partial, 0 for none
632*******************************************************************************/
633LIB_API int ni_rsrc_is_fw_compat(uint8_t fw_rev[8]);
634
635/*!******************************************************************************
636 * \brief get linux numa_node
637 *
638 * \param[in] char *device_name
639 *
640 * \return int atoi(cmd_ret)
641 *******************************************************************************/
642LIB_API int ni_rsrc_get_numa_node(char *device_name);
643
644
645/*!******************************************************************************
646 * \brief Create a pointer to hw_device_info_coder_param_t instance .This instance will be created and
647 * set to default vaule by param mode.You may change the resolution fps bit_8_10 or other vaule you want to set.
648 *
649 * \param[in] mode:0:create instance with decoder_param ,encoder_param, scaler_param and ai_param will be set to NULL
650 * 1:create instance with encoder_param ,decoder_param, scaler_param and ai_param will be set to NULL
651 * 2:create instance with scaler_param ,decoder_param, encoder_param and ai_param will be set to NULL
652 * 3:create instance with ai_param ,decoder_param, encoder_param and scaler_param will be set to NULL
653 * >= 4:create instance with decoder_param encoder_param scaler_param and ai_param for ni_check_hw_info() hw_mode
654 *
655 * \return NULL-error,pointer to an instance when success
656 *******************************************************************************/
658
659/*!******************************************************************************
660 * \brief Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param
661 *
662 *
663 * \param[in] p_hw_device_info_coder_param:pointer to a hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param
664 *
665 *******************************************************************************/
667
668/*!******************************************************************************
669 * \brief Create a pointer to ni_hw_device_info_quadra_t instance .
670 *
671 * \param[in] device_type_num:number of device type to be allocated in this function
672 *
673 * \param[in] avaliable_card_num:number of avaliable card per device to be allocated in this function
674 *
675 * \return NULL-error,pointer to an instance when success
676 *******************************************************************************/
677LIB_API ni_hw_device_info_quadra_t *ni_hw_device_info_alloc_quadra(int device_type_num,int avaliable_card_num);
678
679/*!******************************************************************************
680 * \brief Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param
681 *
682 *
683 * \param[in] p_hw_device_info:pointer to a ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param
684 *
685 *******************************************************************************/
687
688/*!*****************************************************************************
689 * \brief check hw info, return the appropriate card number to use depends on the load&task_num&used resource
690 *
691 * \param[out] pointer_to_p_hw_device_info : pointer to user-supplied ni_hw_device_info_quadra_t (allocated by ni_hw_device_info_alloc).
692 * May be a ponter to NULL ,in which case a ni_hw_device_info_quadra_coder_param_t is allocated by this function
693 * and written to pointer_to_p_hw_device_info.
694 * record the device info, including available card num and which card to select,
695 * and each card's informaton, such as, the load, task num, device type
696 * \param[in] task_mode: affect the scheduling strategy,
697 * 1 - both the load_num and task_num should consider, usually applied to live scenes
698 * 0 - only consider the task_num, don not care the load_num
699 * \param[in] hw_info_threshold_param : an array of threshold including device type task threshold and load threshold
700 * in hw_mode fill the arry with both encoder and decoder threshold or
701 * fill the arry with preferential device type threshold when don not in hw_mode
702 * load threshold in range[0:100] task num threshold in range [0:32]
703 * \param[in] preferential_device_type : which device type is preferential 0:decode 1:encode .
704 * This need to set to encoder/decoder even if in sw_mode to check whether coder_param is wrong.
705 * \param[in] coder_param : encoder and decoder information that helps to choose card .This coder_param can be created and
706 * set to default value by function hw_device_info_coder_param_t * create_hw_device_info_coder_param().
707 * You may change the resolution fps bit_8_10 or other vaule you want to use
708 * \param[in] hw_mode:Set 1 then this function will choose encoder and decoder in just one card .
709 * When no card meets the conditions ,NO card will be choosed.
710 * You can try to use set hw_mode 0 to use sw_mode to do encoder/decoder in different card when hw_mode reports an error
711 * In hw_mode set both encoder_param and decoder_param in coder_param.
712 * Set 0 then just consider sw_mode to choose which card to do encode/decode,
713 * In sw_mode set one param in coder_param the other one will be set to NULL.
714 * \param[in] consider_mem : set 1 this function will consider memory usage extra
715 * set 0 this function will not consider memory usage
716 *
717 * \return 0-error 1-success
718 *******************************************************************************/
719LIB_API int ni_check_hw_info(ni_hw_device_info_quadra_t **pointer_to_p_hw_device_info,
720 int task_mode,
721 ni_hw_device_info_quadra_threshold_param_t *hw_info_threshold_param,
722 ni_device_type_t preferential_device_type,
724 int hw_mode,
725 int consider_mem);
726
727
728/*!*****************************************************************************
729* \brief Allocate resources for decoding/encoding, based on the provided rule
730*
731* \param[in] device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
732* \param[in] rule allocation rule
733* \param[in] codec EN_H264 or EN_H265
734* \param[in] width width of video resolution
735* \param[in] height height of video resolution
736* \param[in] frame_rate video stream frame rate
737* \param[out] p_load the load that will be generated by this encoding
738* task. Returned *only* for encoder for now.
739*
740* \return pointer to ni_device_context_t if found, NULL otherwise
741*
742* Note: codec, width, height, fps need to be supplied for NI_DEVICE_TYPE_ENCODER only,
743* they are ignored otherwize.
744* Note: the returned ni_device_context_t content is not supposed to be used by
745* caller directly: should only be passed to API in the subsequent
746* calls; also after its use, the context should be released by
747* calling ni_rsrc_free_device_context.
748*******************************************************************************/
750 ni_alloc_rule_t rule,
751 ni_codec_t codec,
752 int width, int height,
753 int frame_rate,
754 uint64_t *p_load);
755
756#ifdef __cplusplus
757}
758#endif
Common NETINT definitions used by all modules.
#define NI_DEPRECATED
Definition ni_defs.h:80
#define NI_MAX_DEVICE_CNT
Definition ni_defs.h:235
#define NI_MAX_DEVICE_NAME_LEN
Definition ni_defs.h:236
#define NI_MAX_CONTEXTS_PER_HW_INSTANCE
Definition ni_defs.h:248
ni_device_type_t
Definition ni_defs.h:356
@ NI_DEVICE_TYPE_XCODER_MAX
Definition ni_defs.h:364
ni_retcode_t
Definition ni_defs.h:447
LIB_API int ni_rsrc_remove_all_devices(void)
Remove all NetInt h/w devices from resource pool on the host.
LIB_API NI_DEPRECATED int ni_rsrc_get_local_device_list(char ni_devices[][NI_MAX_DEVICE_NAME_LEN], int max_handles)
Scans system for all NVMe devices and returns the system device names to the user which were identifi...
LIB_API ni_retcode_t ni_rsrc_list_all_devices2(ni_device_t *p_device, bool list_uninitialized)
Grabs information for every initialized and uninitialized device.
struct _ni_device_queue ni_device_queue_t
LIB_API ni_retcode_t ni_rsrc_refresh(int should_match_rev)
Scan and refresh all resources on the host, taking into account hot-plugged and pulled out cards.
#define NI_LEVELS_SUPP_STR_LEN
Definition ni_rsrc_api.h:37
struct _ni_device_extra_info ni_device_extra_info_t
ni_device_context_t * ni_rsrc_allocate_simple_direct(ni_device_type_t device_type, int guid)
Allocate resources for decoding/encoding, by designating explicitly the device to use....
LIB_API int ni_rsrc_lock_and_open(int device_type, ni_lock_handle_t *lock)
lock a file lock and open a session on a device
LIB_API int ni_rsrc_get_numa_node(char *device_name)
get linux numa_node
LIB_API void ni_destory_hw_device_info_quadra_coder_param(ni_hw_device_info_quadra_coder_param_t *p_hw_device_info_quadra_coder_param)
Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_par...
struct _ni_sw_instance_info ni_sw_instance_info_t
int ni_rsrc_update_device_load(ni_device_context_t *p_ctxt, int load, int sw_instance_cnt, const ni_sw_instance_info_t sw_instance_info[])
Update the load value and s/w instances info of a specific decoder or encoder. This is used by resour...
LIB_API int ni_rsrc_unlock(int device_type, ni_lock_handle_t lock)
unlock a file lock
LIB_API void ni_rsrc_print_all_devices_capability(void)
Print detailed capability information of all devices on the system.
LIB_API ni_device_context_t * ni_rsrc_allocate_auto(ni_device_type_t device_type, ni_alloc_rule_t rule, ni_codec_t codec, int width, int height, int frame_rate, uint64_t *p_load)
Allocate resources for decoding/encoding, based on the provided rule.
LIB_API ni_device_info_t * ni_rsrc_get_device_info(ni_device_type_t device_type, int guid)
Query a specific device with detailed information on the system.
struct _ni_card_info_quadra ni_card_info_quadra_t
struct _ni_hw_device_info_quadra_scaler_param ni_hw_device_info_quadra_scaler_param_t
struct _ni_qos_header_info_log_page ni_qos_header_info_log_page_t
struct _ni_hw_device_info_quadra_decoder_param ni_hw_device_info_quadra_decoder_param_t
LIB_API void ni_rsrc_print_device_info(const ni_device_info_t *p_device_info)
Print the content of the ni_device_info_t struct.
ni_device_handle_t g_dev_handle
struct _ni_qos_namespace_info_log_page ni_qos_namespace_info_log_page_t
struct _ni_device_info ni_device_info_t
bool g_device_in_ctxt
#define NI_PROFILES_SUPP_STR_LEN
Definition ni_rsrc_api.h:36
LIB_API ni_hw_device_info_quadra_coder_param_t * ni_create_hw_device_info_quadra_coder_param(int mode)
Create a pointer to hw_device_info_coder_param_t instance .This instance will be created and set to d...
LIB_API int ni_rsrc_remove_device(const char *p_dev)
Remove an NetInt h/w device from resource pool on the host.
struct _ni_hw_device_info_quadra_encoder_param ni_hw_device_info_quadra_encoder_param_t
struct _ni_device_video_capability ni_device_video_capability_t
#define NI_ADDITIONAL_INFO_STR_LEN
Definition ni_rsrc_api.h:38
LIB_API void ni_rsrc_release_resource(ni_device_context_t *p_ctxt, uint64_t load)
Release resources allocated for decoding/encoding. function This must be called at the end of transco...
ni_sw_instance_status_t
Definition ni_rsrc_api.h:62
@ EN_IDLE
Definition ni_rsrc_api.h:63
@ EN_ACTIVE
Definition ni_rsrc_api.h:64
struct _ni_hw_device_info_quadra_threshold_param ni_hw_device_info_quadra_threshold_param_t
struct _ni_device_vf_ns_id ni_device_vf_ns_id_t
struct _ni_rsrc_video_ref_cap ni_rsrc_device_video_ref_cap_t
LIB_API int ni_rsrc_get_local_device_list2(char ni_devices[][NI_MAX_DEVICE_NAME_LEN], int max_handles, char **xcoder_refresh_dev_names, int xcoder_refresh_dev_count)
Scans system for all NVMe devices and returns the system device names to the user which were identifi...
struct _ni_hw_device_info_quadra ni_hw_device_info_quadra_t
LIB_API ni_device_context_t * ni_rsrc_get_device_context(ni_device_type_t type, int guid)
Allocates and returns a pointer to ni_device_context_t struct based on provided device_type and guid....
LIB_API void ni_rsrc_free_device_context(ni_device_context_t *p_ctxt)
Free previously allocated device context.
LIB_API int ni_rsrc_is_fw_compat(uint8_t fw_rev[8])
check if device FW revision is compatible with SW API
struct _ni_device_temp ni_device_temp_t
LIB_API ni_hw_device_info_quadra_t * ni_hw_device_info_alloc_quadra(int device_type_num, int avaliable_card_num)
Create a pointer to ni_hw_device_info_quadra_t instance .
LIB_API void ni_rsrc_print_all_devices_capability2(bool list_uninitialized)
Prints detailed capability information for all initialized devices and general information about unin...
LIB_API ni_retcode_t ni_rsrc_list_devices(ni_device_type_t device_type, ni_device_info_t *p_device_info, int *p_device_count)
List device(s) based on device type with full information including s/w instances on the system.
LIB_API ni_retcode_t ni_rsrc_list_all_devices(ni_device_t *p_device)
List all devices with full information including s/w instances on the system.
LIB_API int ni_rsrc_check_hw_available(int guid, ni_device_type_t device_type)
check the NetInt h/w device in resource pool on the host.
ni_codec_t
Definition ni_rsrc_api.h:48
@ EN_JPEG
Definition ni_rsrc_api.h:53
@ EN_INVALID
Definition ni_rsrc_api.h:49
@ EN_AV1
Definition ni_rsrc_api.h:54
@ EN_H264
Definition ni_rsrc_api.h:50
@ EN_H265
Definition ni_rsrc_api.h:51
@ EN_CODEC_MAX
Definition ni_rsrc_api.h:55
@ EN_VP9
Definition ni_rsrc_api.h:52
struct _ni_device ni_device_t
struct _ni_hw_device_info_quadra_ai_param ni_hw_device_info_quadra_ai_param_t
struct _ni_hw_device_info_quadra_coder_param ni_hw_device_info_quadra_coder_param_t
LIB_API int ni_check_hw_info(ni_hw_device_info_quadra_t **pointer_to_p_hw_device_info, int task_mode, ni_hw_device_info_quadra_threshold_param_t *hw_info_threshold_param, ni_device_type_t preferential_device_type, ni_hw_device_info_quadra_coder_param_t *coder_param, int hw_mode, int consider_mem)
check hw info, return the appropriate card number to use depends on the load&task_num&used resource
ni_alloc_rule_t
@ EN_ALLOC_LEAST_LOAD
@ EN_ALLOC_LEAST_INSTANCE
LIB_API void ni_hw_device_info_free_quadra(ni_hw_device_info_quadra_t *p_hw_device_info)
Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param...
struct _ni_device_pool ni_device_pool_t
LIB_API ni_device_pool_t * ni_rsrc_get_device_pool(void)
Create and return the allocated ni_device_pool_t struct.
LIB_API int ni_rsrc_get_device_by_block_name(const char *blk_name, ni_device_type_t device_type)
Get GUID of the device by block device name and type.
LIB_API void ni_rsrc_free_device_pool(ni_device_pool_t *p_device_pool)
Free all resources taken by the device pool.
struct _ni_device_context ni_device_context_t
LIB_API int ni_rsrc_add_device(const char *p_dev, int should_match_rev)
Add an NetInt h/w device into resource pool on the host.
LIB_API int ni_rsrc_init(int should_match_rev, int timeout_seconds)
Initialize and create all resources required to work with NETINT NVMe transcoder devices....
ni_device_info_t * p_device_info
ni_lock_handle_t lock
char shm_name[NI_MAX_DEVICE_NAME_LEN]
uint8_t fw_build_id[256]
uint8_t fw_commit_time[26]
uint8_t serial_number[20]
char dev_name[NI_MAX_DEVICE_NAME_LEN]
uint8_t fw_rev[8]
uint8_t fw_commit_hash[41]
char blk_name[NI_MAX_DEVICE_NAME_LEN]
ni_sw_instance_info_t sw_instance[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
uint64_t xcode_load_pixel
ni_device_type_t device_type
uint8_t fl_ver_last_ran[8]
uint8_t fw_branch_name[256]
uint8_t model_number[40]
uint8_t fw_rev_nor_flash[8]
uint32_t active_num_inst
uint8_t fw_build_time[26]
uint8_t fl_ver_nor_flash[8]
ni_lock_handle_t lock
ni_device_video_capability_t dev_cap[EN_CODEC_MAX]
ni_device_queue_t * p_device_queue
Definition ni_rsrc_api.h:99
ni_lock_handle_t lock
Definition ni_rsrc_api.h:98
int32_t xcoders[NI_DEVICE_TYPE_XCODER_MAX][NI_MAX_DEVICE_CNT]
Definition ni_rsrc_api.h:70
uint32_t xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
Definition ni_rsrc_api.h:69
int32_t composite_temp
int32_t on_board_temp
int32_t on_die_temp
char level[NI_LEVELS_SUPP_STR_LEN]
Definition ni_rsrc_api.h:82
char profiles_supported[NI_PROFILES_SUPP_STR_LEN]
Definition ni_rsrc_api.h:81
char additional_info[NI_ADDITIONAL_INFO_STR_LEN]
Definition ni_rsrc_api.h:83
ni_device_info_t xcoders[NI_DEVICE_TYPE_XCODER_MAX][NI_MAX_DEVICE_CNT]
int xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
ni_hw_device_info_quadra_encoder_param_t * encoder_param
ni_hw_device_info_quadra_ai_param_t * ai_param
ni_hw_device_info_quadra_decoder_param_t * decoder_param
ni_hw_device_info_quadra_scaler_param_t * scaler_param
ni_card_info_quadra_t ** card_info
ni_device_type_t * device_type
ni_sw_instance_status_t status
Definition ni_rsrc_api.h:89