libxcoder  3.5.1
ni_rsrc_priv_logan.cpp
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_priv_logan.cpp
24 *
25 * \brief Private routines related to resource management of NI T-408 devices
26 *
27 *******************************************************************************/
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <fcntl.h>
32 #include <string.h>
33 #include <errno.h>
34 #include <ctype.h>
35 
36 #if defined(__linux__) || defined(__APPLE__)
37 #include <sys/mman.h>
38 #include <sys/types.h>
39 #include <unistd.h>
40 #include <dirent.h>
41 #endif
42 
43 
44 #ifdef __ANDROID__
46 #endif
47 
48 
49 #include "ni_device_api_logan.h"
50 #include "ni_rsrc_api_logan.h"
51 #include "ni_rsrc_priv_logan.h"
52 #include "ni_nvme_logan.h"
53 #include "ni_util_logan.h"
54 
56 
57 /*!******************************************************************************
58  * \brief Update codec record info with retrieved device info from HW
59  *
60  * \param
61  *
62  * \return
63  ******************************************************************************/
65  ni_codec_t fmt,
67  ni_logan_hw_capability_t* p_hw_cap)
68 {
70 
71  if(!p_device_info)
72  {
73  ni_log(NI_LOG_INFO, "Error Null pointer parameter passed\n");
75  LRETURN;
76  }
77 
78  if (NI_LOGAN_DEVICE_TYPE_DECODER == type)
79  {
80  if (EN_H264 == fmt)
81  {
82  p_device_info->supports_h264 = 1;
83  p_device_info->h264_cap.max_res_width = p_hw_cap->max_video_width;
84  p_device_info->h264_cap.max_res_height = p_hw_cap->max_video_height;
85  p_device_info->h264_cap.min_res_width = p_hw_cap->min_video_width;
86  p_device_info->h264_cap.min_res_height = p_hw_cap->min_video_height;
87 
88  if (p_hw_cap->video_profile == 0)
89  {
90  p_device_info->h264_cap.profiles_supported[0] = '\0';
91  strncat(p_device_info->h264_cap.profiles_supported,
92  "Baseline, Constrained Baseline, Main, High, High10",
94  }
95  if (p_hw_cap->video_level == 0)
96  {
97  p_device_info->h264_cap.level[0] = '\0';
98  strncat(p_device_info->h264_cap.level, "Level 6.2", NI_LOGAN_MAX_LEVEL_NAME_LEN);
99  }
100  }
101  else if (EN_H265 == fmt)
102  {
103  p_device_info->supports_h265 = 1;
104 
105  p_device_info->h265_cap.max_res_width = p_hw_cap->max_video_width;
106  p_device_info->h265_cap.max_res_height = p_hw_cap->max_video_height;
107  p_device_info->h265_cap.min_res_width = p_hw_cap->min_video_width;
108  p_device_info->h265_cap.min_res_height = p_hw_cap->min_video_height;
109 
110  if (0 == p_hw_cap->video_profile)
111  {
112  p_device_info->h265_cap.profiles_supported[0] = '\0';
113  strncat(p_device_info->h265_cap.profiles_supported,
114  "Main, Main10", NI_LOGAN_MAX_PROFILE_NAME_LEN);
115  }
116  if (0 == p_hw_cap->video_level)
117  {
118  p_device_info->h265_cap.level[0] = '\0';
119  strncat(p_device_info->h265_cap.level, "Level 6.2 Main-Tier", NI_LOGAN_MAX_LEVEL_NAME_LEN);
120  }
121  }
122  else
123  {
124  ni_log(NI_LOG_INFO, "Error Decoder Codec format %d is not supported\n", fmt);
125  retval = NI_LOGAN_RETCODE_FAILURE;
126  LRETURN;
127  }
128  }
129  else
130  {
132  if (EN_H264 == fmt)
133  {
134  p_device_info->supports_h264 = 1;
135  p_device_info->h264_cap.max_res_width = p_hw_cap->max_video_width;
136  p_device_info->h264_cap.max_res_height = p_hw_cap->max_video_height;
137  p_device_info->h264_cap.min_res_width = p_hw_cap->min_video_width;
138  p_device_info->h264_cap.min_res_height = p_hw_cap->min_video_height;
139 
140  if (p_hw_cap->video_profile == 0)
141  {
142  p_device_info->h264_cap.profiles_supported[0] = '\0';
143  strncat(p_device_info->h264_cap.profiles_supported,
144  "Baseline, Extended, Main, High, High10", NI_LOGAN_MAX_PROFILE_NAME_LEN);
145  }
146  if (p_hw_cap->video_level == 0)
147  {
148  p_device_info->h264_cap.level[0] = '\0';
149  strncat(p_device_info->h264_cap.level, "Level 6.2", NI_LOGAN_MAX_LEVEL_NAME_LEN);
150  }
151  }
152  else if (EN_H265 == fmt)
153  {
154  p_device_info->supports_h265 = 1;
155 
156  p_device_info->h265_cap.max_res_width = p_hw_cap->max_video_width;
157  p_device_info->h265_cap.max_res_height = p_hw_cap->max_video_height;
158  p_device_info->h265_cap.min_res_width = p_hw_cap->min_video_width;
159  p_device_info->h265_cap.min_res_height = p_hw_cap->min_video_height;
160 
161  if (p_hw_cap->video_profile == 0)
162  {
163  p_device_info->h265_cap.profiles_supported[0] = '\0';
164  strncat(p_device_info->h265_cap.profiles_supported,
165  "Main, Main10", NI_LOGAN_MAX_PROFILE_NAME_LEN);
166  }
167  if (p_hw_cap->video_level == 0)
168  {
169  p_device_info->h265_cap.level[0] = '\0';
170  strncat(p_device_info->h265_cap.level, "Level 6.2 Main-Tier", NI_LOGAN_MAX_LEVEL_NAME_LEN);
171  }
172  }
173  else
174  {
175  ni_log(NI_LOG_INFO, "Error Encoder Codec format %d is not supported\n", fmt);
176  retval = NI_LOGAN_RETCODE_FAILURE;
177  }
178  }
179 
180  END:
181 
182  return retval;
183 }
184 
185 /*!******************************************************************************
186  * \brief String comparison function
187  *
188  * \param
189  *
190  * \return
191  *******************************************************************************/
192 int ni_logan_rsrc_strcmp(const void * p_str, const void* p_str1)
193 {
194  const char* l = (const char *)p_str;
195  const char* r = (const char *)p_str1;
196  int vl, vr;
197 
198  while (!isdigit(*l) && (*l) != '\0')
199  {
200  l++;
201  }
202  while (!isdigit(*r) && (*r) != '\0')
203  {
204  r++;
205  }
206  vl = atoi(l);
207  vr = atoi(r);
208  if (vl == vr)
209  {
210  return 0;
211  }
212  else if (vl < vr)
213  {
214  return -1;
215  }
216  else
217  {
218  return 1;
219  }
220 }
221 
222 /*!******************************************************************************
223  * \brief Returns the device lock name
224  *
225  * \param
226  *
227  * \return
228  *******************************************************************************/
230  int32_t guid,
231  char* p_name,
232  size_t max_name_len)
233 {
234  char type = (NI_LOGAN_DEVICE_TYPE_DECODER == device_type ? 'd' : 'e');
235  if (NULL != p_name)
236  {
237  snprintf(p_name, max_name_len, "%s/NI_LOGAN_lck_%c%d", LOCK_DIR, type, guid);
238  }
239 }
240 
241 /*!******************************************************************************
242  * \brief Returns the name of shared memory of the codec record
243  *
244  * \param
245  *
246  * \return
247  *******************************************************************************/
249  int32_t guid,
250  char* p_name,
251  size_t max_name_len)
252 {
253  char type = (device_type == NI_LOGAN_DEVICE_TYPE_DECODER ? 'd' : 'e');
255  if (NULL != p_name)
256  {
257  snprintf(p_name, max_name_len, "NI_LOGAN_shm_%c%d", type, guid);
258  }
259 }
260 
261 /*!*****************************************************************************
262  * \brief Check if a FW_rev retrieved from card is supported by libxcoder.
263  * Support is checked for API flavor, API version, and SW/FW release version.
264  *
265  * \param[in] fw_rev FW revision queried from card firmware
266  *
267  * \return If FW is fully compatible return 1
268  * If FW not compatible return 0
269  * If FW is partially compatible return 2
270  ******************************************************************************/
271 int ni_logan_is_fw_compatible(uint8_t fw_rev[8])
272 {
273  char str_fw_ver[4], str_fw_API_fla[3], str_fw_API_ver[3];
274  int fw_API_ver;
275  char *strtok_token;
276  char str_fw_API_flav_support[] = NI_LOGAN_XCODER_FW_API_FLAVORS_SUPPORTED;
277  const char str_API_flavor_list_delim[2] = ",";
278  int api_flavor_matched = 0;
279 
280  // extract fw version
281  memcpy(str_fw_ver, fw_rev, NI_LOGAN_XCODER_VER_SZ);
282  str_fw_ver[NI_LOGAN_XCODER_VER_SZ] = '\0';
283 
284  // extract fw API flavor
285  memcpy(str_fw_API_fla, &(fw_rev[NI_LOGAN_XCODER_VER_SZ + 1]), NI_LOGAN_XCODER_API_FLAVOR_SZ);
286  str_fw_API_fla[NI_LOGAN_XCODER_API_FLAVOR_SZ] = '\0';
287 
288  // extract fw API version
289  memcpy(str_fw_API_ver, &(fw_rev[NI_LOGAN_XCODER_VER_SZ + 1 + NI_LOGAN_XCODER_API_FLAVOR_SZ]),
291  str_fw_API_ver[NI_LOGAN_XCODER_API_VER_SZ] = '\0';
292 
293  fw_API_ver = atoi(str_fw_API_ver);
294 
295  // check multiple API flavor support
296  strtok_token = strtok(str_fw_API_flav_support, str_API_flavor_list_delim);
297  while(strtok_token != NULL)
298  {
299  if (0 == strcmp(str_fw_API_fla, strtok_token))
300  {
301  api_flavor_matched = 1;
302  break;
303  }
304  strtok_token = strtok(NULL, str_API_flavor_list_delim);
305  }
306 
307  if (! (api_flavor_matched &&
309  {
310  /* ni_log(NI_LOG_INFO, "API-flavor: %s, API-version: %s, is not supported by "
311  "this libxcoder version: %s\n", str_fw_API_fla,
312  str_fw_API_ver, NI_LOGAN_XCODER_REVISION); */
313  return 0; // FWrev is not compatible
314  }
315  else if (strncmp(str_fw_ver, NI_LOGAN_XCODER_FW_VER_SUPPORTED_MIN, NI_LOGAN_XCODER_VER_SZ)
316  < 0)
317  {
318  /* ni_log(NI_LOG_INFO, "WARNING - FW version: %s is below the minimum support version "
319  "(%s) of this libxcoder: %s\n", str_fw_ver,
320  NI_LOGAN_XCODER_FW_VER_SUPPORTED_MIN, NI_LOGAN_XCODER_REVISION); */
321  return 2; // FWrev compatability supports core features but may not support some extra features
322  }
323  return 1; // FWrev is fully compatible
324 }
325 
326 #ifdef _WIN32
327 
328 /*!******************************************************************************
329  * \brief List NETINT nvme devices
330  *
331  * \param
332  *
333  * \return
334  *******************************************************************************/
336  int max_handles)
337 {
338  return ni_logan_nvme_enumerate_devices(ni_logan_devices, max_handles);
339 }
340 
341 /*!******************************************************************************
342  * \brief Retrieve codec record info
343  *
344  * \param
345  *
346  * \return
347  *******************************************************************************/
349 {
350  char shm_name[32] = { 0 };
351  char lck_name[32] = { 0 };
352  DWORD rc = 0;
353  ni_logan_device_info_t * p_coder_info_map = NULL;
354  HANDLE map_file_handle = NULL;
355  ni_lock_handle_t mutex_handle = NULL;
356  SECURITY_DESCRIPTOR security_descriptor = { 0 };
357 
358  if(!p_device_info)
359  {
360  return;
361  }
362 
363  ni_logan_rsrc_get_shm_name(p_device_info->device_type, p_device_info->module_id, shm_name, sizeof(shm_name));
364  ni_logan_rsrc_get_lock_name(p_device_info->device_type, p_device_info->module_id, lck_name, sizeof(lck_name));
365  ni_log(NI_LOG_INFO, "Creating shm_name: %s \n", shm_name);
366 
367  InitializeSecurityDescriptor(&security_descriptor, SECURITY_DESCRIPTOR_REVISION);
368  //security_descriptor.Control
369 
370  map_file_handle = CreateFileMapping(
371  INVALID_HANDLE_VALUE, // use paging file
372  NULL, // default security
373  PAGE_READWRITE, // read/write access
374  0, // maximum object size (high-order DWORD)
375  sizeof(ni_logan_device_info_t),// maximum object size (low-order DWORD)
376  (LPCSTR)shm_name // name of mapping object
377  );
378 
379  if (NULL == map_file_handle)
380  {
381  rc = NI_ERRNO;
382  ni_log(NI_LOG_INFO, "ERROR %d: ni_logan_rsrc_get_one_device_info() CreateFileMapping failed for %s\n",
383  rc, shm_name);
384  LRETURN;
385  }
386  else
387  {
388  rc = NI_ERRNO;
389  if (ERROR_ALREADY_EXISTS == rc)
390  {
391  ni_log(NI_LOG_INFO, "CreateFileMapping returned existing handle for %s ..\n", shm_name);
392  }
393  else
394  {
395  ni_log(NI_LOG_INFO, "CreateFileMapping created a new mapFile for %s, handle: %p ..\n",
396  shm_name, map_file_handle);
397  }
398  }
399 
400  p_coder_info_map = (ni_logan_device_info_t *) MapViewOfFile(
401  map_file_handle, // handle to map object
402  FILE_MAP_ALL_ACCESS, // read/write permission
403  0,
404  0,
405  sizeof(ni_logan_device_info_t)
406  );
407 
408  if (NULL == p_coder_info_map)
409  {
410  rc = NI_ERRNO;
411  ni_log(NI_LOG_INFO, "ERROR %d: ni_logan_rsrc_get_one_device_info() Could not map view of file\n", rc);
412  LRETURN;
413  }
414 
415  memcpy(p_coder_info_map, p_device_info, sizeof(ni_logan_device_info_t));
416 
417  END:
418 
419  if (p_coder_info_map)
420  {
421  UnmapViewOfFile(p_coder_info_map);
422  }
423 
424 }
425 
426 
427 
428 
429 
430 /*!******************************************************************************
431  * \brief Updates the codec record
432  *
433  * \param
434  *
435  * \return
436  *******************************************************************************/
438  ni_logan_session_context_t* p_session_context)
439 {
440  int i = 0;
441 
442  if( (!p_device_context) || (!p_session_context) )
443  {
444  return;
445  }
446 
447  p_device_context->p_device_info->load = p_session_context->load_query.current_load;
448  p_device_context->p_device_info->active_num_inst = p_session_context->load_query.total_contexts;
449  // Now we get the model load from the FW
450  p_device_context->p_device_info->model_load = p_session_context->load_query.fw_model_load;
451  if ( 0 == p_device_context->p_device_info->active_num_inst )
452  {
453  p_device_context->p_device_info->load = 0;
454  }
455 
456  for (i = 0; i < p_device_context->p_device_info->active_num_inst; i++)
457  {
458  p_device_context->p_device_info->sw_instance[i].id =
459  p_session_context->load_query.context_status[i].context_id;
460  p_device_context->p_device_info->sw_instance[i].status = (ni_sw_instance_status_t)
461  p_session_context->load_query.context_status[i].context_status;
462  p_device_context->p_device_info->sw_instance[i].codec = (ni_codec_t)
463  p_session_context->load_query.context_status[i].codec_format;
464  p_device_context->p_device_info->sw_instance[i].width =
465  p_session_context->load_query.context_status[i].video_width;
466  p_device_context->p_device_info->sw_instance[i].height =
467  p_session_context->load_query.context_status[i].video_height;
468  p_device_context->p_device_info->sw_instance[i].fps =
469  p_session_context->load_query.context_status[i].fps;
470  }
471 }
472 #elif defined(__linux__) || defined(__APPLE__)
473 
474 /*!******************************************************************************
475  * \brief Retrieve codec record info
476  *
477  * \param
478  *
479  * \return
480  *******************************************************************************/
482 {
483  int32_t shm_fd = -1;
484  char shm_name[32] = { 0 };
485  char lck_name[32] = { 0 };
486  int32_t lock = -1;
488  ni_logan_device_info_t * p_coder_info_dst = NULL;
489 
490  if( !p_device_info )
491  {
492  return;
493  }
494 
495  ni_logan_rsrc_get_shm_name(p_device_info->device_type, p_device_info->module_id, shm_name, sizeof(shm_name));
496  ni_logan_rsrc_get_lock_name(p_device_info->device_type, p_device_info->module_id, lck_name, sizeof(lck_name));
497 
498  ni_log(NI_LOG_INFO, "Creating shm_name: %s , lck_name %s\n", shm_name, lck_name);
499 
500 #ifdef __ANDROID__
501  int ret = ni_logan_rsrc_android_init();
502 
503  if (service_logan == NULL)
504  {
505  ni_log(NI_LOG_ERROR, "ni_logan_rsrc_get_one_device_info Error service ..");
506  return;
507  }
508  string param = shm_name;
509  Return<void> retvalue = service_logan->GetAppFlag(param, [&](int32_t ret, hidl_handle handle) {
510  ni_log(NI_LOG_INFO, "GetAppFlag: ret %d\n", ret);
511  if(ret > 0){
512  shm_fd = dup(handle->data[0]);
513  ni_log(NI_LOG_INFO, "vendor:GetAppFlag shm_fd:%d\n", shm_fd);
514  }else{
515  ni_log(NI_LOG_ERROR, "Error %d: shm_get shm_fd ..\n", NI_ERRNO);
516  }
517  });
518  if(!retvalue.isOk()) {
519  ni_log(NI_LOG_ERROR, "service_logan->GetAppFlag ret failed ..\n");
520  LRETURN;
521  }
522  if (shm_fd < 0)
523  {
524  int fd = ashmem_create_region(shm_name, sizeof(ni_logan_device_info_t));
525  if (fd >= 0)
526  {
527  native_handle_t *handle = native_handle_create(1, 0);
528  handle->data[0] = fd;
529  service_logan->SetAppFlag(param, handle);
530  shm_fd = dup(fd);
531  ni_log(NI_LOG_ERROR, "Create shm fd %d\n", shm_fd);
532  }
533  }
534 
535  /*String8 param;
536  param.setTo(shm_name, STR_BUFFER_LEN);
537  shm_fd = service->getFd(param);
538  if (service == NULL)
539  {
540  perror("ni_logan_rsrc_get_one_device_info Error service ..");
541  LRETURN;
542  }
543  shm_fd = service->getFd(param);
544  if (shm_fd < 0)
545  {
546  shm_fd = ashmem_create_region(shm_name, sizeof(ni_logan_device_info_t));
547  if (shm_fd >= 0)
548  {
549  service->setFd(param, shm_fd);
550  }
551  }*/
552 
553 #else
554  shm_fd = shm_open(shm_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
555 #endif
556 
557  if (shm_fd < 0)
558  {
559  ni_log(NI_LOG_ERROR, "Error %d: shm_open ..", NI_ERRNO);
560  error = NI_LOGAN_RETCODE_FAILURE;
561  LRETURN;
562  }
563 
564 #ifndef __ANDROID__
566  if (ftruncate(shm_fd, sizeof(ni_logan_device_info_t)) < 0)
567  {
568  ni_log(NI_LOG_ERROR, "Error %d: ftruncate ..", NI_ERRNO);
569  error = NI_LOGAN_RETCODE_FAILURE;
570  LRETURN;
571  }
572 #endif
573 
575  p_coder_info_dst = (ni_logan_device_info_t *)mmap(0, sizeof(ni_logan_device_info_t), PROT_READ | PROT_WRITE,
576  MAP_SHARED, shm_fd, 0);
577  if (MAP_FAILED == p_coder_info_dst)
578  {
579  ni_log(NI_LOG_ERROR, "Error %d: mmap ...", NI_ERRNO);
580  error = NI_LOGAN_RETCODE_FAILURE;
581  LRETURN;
582  }
583 
584  memcpy(p_coder_info_dst, p_device_info, sizeof(ni_logan_device_info_t));
585 
586  if (msync((void*)p_coder_info_dst, sizeof(ni_logan_device_info_t), MS_SYNC | MS_INVALIDATE))
587  {
588  ni_log(NI_LOG_ERROR, "%s msync\n", __FUNCTION__);
589  }
590  else
591  {
592  ni_log(NI_LOG_INFO, "%s written out.\n", __FUNCTION__);
593  }
594 
596  lock = open(lck_name, O_RDWR | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
597  if (lock < 0)
598  {
599  ni_log(NI_LOG_ERROR, "Error %d: open lock file ... %s",
600  NI_ERRNO, lck_name) ;
601  error = NI_LOGAN_RETCODE_FAILURE;
602  LRETURN;
603  }
604 
605  END:
606 
607  if (shm_fd >= 0)
608  {
609  close(shm_fd);
610  }
611 
612  if ((NI_LOGAN_RETCODE_SUCCESS != error) && (lock > 0))
613  {
614  close(lock);
615  }
616 
617 }
618 
619 /*!******************************************************************************
620  * \brief Updates the codec record
621  *
622  * \param
623  *
624  * \return
625  *******************************************************************************/
627  ni_logan_session_context_t *p_session_context)
628 {
629  int j;
630 
631  if (!p_device_context || !p_session_context)
632  {
633  return;
634  }
635 
636  p_device_context->p_device_info->load = p_session_context->load_query.current_load;
637  p_device_context->p_device_info->active_num_inst = p_session_context->load_query.total_contexts;
638  // Now we get the model load from the FW
639  p_device_context->p_device_info->model_load = p_session_context->load_query.fw_model_load;
640  if (0 == p_device_context->p_device_info->active_num_inst)
641  {
642  p_device_context->p_device_info->load = 0;
643  }
644  for (j = 0; j < p_device_context->p_device_info->active_num_inst; j++)
645  {
646  p_device_context->p_device_info->sw_instance[j].id =
647  p_session_context->load_query.context_status[j].context_id;
648  p_device_context->p_device_info->sw_instance[j].status = (ni_sw_instance_status_t)
649  p_session_context->load_query.context_status[j]
651  p_device_context->p_device_info->sw_instance[j].codec = (ni_codec_t)
652  p_session_context->load_query.context_status[j]
653  .codec_format;
654  p_device_context->p_device_info->sw_instance[j].width =
655  p_session_context->load_query.context_status[j].video_width;
656  p_device_context->p_device_info->sw_instance[j].height =
657  p_session_context->load_query.context_status[j].video_height;
658  p_device_context->p_device_info->sw_instance[j].fps =
659  p_session_context->load_query.context_status[j].fps;
660  }
661  if (msync((void *)p_device_context->p_device_info, sizeof(ni_logan_device_info_t), MS_SYNC | MS_INVALIDATE))
662  {
663  ni_log(NI_LOG_ERROR, "%s msync\n", __FUNCTION__);
664  }
665 }
666 #endif
ni_logan_retcode_t
@ NI_LOGAN_RETCODE_INVALID_PARAM
@ NI_LOGAN_RETCODE_SUCCESS
@ NI_LOGAN_RETCODE_FAILURE
#define END
#define NI_LOGAN_XCODER_API_VER_SZ
Definition: ni_defs_logan.h:69
#define NI_LOGAN_MAX_LEVEL_NAME_LEN
#define NI_LOGAN_XCODER_VER_SZ
Definition: ni_defs_logan.h:67
#define NI_LOGAN_MAX_PROFILE_NAME_LEN
#define NI_ERRNO
#define NI_LOGAN_XCODER_FW_API_VER_SUPPORTED_MIN
Definition: ni_defs_logan.h:65
#define NI_LOGAN_XCODER_FW_VER_SUPPORTED_MIN
Definition: ni_defs_logan.h:63
#define NI_LOGAN_MAX_DEVICE_NAME_LEN
ni_logan_device_type_t
@ NI_LOGAN_DEVICE_TYPE_DECODER
#define NI_LOGAN_XCODER_API_FLAVOR_SZ
Definition: ni_defs_logan.h:68
#define LRETURN
#define NI_LOGAN_XCODER_FW_API_FLAVORS_SUPPORTED
Definition: ni_defs_logan.h:64
#define atoi(p_str)
Main NETINT device API header file provides the ability to communicate with NI T-408 type hardware tr...
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
Definition: ni_log_logan.c:120
@ NI_LOG_ERROR
Definition: ni_log_logan.h:64
@ NI_LOG_INFO
Definition: ni_log_logan.h:65
Definitions related to working with NI T-408 over NVME interface.
int ni_logan_nvme_enumerate_devices(char ni_logan_devices[][NI_LOGAN_MAX_DEVICE_NAME_LEN], int max_handles)
prints a report on detected nvme devices
int ni_logan_rsrc_android_init()
Init android net.int.SharedBuffer service for binder using.
android::sp< INidec > service_logan
Exported definitions related to resource management of NI T-408 devices.
ni_sw_instance_status_t
ni_codec_t
@ EN_H264
@ EN_H265
void ni_logan_rsrc_get_lock_name(ni_logan_device_type_t device_type, int32_t guid, char *p_name, size_t max_name_len)
Returns the device lock name.
ni_logan_retcode_t ni_logan_rsrc_fill_device_info(ni_logan_device_info_t *p_device_info, ni_codec_t fmt, ni_logan_device_type_t type, ni_logan_hw_capability_t *p_hw_cap)
Update codec record info with retrieved device info from HW.
void ni_logan_rsrc_get_shm_name(ni_logan_device_type_t device_type, int32_t guid, char *p_name, size_t max_name_len)
Returns the name of shared memory of the codec record.
uint32_t g_logan_xcoder_stop_process
int ni_logan_is_fw_compatible(uint8_t fw_rev[8])
Check if a FW_rev retrieved from card is supported by libxcoder. Support is checked for API flavor,...
int ni_logan_rsrc_strcmp(const void *p_str, const void *p_str1)
String comparison function.
Private definitions related to resource management of NI T-408 devices.
void ni_logan_rsrc_get_one_device_info(ni_logan_device_info_t *p_device_info)
Retrieve codec record info.
void ni_logan_rsrc_update_record(ni_logan_device_context_t *p_device_context, ni_logan_session_context_t *p_session_ctx)
Updates the codec record.
#define LOCK_DIR
int ni_logan_rsrc_enumerate_devices(char ni_logan_devices[][NI_LOGAN_MAX_DEVICE_NAME_LEN], int max_handles)
List NETINT nvme devices.
Exported utility routines definition.
ni_logan_device_info_t * p_device_info
ni_logan_device_video_capability_t h264_cap
ni_logan_device_type_t device_type
ni_logan_device_video_capability_t h265_cap
ni_logan_sw_instance_info_t sw_instance[NI_LOGAN_MAX_CONTEXTS_PER_HW_INSTANCE]
char level[NI_LOGAN_MAX_LEVEL_NAME_LEN]
char profiles_supported[NI_LOGAN_MAX_PROFILE_NAME_LEN]
hardware capability type
ni_logan_context_query_t context_status[NI_LOGAN_MAX_CONTEXTS_PER_HW_INSTANCE]
ni_logan_load_query_t load_query
ni_sw_instance_status_t status