summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaviraju D B2019-10-22 07:09:46 -0500
committerAmit Makani2019-12-06 00:38:35 -0600
commit87097eafb30865f5e8fbc9e1ef5fa3e942973d54 (patch)
treec582780cc7e1decef6dd099b9f3a2ef8f2f7ef65
parenta8ccf04428349a5a51b901e1513c4fc7d262de2d (diff)
downloadti-img-encode-decode-87097eafb30865f5e8fbc9e1ef5fa3e942973d54.tar.gz
ti-img-encode-decode-87097eafb30865f5e8fbc9e1ef5fa3e942973d54.tar.xz
ti-img-encode-decode-87097eafb30865f5e8fbc9e1ef5fa3e942973d54.zip
decoder: 1st set of fixes for Klocwork reported warning issues
This patch fixes multiple warnings reported by Klockwork static analysis tool. No functionality change introduced with these fixes. Signed-off-by: Gaviraju D B <x1046101@ti.com>
-rw-r--r--driver/common/addr_alloc.c243
-rw-r--r--driver/common/hash.c36
-rw-r--r--driver/common/idgen_api.c2
-rw-r--r--driver/common/img_mem_man.c9
-rw-r--r--driver/common/img_mem_unified.c7
-rw-r--r--driver/common/resource.c15
-rw-r--r--driver/common/resource.h2
-rw-r--r--driver/common/rman_api.c7
-rw-r--r--driver/common/talmmu_api.c4
-rw-r--r--driver/common/talmmu_api.h2
-rw-r--r--driver/decoder/bspp.c17
-rw-r--r--driver/decoder/core.c16
-rw-r--r--driver/decoder/dec_resources.c9
-rw-r--r--driver/decoder/decoder.c54
-rw-r--r--driver/decoder/h264_secure_parser.c583
-rw-r--r--driver/decoder/hevc_secure_parser.c8
-rw-r--r--driver/decoder/hw_control.c79
-rw-r--r--driver/decoder/hw_control.h2
-rw-r--r--driver/decoder/pixel_api.c19
-rw-r--r--driver/decoder/swsr.c26
-rw-r--r--driver/decoder/translation_api.c25
-rw-r--r--driver/decoder/vdec_mmu_wrapper.c8
-rw-r--r--driver/decoder/vdecdd_utils_buf.c64
-rw-r--r--driver/decoder/vxd_core.c6
-rw-r--r--driver/decoder/vxd_int.c12
-rw-r--r--driver/decoder/vxd_int.h6
-rw-r--r--osal/inc/osa_queue.h2
-rw-r--r--osal/inc/osa_time.h6
-rw-r--r--osal/src/tirtos/osa_queue.c4
-rw-r--r--timmlib/decoder/mm_dec_create.c12
-rw-r--r--timmlib/decoder/mm_dec_init.c8
31 files changed, 540 insertions, 753 deletions
diff --git a/driver/common/addr_alloc.c b/driver/common/addr_alloc.c
index 917d9a2..40c4a30 100644
--- a/driver/common/addr_alloc.c
+++ b/driver/common/addr_alloc.c
@@ -285,58 +285,46 @@ int32 addr_cx_malloc(struct addr_context * const context,
285 285
286 osa_mutex_lock_nested(global_lock, OSA_SUBCLASS_ADDR_ALLOC); 286 osa_mutex_lock_nested(global_lock, OSA_SUBCLASS_ADDR_ALLOC);
287 287
288 do { 288 tmp_region = context->regions;
289 tmp_region = context->regions;
290 /* If the allocation is for the default region */
291 if (!name) {
292 if (!context->default_region) {
293 osa_mutex_unlock(global_lock);
294 return IMG_ERROR_UNEXPECTED_STATE;
295 }
296
297 tmp_region = context->default_region;
298 } else {
299 /*
300 * Run down the list of existing named
301 * regions to locate this
302 */
303 while (tmp_region &&
304 (strcmp(name, tmp_region->name) != 0) &&
305 (tmp_region->nxt_region)) {
306 tmp_region = tmp_region->nxt_region;
307 }
308 /* If there was no match. */
309 if (!tmp_region ||
310 (strcmp(name, tmp_region->name) != 0)) {
311 /* Use the default */
312 if (!context->default_region) {
313 osa_mutex_unlock(global_lock);
314 return IMG_ERROR_UNEXPECTED_STATE;
315 }
316
317 tmp_region = context->default_region;
318 }
319 }
320 289
321 if (!tmp_region) { 290 /*
291 * Run down the list of existing named
292 * regions to locate this
293 */
294 while (tmp_region &&
295 (strcmp(name, tmp_region->name) != 0) &&
296 (tmp_region->nxt_region)) {
297 tmp_region = tmp_region->nxt_region;
298 }
299 /* If there was no match. */
300 if (!tmp_region ||
301 (strcmp(name, tmp_region->name) != 0)) {
302 /* Use the default */
303 if (!context->default_region) {
322 osa_mutex_unlock(global_lock); 304 osa_mutex_unlock(global_lock);
323 return IMG_ERROR_UNEXPECTED_STATE; 305 return IMG_ERROR_UNEXPECTED_STATE;
324 } 306 }
325 307
326 /* Allocate size + guard band */ 308 tmp_region = context->default_region;
327 result = vid_ra_alloc(tmp_region->arena, 309 }
328 size + tmp_region->guard_band, 310
329 NULL, 311 if (!tmp_region) {
330 NULL, 312 osa_mutex_unlock(global_lock);
331 SEQUENTIAL_ALLOCATION, 313 return IMG_ERROR_UNEXPECTED_STATE;
332 1, 314 }
333 base_adr); 315
334 if (result != IMG_SUCCESS) { 316 /* Allocate size + guard band */
335 osa_mutex_unlock(global_lock); 317 result = vid_ra_alloc(tmp_region->arena,
336 return IMG_ERROR_OUT_OF_MEMORY; 318 size + tmp_region->guard_band,
337 } 319 NULL,
338 break; 320 NULL,
339 } while (TRUE); 321 SEQUENTIAL_ALLOCATION,
322 1,
323 base_adr);
324 if (result != IMG_SUCCESS) {
325 osa_mutex_unlock(global_lock);
326 return IMG_ERROR_OUT_OF_MEMORY;
327 }
340 328
341 osa_mutex_unlock(global_lock); 329 osa_mutex_unlock(global_lock);
342 330
@@ -356,59 +344,36 @@ int32 addr_cx_malloc_res(struct addr_context * const context,
356 344
357 osa_mutex_lock_nested(global_lock, OSA_SUBCLASS_ADDR_ALLOC); 345 osa_mutex_lock_nested(global_lock, OSA_SUBCLASS_ADDR_ALLOC);
358 346
359 do { 347 tmp_region = context->regions;
360 tmp_region = context->regions; 348 /* If the allocation is for the default region */
361 /* If the allocation is for the default region */ 349 /*
362 if (!name) { 350 * Run down the list of existing named
363 if (!context->default_region) { 351 * regions to locate this
364 osa_mutex_unlock(global_lock); 352 */
365 return IMG_ERROR_UNEXPECTED_STATE; 353 while (tmp_region && (strcmp(name, tmp_region->name) != 0)
366 } 354 && (tmp_region->nxt_region)) {
367 355 tmp_region = tmp_region->nxt_region;
368 tmp_region = context->default_region; 356 }
369 } else { 357 /* If there was no match. */
370 /* 358 if (!tmp_region || (strcmp(name, tmp_region->name) != 0)) {
371 * Run down the list of existing named 359 /* Use the default */
372 * regions to locate this 360 if (!context->default_region) {
373 */
374 while (tmp_region &&
375 (strcmp(name, tmp_region->name) != 0) &&
376 (tmp_region->nxt_region)) {
377 tmp_region = tmp_region->nxt_region;
378 }
379 /* If there was no match. */
380 if (!tmp_region ||
381 (strcmp(name, tmp_region->name) != 0)) {
382 /* Use the default */
383 if (!context->default_region) {
384 osa_mutex_unlock(global_lock);
385 return IMG_ERROR_UNEXPECTED_STATE;
386 }
387
388 tmp_region = context->default_region;
389 }
390 }
391
392 if (!tmp_region) {
393 osa_mutex_unlock(global_lock); 361 osa_mutex_unlock(global_lock);
394 return IMG_ERROR_UNEXPECTED_STATE; 362 return IMG_ERROR_UNEXPECTED_STATE;
395 } 363 }
396 364 tmp_region = context->default_region;
397 /* Allocate size + guard band */ 365 }
398 result = vid_ra_alloc(tmp_region->arena, 366 if (!tmp_region) {
399 size + tmp_region->guard_band, 367 osa_mutex_unlock(global_lock);
400 NULL, 368 return IMG_ERROR_UNEXPECTED_STATE;
401 NULL, 369 }
402 SEQUENTIAL_ALLOCATION, 370 /* Allocate size + guard band */
403 1, 371 result = vid_ra_alloc(tmp_region->arena, size + tmp_region->guard_band,
404 base_adr); 372 NULL, NULL, SEQUENTIAL_ALLOCATION, 1, base_adr);
405 if (result != IMG_SUCCESS) { 373 if (result != IMG_SUCCESS) {
406 osa_mutex_unlock(global_lock); 374 osa_mutex_unlock(global_lock);
407 return IMG_ERROR_OUT_OF_MEMORY; 375 return IMG_ERROR_OUT_OF_MEMORY;
408 } 376 }
409 break;
410 } while (TRUE);
411
412 osa_mutex_unlock(global_lock); 377 osa_mutex_unlock(global_lock);
413 378
414 return result; 379 return result;
@@ -423,62 +388,50 @@ int32 addr_cx_malloc_align_res(struct addr_context * const context,
423 uint32 result; 388 uint32 result;
424 struct addr_region *tmp_region = NULL; 389 struct addr_region *tmp_region = NULL;
425 390
426 if (!context || !base_adr) 391 if (!context || !base_adr || !name)
427 return IMG_ERROR_INVALID_PARAMETERS; 392 return IMG_ERROR_INVALID_PARAMETERS;
428 393
429 osa_mutex_lock_nested(global_lock, OSA_SUBCLASS_ADDR_ALLOC); 394 osa_mutex_lock_nested(global_lock, OSA_SUBCLASS_ADDR_ALLOC);
430 395
431 do { 396 tmp_region = context->regions;
432 tmp_region = context->regions;
433 /* If the allocation is for the default region */
434 if (!name) {
435 if (!context->default_region) {
436 osa_mutex_unlock(global_lock);
437 return IMG_ERROR_UNEXPECTED_STATE;
438 }
439
440 tmp_region = context->default_region;
441 } else {
442 /*
443 * Run down the list of existing named
444 * regions to locate this
445 */
446 while (tmp_region &&
447 (strcmp(name, tmp_region->name) != 0) &&
448 (tmp_region->nxt_region)) {
449 tmp_region = tmp_region->nxt_region;
450 }
451 /* If there was no match. */
452 if (!tmp_region ||
453 (strcmp(name, tmp_region->name) != 0)) {
454 /* Use the default */
455 if (!context->default_region) {
456 osa_mutex_unlock(global_lock);
457 return IMG_ERROR_UNEXPECTED_STATE;
458 }
459
460 tmp_region = context->default_region;
461 }
462 }
463 397
464 if (!tmp_region) { 398 /*
399 * Run down the list of existing named
400 * regions to locate this
401 */
402 while (tmp_region &&
403 (strcmp(name, tmp_region->name) != 0) &&
404 (tmp_region->nxt_region)) {
405 tmp_region = tmp_region->nxt_region;
406 }
407 /* If there was no match. */
408 if (!tmp_region ||
409 (strcmp(name, tmp_region->name) != 0)) {
410 /* Use the default */
411 if (!context->default_region) {
465 osa_mutex_unlock(global_lock); 412 osa_mutex_unlock(global_lock);
466 return IMG_ERROR_UNEXPECTED_STATE; 413 return IMG_ERROR_UNEXPECTED_STATE;
467 } 414 }
468 /* Allocate size + guard band */ 415
469 result = vid_ra_alloc(tmp_region->arena, 416 tmp_region = context->default_region;
470 size + tmp_region->guard_band, 417 }
471 NULL, 418
472 NULL, 419 if (!tmp_region) {
473 SEQUENTIAL_ALLOCATION, 420 osa_mutex_unlock(global_lock);
474 alignment, 421 return IMG_ERROR_UNEXPECTED_STATE;
475 base_adr); 422 }
476 if (result != IMG_SUCCESS) { 423 /* Allocate size + guard band */
477 osa_mutex_unlock(global_lock); 424 result = vid_ra_alloc(tmp_region->arena,
478 return IMG_ERROR_OUT_OF_MEMORY; 425 size + tmp_region->guard_band,
479 } 426 NULL,
480 break; 427 NULL,
481 } while (TRUE); 428 SEQUENTIAL_ALLOCATION,
429 alignment,
430 base_adr);
431 if (result != IMG_SUCCESS) {
432 osa_mutex_unlock(global_lock);
433 return IMG_ERROR_OUT_OF_MEMORY;
434 }
482 435
483 osa_mutex_unlock(global_lock); 436 osa_mutex_unlock(global_lock);
484 437
diff --git a/driver/common/hash.c b/driver/common/hash.c
index 9ecd9be..e3c2048 100644
--- a/driver/common/hash.c
+++ b/driver/common/hash.c
@@ -162,6 +162,7 @@ static int32 hash_resize(struct hash *hash_arg,
162{ 162{
163 uint32 malloc_sz = 0; 163 uint32 malloc_sz = 0;
164 uint32 result = IMG_ERROR_FATAL; 164 uint32 result = IMG_ERROR_FATAL;
165 uint32 idx;
165 166
166 if (!hash_arg) { 167 if (!hash_arg) {
167 result = IMG_ERROR_INVALID_PARAMETERS; 168 result = IMG_ERROR_INVALID_PARAMETERS;
@@ -178,29 +179,26 @@ static int32 hash_resize(struct hash *hash_arg,
178 result = IMG_ERROR_MALLOC_FAILED; 179 result = IMG_ERROR_MALLOC_FAILED;
179 return result; 180 return result;
180 } 181 }
181 if (new_bkt_table) {
182 uint32 idx;
183
184 for (idx = 0; idx < new_sz; idx++)
185 new_bkt_table[idx] = NULL;
186 182
187 result = hash_rehash(hash_arg->table, 183 for (idx = 0; idx < new_sz; idx++)
188 hash_arg->size, 184 new_bkt_table[idx] = NULL;
189 new_bkt_table,
190 new_sz);
191 185
192 if (result != IMG_SUCCESS) { 186 result = hash_rehash(hash_arg->table,
193 osa_free(new_bkt_table); 187 hash_arg->size,
194 new_bkt_table = NULL; 188 new_bkt_table,
195 result = IMG_ERROR_UNEXPECTED_STATE; 189 new_sz);
196 return result;
197 }
198 190
199 if (hash_arg->table) 191 if (result != IMG_SUCCESS) {
200 osa_free(hash_arg->table); 192 osa_free(new_bkt_table);
201 hash_arg->table = new_bkt_table; 193 new_bkt_table = NULL;
202 hash_arg->size = new_sz; 194 result = IMG_ERROR_UNEXPECTED_STATE;
195 return result;
203 } 196 }
197
198 if (hash_arg->table)
199 osa_free(hash_arg->table);
200 hash_arg->table = new_bkt_table;
201 hash_arg->size = new_sz;
204 } 202 }
205 result = IMG_SUCCESS; 203 result = IMG_SUCCESS;
206 204
diff --git a/driver/common/idgen_api.c b/driver/common/idgen_api.c
index 44b2595..2a4248f 100644
--- a/driver/common/idgen_api.c
+++ b/driver/common/idgen_api.c
@@ -98,7 +98,7 @@ int32 idgen_createcontext(uint32 maxid, uint32 blksize,
98 /* Initialise the hash table of lists of length ui32BlkSize */ 98 /* Initialise the hash table of lists of length ui32BlkSize */
99 idcontext->incidlist = osa_zalloc((sizeof(*idcontext->incidlist) * 99 idcontext->incidlist = osa_zalloc((sizeof(*idcontext->incidlist) *
100 idcontext->blksize), OSA_GFP_KERNEL); 100 idcontext->blksize), OSA_GFP_KERNEL);
101 if (!idcontext) { 101 if (!idcontext->incidlist) {
102 osa_free(idcontext); 102 osa_free(idcontext);
103 return IMG_ERROR_OUT_OF_MEMORY; 103 return IMG_ERROR_OUT_OF_MEMORY;
104 } 104 }
diff --git a/driver/common/img_mem_man.c b/driver/common/img_mem_man.c
index ff4b54d..699cc9d 100644
--- a/driver/common/img_mem_man.c
+++ b/driver/common/img_mem_man.c
@@ -57,8 +57,6 @@ struct mmu_page {
57 uint32 addr_shift; 57 uint32 addr_shift;
58}; 58};
59 59
60static int32 trace_physical_pages = 0;
61
62static void _img_mem_free(struct buffer *buffer); 60static void _img_mem_free(struct buffer *buffer);
63static void _img_mmu_unmap(struct mmu_ctx_mapping *mapping); 61static void _img_mmu_unmap(struct mmu_ctx_mapping *mapping);
64static void _img_mmu_ctx_destroy(struct mmu_ctx *ctx); 62static void _img_mmu_ctx_destroy(struct mmu_ctx *ctx);
@@ -697,10 +695,6 @@ static void mmu_page_write(struct mmu_page_cfg *page_cfg,
697 struct mmu_page *mmu_page; 695 struct mmu_page *mmu_page;
698 struct heap *heap; 696 struct heap *heap;
699 697
700 if (trace_physical_pages)
701 OSA_PR_DEBUG("%s: off %#x addr %#llx flags %#x\n",
702 __func__, offset, addr, flags);
703
704 mmu_page = osa_container_of(page_cfg, struct mmu_page, page_cfg); 698 mmu_page = osa_container_of(page_cfg, struct mmu_page, page_cfg);
705 heap = mmu_page->buffer->heap; 699 heap = mmu_page->buffer->heap;
706 700
@@ -717,9 +711,6 @@ static void mmu_update_page(struct mmu_page_cfg *arg)
717 struct mem_man *mem_man = &mem_man_data; 711 struct mem_man *mem_man = &mem_man_data;
718 struct mmu_page *page; 712 struct mmu_page *page;
719 713
720 if (trace_physical_pages)
721 OSA_PR_DEBUG("%s\n", __func__);
722
723 page = osa_container_of(arg, struct mmu_page, page_cfg); 714 page = osa_container_of(arg, struct mmu_page, page_cfg);
724 715
725 OSA_WARN_ON(!osa_mutex_is_locked(mem_man->mutex)); 716 OSA_WARN_ON(!osa_mutex_is_locked(mem_man->mutex));
diff --git a/driver/common/img_mem_unified.c b/driver/common/img_mem_unified.c
index f652547..56ac737 100644
--- a/driver/common/img_mem_unified.c
+++ b/driver/common/img_mem_unified.c
@@ -21,8 +21,6 @@
21#include "osal/inc/osa_define.h" 21#include "osal/inc/osa_define.h"
22#include "img_mem_man.h" 22#include "img_mem_man.h"
23 23
24static int32 trace_physical_pages = 0;
25
26static int32 unified_alloc(void *device, struct heap *heap, 24static int32 unified_alloc(void *device, struct heap *heap,
27 size_t size, enum mem_attr attr, 25 size_t size, enum mem_attr attr,
28 struct buffer *buffer) 26 struct buffer *buffer)
@@ -56,11 +54,6 @@ static int32 unified_alloc(void *device, struct heap *heap,
56 ret = -OSA_ENOMEM; 54 ret = -OSA_ENOMEM;
57 goto alloc_page_failed; 55 goto alloc_page_failed;
58 } 56 }
59 if (trace_physical_pages)
60 OSA_DEV_DBG(device, "%s:%d phys %#llx size %lu page_address %p\n",
61 __func__, __LINE__,
62 (uint64)osa_page_to_phys(page),
63 OSA_PAGE_SIZE, osa_page_address(page));
64 57
65 /* 58 /*
66 * dma_map_page() is probably going to fail if alloc flags are 59 * dma_map_page() is probably going to fail if alloc flags are
diff --git a/driver/common/resource.c b/driver/common/resource.c
index 37f4101..26bd373 100644
--- a/driver/common/resource.c
+++ b/driver/common/resource.c
@@ -44,12 +44,12 @@ int32 resource_item_use(uint32 *refcnt)
44/* 44/*
45 * returns an item by decrementing the reference count 45 * returns an item by decrementing the reference count
46 */ 46 */
47int32 resource_item_return(uint32 *refcnt) 47void resource_item_return(uint32 *refcnt)
48{ 48{
49 if (refcnt && *refcnt > 0) 49 if (refcnt && *refcnt > 0)
50 (*refcnt)--; 50 (*refcnt)--;
51 51
52 return 0; 52 return;
53} 53}
54 54
55/* 55/*
@@ -92,11 +92,7 @@ int32 resource_list_add(struct lst_t *list, void *item, uint32 id, uint32 *refcn
92 * Decrement the reference count on the item 92 * Decrement the reference count on the item
93 * to signal that the owner has relinquished it. 93 * to signal that the owner has relinquished it.
94 */ 94 */
95 result = resource_item_return(refcnt); 95 resource_item_return(refcnt);
96 if (result != 0) {
97 result = IMG_ERROR_UNEXPECTED_STATE;
98 goto error;
99 }
100 96
101 /* 97 /*
102 * Determine whether this buffer is already in the list. 98 * Determine whether this buffer is already in the list.
@@ -255,10 +251,11 @@ int32 resource_list_remove_nextavail(struct lst_t *list,
255 while (listelem) { 251 while (listelem) {
256 if (resource_item_isavailable(listelem->refcnt)) { 252 if (resource_item_isavailable(listelem->refcnt)) {
257 resource_item_return(listelem->refcnt); 253 resource_item_return(listelem->refcnt);
258 if (!listelem->refcnt || *listelem->refcnt == 0) { 254
255 if(*listelem->refcnt == 0) {
259 if (fn_freeitem) 256 if (fn_freeitem)
260 fn_freeitem(listelem->item, 257 fn_freeitem(listelem->item,
261 free_cb_param); 258 free_cb_param);
262 else 259 else
263 osa_free(listelem->item); 260 osa_free(listelem->item);
264 261
diff --git a/driver/common/resource.h b/driver/common/resource.h
index 8f31d57..540aeb4 100644
--- a/driver/common/resource.h
+++ b/driver/common/resource.h
@@ -22,7 +22,7 @@ typedef int32 (*resource_pfn_freeitem)(void *item, void *free_cb_param);
22 22
23int32 resource_item_use(uint32 *refcnt); 23int32 resource_item_use(uint32 *refcnt);
24 24
25int32 resource_item_return(uint32 *refcnt); 25void resource_item_return(uint32 *refcnt);
26 26
27int32 resource_item_release(uint32 *refcnt); 27int32 resource_item_release(uint32 *refcnt);
28 28
diff --git a/driver/common/rman_api.c b/driver/common/rman_api.c
index 2c97f65..922bf37 100644
--- a/driver/common/rman_api.c
+++ b/driver/common/rman_api.c
@@ -109,9 +109,6 @@ int32 rman_initialise(void)
109 { 109 {
110 return IMG_ERROR_OUT_OF_MEMORY; 110 return IMG_ERROR_OUT_OF_MEMORY;
111 } 111 }
112 IMG_DBG_ASSERT(ret == IMG_SUCCESS);
113 if (ret != IMG_SUCCESS)
114 return ret;
115 } 112 }
116 return IMG_SUCCESS; 113 return IMG_SUCCESS;
117} 114}
@@ -364,10 +361,6 @@ int32 rman_get_resource(uint32 res_id, uint32 type_id, void **param,
364 if (bucket_idx >= RMAN_CRESID_MAX_BUCKET_INDEX) 361 if (bucket_idx >= RMAN_CRESID_MAX_BUCKET_INDEX)
365 return IMG_ERROR_INVALID_ID; /* Happens when bucket_idx == 0 */ 362 return IMG_ERROR_INVALID_ID; /* Happens when bucket_idx == 0 */
366 363
367 IMG_DBG_ASSERT(int_res_id <= RMAN_CRESID_MAX_RES_ID);
368 if (int_res_id > RMAN_CRESID_MAX_RES_ID)
369 return IMG_ERROR_INVALID_ID;
370
371 IMG_DBG_ASSERT(bucket_array[bucket_idx]); 364 IMG_DBG_ASSERT(bucket_array[bucket_idx]);
372 if (!bucket_array[bucket_idx]) 365 if (!bucket_array[bucket_idx])
373 return IMG_ERROR_INVALID_ID; 366 return IMG_ERROR_INVALID_ID;
diff --git a/driver/common/talmmu_api.c b/driver/common/talmmu_api.c
index 22aaab0..c3156e8 100644
--- a/driver/common/talmmu_api.c
+++ b/driver/common/talmmu_api.c
@@ -529,7 +529,7 @@ int32 talmmu_get_heap_handle(uint32 hid,
529 * @Return IMG_SUCCESS or an error code 529 * @Return IMG_SUCCESS or an error code
530 * 530 *
531 */ 531 */
532int32 talmmu_devmem_heap_options(void *devmem_heap_hndl, 532void talmmu_devmem_heap_options(void *devmem_heap_hndl,
533 enum talmmu_heap_option_id heap_opt_id, 533 enum talmmu_heap_option_id heap_opt_id,
534 union talmmu_heap_options heap_options) 534 union talmmu_heap_options heap_options)
535{ 535{
@@ -543,7 +543,7 @@ int32 talmmu_devmem_heap_options(void *devmem_heap_hndl,
543 break; 543 break;
544 } 544 }
545 545
546 return IMG_SUCCESS; 546 return;
547} 547}
548 548
549/* 549/*
diff --git a/driver/common/talmmu_api.h b/driver/common/talmmu_api.h
index 76f9c91..abcd892 100644
--- a/driver/common/talmmu_api.h
+++ b/driver/common/talmmu_api.h
@@ -227,7 +227,7 @@ int32 talmmu_get_heap_handle(uint32 hid,
227 void *devmem_ctx_hndl, 227 void *devmem_ctx_hndl,
228 void **devmem_heap_hndl); 228 void **devmem_heap_hndl);
229int32 talmmu_devmem_heap_empty(void *devmem_heap_hndl); 229int32 talmmu_devmem_heap_empty(void *devmem_heap_hndl);
230int32 talmmu_devmem_heap_options(void *devmem_heap_hndl, 230void talmmu_devmem_heap_options(void *devmem_heap_hndl,
231 enum talmmu_heap_option_id heap_opt_id, 231 enum talmmu_heap_option_id heap_opt_id,
232 union talmmu_heap_options heap_options); 232 union talmmu_heap_options heap_options);
233int32 talmmu_devmem_addr_alloc(void *devmem_ctx_hndl, 233int32 talmmu_devmem_addr_alloc(void *devmem_ctx_hndl,
diff --git a/driver/decoder/bspp.c b/driver/decoder/bspp.c
index dce393f..9d15826 100644
--- a/driver/decoder/bspp.c
+++ b/driver/decoder/bspp.c
@@ -244,13 +244,13 @@ struct bspp_sequence_hdr_info *bspp_get_sequ_hdr(void *str_res_handle,
244 * @Function bspp_free_bitstream_elem 244 * @Function bspp_free_bitstream_elem
245 * @Description Frees a bitstream chain element. 245 * @Description Frees a bitstream chain element.
246 */ 246 */
247static int32 bspp_free_bitstream_elem(struct bspp_bitstream_buffer *bstr_buf) 247static void bspp_free_bitstream_elem(struct bspp_bitstream_buffer *bstr_buf)
248{ 248{
249 memset(bstr_buf, 0, sizeof(struct bspp_bitstream_buffer)); 249 memset(bstr_buf, 0, sizeof(struct bspp_bitstream_buffer));
250 250
251 osa_free(bstr_buf); 251 osa_free(bstr_buf);
252 252
253 return IMG_SUCCESS; 253 return;
254} 254}
255 255
256/* 256/*
@@ -400,9 +400,7 @@ static void bspp_shift_reg_cb(enum swsr_cbevent event,
400 grp_btsr_ctx->segment_offset = 0; 400 grp_btsr_ctx->segment_offset = 0;
401 401
402 /* Destroy the bitstream element. */ 402 /* Destroy the bitstream element. */
403 result = bspp_free_bitstream_elem(cur_buf); 403 bspp_free_bitstream_elem(cur_buf);
404 if (result != IMG_SUCCESS)
405 goto error;
406 } else { 404 } else {
407 goto error; 405 goto error;
408 } 406 }
@@ -1429,23 +1427,20 @@ error:
1429static int32 bspp_terminate_buffer(struct bspp_grp_bstr_ctx *grp_btsr_ctx, 1427static int32 bspp_terminate_buffer(struct bspp_grp_bstr_ctx *grp_btsr_ctx,
1430 struct bspp_bitstream_buffer *buf) 1428 struct bspp_bitstream_buffer *buf)
1431{ 1429{
1432 uint32 result; 1430 int32 result = -1;
1433 1431
1434 /* Indicate that all the data in buffer should be added to segment. */ 1432 /* Indicate that all the data in buffer should be added to segment. */
1435 buf->bytes_read = buf->data_size; 1433 buf->bytes_read = buf->data_size;
1436 1434
1437 result = bspp_create_segment(grp_btsr_ctx, buf); 1435 result = bspp_create_segment(grp_btsr_ctx, buf);
1438 if (result != IMG_SUCCESS) 1436 if (result != IMG_SUCCESS)
1439 goto error; 1437 return result;
1440 1438
1441 /* Next segment will start at the beginning of the next buffer. */ 1439 /* Next segment will start at the beginning of the next buffer. */
1442 grp_btsr_ctx->segment_offset = 0; 1440 grp_btsr_ctx->segment_offset = 0;
1443 1441
1444 result = bspp_free_bitstream_elem(buf); 1442 bspp_free_bitstream_elem(buf);
1445 if (result != IMG_SUCCESS)
1446 goto error;
1447 1443
1448error:
1449 return result; 1444 return result;
1450} 1445}
1451 1446
diff --git a/driver/decoder/core.c b/driver/decoder/core.c
index 8024428..29d1383 100644
--- a/driver/decoder/core.c
+++ b/driver/decoder/core.c
@@ -946,7 +946,7 @@ core_free_picture_resource(struct core_stream_context *core_strctx,
946 pict_resint); 946 pict_resint);
947 947
948#ifdef SEQ_RES_NEEDED 948#ifdef SEQ_RES_NEEDED
949 if (pict_resint && pict_resint->seq_resint) { 949 if (pict_resint->seq_resint) {
950 resource_item_return(&pict_resint->seq_resint->ref_count); 950 resource_item_return(&pict_resint->seq_resint->ref_count);
951 pict_resint->seq_resint = 0; 951 pict_resint->seq_resint = 0;
952 } 952 }
@@ -2462,11 +2462,11 @@ static int32 core_picture_prepare(struct core_stream_context *core_str_ctx,
2462 return IMG_SUCCESS; 2462 return IMG_SUCCESS;
2463 2463
2464unwind: 2464unwind:
2465 if (pict_local && pict_local->pict_res_int) { 2465 if (pict_local->pict_res_int) {
2466 resource_item_return(&pict_local->pict_res_int->ref_cnt); 2466 resource_item_return(&pict_local->pict_res_int->ref_cnt);
2467 pict_local->pict_res_int = NULL; 2467 pict_local->pict_res_int = NULL;
2468 } 2468 }
2469 if (pict_local && pict_local->disp_pict_buf.pict_buf) { 2469 if (pict_local->disp_pict_buf.pict_buf) {
2470 resource_item_return(&pict_local->disp_pict_buf.pict_buf->ddbuf_info.ref_count); 2470 resource_item_return(&pict_local->disp_pict_buf.pict_buf->ddbuf_info.ref_count);
2471 pict_local->disp_pict_buf.pict_buf = NULL; 2471 pict_local->disp_pict_buf.pict_buf = NULL;
2472 } 2472 }
@@ -3083,12 +3083,10 @@ int32 core_stream_map_buf_sg(uint32 res_str_id, enum vdec_buf_type buf_type,
3083 return IMG_SUCCESS; 3083 return IMG_SUCCESS;
3084 3084
3085error: 3085error:
3086 if (ddbuf_map_info) { 3086 if (ddbuf_map_info->res_handle)
3087 if (ddbuf_map_info->res_handle) 3087 rman_free_resource(ddbuf_map_info->res_handle);
3088 rman_free_resource(ddbuf_map_info->res_handle); 3088 else
3089 else 3089 osa_free(ddbuf_map_info);
3090 osa_free(ddbuf_map_info);
3091 }
3092 3090
3093 return ret; 3091 return ret;
3094} 3092}
diff --git a/driver/decoder/dec_resources.c b/driver/decoder/dec_resources.c
index 9a44331..b866ed3 100644
--- a/driver/decoder/dec_resources.c
+++ b/driver/decoder/dec_resources.c
@@ -85,7 +85,7 @@ static const uint8 start_code[] = {
85 0x00, 0x00, 0x01, 0x00, 85 0x00, 0x00, 0x01, 0x00,
86}; 86};
87 87
88static int32 decres_get_vlc_data(struct dec_vlctable *vlc_table, 88static void decres_get_vlc_data(struct dec_vlctable *vlc_table,
89 enum vdec_vid_std vid_std) 89 enum vdec_vid_std vid_std)
90{ 90{
91 switch (vid_std) { 91 switch (vid_std) {
@@ -100,7 +100,7 @@ static int32 decres_get_vlc_data(struct dec_vlctable *vlc_table,
100 memset(vlc_table, 0x0, sizeof(*vlc_table)); 100 memset(vlc_table, 0x0, sizeof(*vlc_table));
101 break; 101 break;
102 } 102 }
103 return IMG_SUCCESS; 103 return;
104} 104}
105 105
106static void decres_fnbuf_info_destructor(void *param, void *cb_handle) 106static void decres_fnbuf_info_destructor(void *param, void *cb_handle)
@@ -311,10 +311,7 @@ int32 dec_res_create(void *mmu_handle, struct vxd_coreprops *core_props,
311 311
312 /* Allocate standard-specific buffers. */ 312 /* Allocate standard-specific buffers. */
313 for (i = VDEC_STD_UNDEFINED + 1; i < VDEC_STD_MAX; i++) { 313 for (i = VDEC_STD_UNDEFINED + 1; i < VDEC_STD_MAX; i++) {
314 ret = decres_get_vlc_data(&vlc_table, (enum vdec_vid_std)i); 314 decres_get_vlc_data(&vlc_table, (enum vdec_vid_std)i);
315 VDEC_ASSERT(ret == IMG_SUCCESS);
316 if (ret != IMG_SUCCESS)
317 goto error;
318 315
319 if (vlc_table.num_tables > 0) { 316 if (vlc_table.num_tables > 0) {
320 /* 317 /*
diff --git a/driver/decoder/decoder.c b/driver/decoder/decoder.c
index afa34a1..80ed15f 100644
--- a/driver/decoder/decoder.c
+++ b/driver/decoder/decoder.c
@@ -878,12 +878,8 @@ int32 decoder_stream_destroy(void *dec_str_context, uint8 abort)
878 return -OSA_EINVAL; 878 return -OSA_EINVAL;
879 } 879 }
880 880
881 ret =
882 hwctrl_removefrom_piclist(dec_core_ctx_local->hw_ctx, 881 hwctrl_removefrom_piclist(dec_core_ctx_local->hw_ctx,
883 dec_str_unit_local->dec_pict); 882 dec_str_unit_local->dec_pict);
884 VDEC_ASSERT(ret == IMG_SUCCESS);
885 if (ret != IMG_SUCCESS)
886 return ret;
887 883
888 /* Free decoder picture */ 884 /* Free decoder picture */
889 osa_free(dec_str_unit_local->dec_pict->first_fld_fwmsg); 885 osa_free(dec_str_unit_local->dec_pict->first_fld_fwmsg);
@@ -1059,7 +1055,6 @@ decoder_stream_decode_resource_create(struct dec_str_ctx *dec_str_context)
1059 enum sys_emem_attrib mem_attribs; 1055 enum sys_emem_attrib mem_attribs;
1060 1056
1061 uint8 fw_ctx_buf = osa_false; 1057 uint8 fw_ctx_buf = osa_false;
1062 uint8 h264_sgmbuf = osa_false;
1063 1058
1064 /* Validate input arguments */ 1059 /* Validate input arguments */
1065 if((!dec_str_context) || (!dec_str_context->decctx) || (!dec_str_context->decctx->dev_cfg)) { 1060 if((!dec_str_context) || (!dec_str_context->decctx) || (!dec_str_context->decctx->dev_cfg)) {
@@ -1119,8 +1114,6 @@ decoder_stream_decode_resource_create(struct dec_str_ctx *dec_str_context)
1119 if (ret != IMG_SUCCESS) 1114 if (ret != IMG_SUCCESS)
1120 goto err_out_of_memory; 1115 goto err_out_of_memory;
1121 1116
1122 h264_sgmbuf = osa_true;
1123
1124 /* Clear the SGM data. */ 1117 /* Clear the SGM data. */
1125 memset(pict_dec_res->h264_sgm_buf.cpu_virt, 0, 1118 memset(pict_dec_res->h264_sgm_buf.cpu_virt, 0,
1126 pict_dec_res->h264_sgm_buf.buf_size); 1119 pict_dec_res->h264_sgm_buf.buf_size);
@@ -1148,10 +1141,6 @@ err_out_of_memory:
1148 mmu_free_mem(dec_str_context->mmu_str_handle, 1141 mmu_free_mem(dec_str_context->mmu_str_handle,
1149 &pict_dec_res->fw_ctx_buf); 1142 &pict_dec_res->fw_ctx_buf);
1150 1143
1151 if (h264_sgmbuf)
1152 mmu_free_mem(dec_str_context->mmu_str_handle,
1153 &pict_dec_res->h264_sgm_buf);
1154
1155 osa_free(pict_dec_res); 1144 osa_free(pict_dec_res);
1156 pict_dec_res = NULL; 1145 pict_dec_res = NULL;
1157 } 1146 }
@@ -1307,8 +1296,7 @@ int32 decoder_stream_create(void *dec_ctx_arg,
1307 1296
1308 /* Roll back in case of errors. */ 1297 /* Roll back in case of errors. */
1309error: 1298error:
1310 if (dec_str_ctx) 1299 decoder_stream_destroy((void *)dec_str_ctx, osa_false);
1311 decoder_stream_destroy((void *)dec_str_ctx, osa_false);
1312 1300
1313 return ret; 1301 return ret;
1314} 1302}
@@ -1967,7 +1955,7 @@ decoder_stream_flush_process_dpb_hevc(struct dec_str_ctx *decstr_ctx,
1967 continue; 1955 continue;
1968 } 1956 }
1969 1957
1970 if (display_pict && !display_pict->displayed) { 1958 if (!display_pict->displayed) {
1971 display_pict->displayed = osa_true; 1959 display_pict->displayed = osa_true;
1972 ++num_pics_displayed; 1960 ++num_pics_displayed;
1973 result = decoder_picture_display(decstr_ctx, str_pic_id, 1961 result = decoder_picture_display(decstr_ctx, str_pic_id,
@@ -2520,7 +2508,6 @@ static int32
2520decoder_stream_reference_resource_create(struct dec_str_ctx *dec_str_ctx) 2508decoder_stream_reference_resource_create(struct dec_str_ctx *dec_str_ctx)
2521{ 2509{
2522 struct dec_pictref_res *pict_ref_res; 2510 struct dec_pictref_res *pict_ref_res;
2523 uint8 fw_ctrlbuf_allocated = osa_false;
2524 int32 ret; 2511 int32 ret;
2525 uint32 mem_heap_id; 2512 uint32 mem_heap_id;
2526 enum sys_emem_attrib mem_attribs; 2513 enum sys_emem_attrib mem_attribs;
@@ -2557,8 +2544,6 @@ decoder_stream_reference_resource_create(struct dec_str_ctx *dec_str_ctx)
2557 if (ret != IMG_SUCCESS) 2544 if (ret != IMG_SUCCESS)
2558 goto err_out_of_memory; 2545 goto err_out_of_memory;
2559 2546
2560 fw_ctrlbuf_allocated = osa_true;
2561
2562 /* 2547 /*
2563 * Clear the context data in preparation for first time use by 2548 * Clear the context data in preparation for first time use by
2564 * the firmware. 2549 * the firmware.
@@ -2579,14 +2564,9 @@ decoder_stream_reference_resource_create(struct dec_str_ctx *dec_str_ctx)
2579 return IMG_SUCCESS; 2564 return IMG_SUCCESS;
2580 2565
2581err_out_of_memory: 2566err_out_of_memory:
2582 if (pict_ref_res) {
2583 if (fw_ctrlbuf_allocated)
2584 mmu_free_mem(dec_str_ctx->mmu_str_handle,
2585 &pict_ref_res->fw_ctrlbuf);
2586 2567
2587 osa_free(pict_ref_res); 2568 osa_free(pict_ref_res);
2588 pict_ref_res = NULL; 2569 pict_ref_res = NULL;
2589 }
2590 2570
2591 OSA_PR_ERR("[USERSID=0x%08X] Failed to allocate device memory for stream reference resources", 2571 OSA_PR_ERR("[USERSID=0x%08X] Failed to allocate device memory for stream reference resources",
2592 dec_str_ctx->config.user_str_id); 2572 dec_str_ctx->config.user_str_id);
@@ -2991,7 +2971,6 @@ decoder_check_support(void *dec_ctx_arg,
2991 core_props = &dec_core_ctx->core_props; 2971 core_props = &dec_core_ctx->core_props;
2992 VDEC_ASSERT(core_props); 2972 VDEC_ASSERT(core_props);
2993 2973
2994 if (str_cfg) {
2995 /* Check that the video standard is supported */ 2974 /* Check that the video standard is supported */
2996 switch (str_cfg->vid_std) { 2975 switch (str_cfg->vid_std) {
2997 case VDEC_STD_H264: 2976 case VDEC_STD_H264:
@@ -3053,7 +3032,6 @@ decoder_check_support(void *dec_ctx_arg,
3053 VDECDD_UNSUPPORTED_STRCONFIG_STD; 3032 VDECDD_UNSUPPORTED_STRCONFIG_STD;
3054 break; 3033 break;
3055 } 3034 }
3056 }
3057 3035
3058 if (str_op_cfg) { 3036 if (str_op_cfg) {
3059 /* 3037 /*
@@ -3113,11 +3091,10 @@ decoder_check_support(void *dec_ctx_arg,
3113 } 3091 }
3114 } 3092 }
3115 3093
3116 if (str_cfg && 3094 if (str_op_cfg->pixel_info.bitdepth_y >
3117 (str_op_cfg->pixel_info.bitdepth_y >
3118 core_props->vidstd_props[str_cfg->vid_std].max_luma_bitdepth || 3095 core_props->vidstd_props[str_cfg->vid_std].max_luma_bitdepth ||
3119 str_op_cfg->pixel_info.bitdepth_y < 8 || 3096 str_op_cfg->pixel_info.bitdepth_y < 8 ||
3120 str_op_cfg->pixel_info.bitdepth_y == 9)) { 3097 str_op_cfg->pixel_info.bitdepth_y == 9) {
3121 OSA_PR_WARN("[USERSID=0x%08X] UNSUPPORTED[HW]: DISPLAY PICTURE LUMA BIT DEPTH %d [RANGE: 8->%d for %s]", 3098 OSA_PR_WARN("[USERSID=0x%08X] UNSUPPORTED[HW]: DISPLAY PICTURE LUMA BIT DEPTH %d [RANGE: 8->%d for %s]",
3122 str_cfg->user_str_id, 3099 str_cfg->user_str_id,
3123 str_op_cfg->pixel_info.bitdepth_y, 3100 str_op_cfg->pixel_info.bitdepth_y,
@@ -4358,12 +4335,6 @@ int32 decoder_service_firmware_response(void *dec_str_ctx_arg, uint32 *msg,
4358 4335
4359 dec_strctx = decoder_stream_get_context(dec_str_ctx_arg); 4336 dec_strctx = decoder_stream_get_context(dec_str_ctx_arg);
4360 4337
4361 if(!dec_strctx) {
4362 OSA_PR_ERR("%s: dec_strctx is NULL\n", __func__);
4363 VDEC_ASSERT(0);
4364 return IMG_ERROR_INVALID_PARAMETERS;
4365 }
4366
4367 dec_core_ctx = decoder_str_ctx_to_core_ctx(dec_strctx); 4338 dec_core_ctx = decoder_str_ctx_to_core_ctx(dec_strctx);
4368 4339
4369 if(!dec_core_ctx) { 4340 if(!dec_core_ctx) {
@@ -4383,13 +4354,6 @@ int32 decoder_service_firmware_response(void *dec_str_ctx_arg, uint32 *msg,
4383 dec_pict->state != DECODER_PICTURE_STATE_TO_DISCARD)) 4354 dec_pict->state != DECODER_PICTURE_STATE_TO_DISCARD))
4384 return IMG_ERROR_UNEXPECTED_STATE; 4355 return IMG_ERROR_UNEXPECTED_STATE;
4385 4356
4386 /* Check input parameters. */
4387 VDEC_ASSERT(dec_core_ctx);
4388 if (!dec_core_ctx) {
4389 OSA_PR_ERR("Invalid parameters!");
4390 return IMG_ERROR_INVALID_PARAMETERS;
4391 }
4392
4393 /* 4357 /*
4394 * Try and locate the stream context in the list of active 4358 * Try and locate the stream context in the list of active
4395 * streams. 4359 * streams.
@@ -4420,11 +4384,7 @@ int32 decoder_service_firmware_response(void *dec_str_ctx_arg, uint32 *msg,
4420 * Retrieve the picture from the head of the core decode queue 4384 * Retrieve the picture from the head of the core decode queue
4421 * primarily to obtain the correct stream context. 4385 * primarily to obtain the correct stream context.
4422 */ 4386 */
4423 ret = hwctrl_removefrom_piclist(dec_core_ctx->hw_ctx, dec_pict); 4387 hwctrl_removefrom_piclist(dec_core_ctx->hw_ctx, dec_pict);
4424 VDEC_ASSERT(dec_pict);
4425 VDEC_ASSERT(ret == IMG_SUCCESS);
4426 if (ret != IMG_SUCCESS || !dec_pict)
4427 return IMG_ERROR_GENERIC_FAILURE;
4428 4388
4429 if(!dec_str_ctx) { 4389 if(!dec_str_ctx) {
4430 VDEC_ASSERT(0); 4390 VDEC_ASSERT(0);
diff --git a/driver/decoder/h264_secure_parser.c b/driver/decoder/h264_secure_parser.c
index 4544bb7..743c41b 100644
--- a/driver/decoder/h264_secure_parser.c
+++ b/driver/decoder/h264_secure_parser.c
@@ -188,12 +188,10 @@ static inline int32 smax(int32 a, int32 b)
188 188
189static void set_if_not_determined_yet(int32 *determined, uint8 condition, int32 *target, uint32 value) 189static void set_if_not_determined_yet(int32 *determined, uint8 condition, int32 *target, uint32 value)
190{ 190{
191 do { 191 if ((!(*determined)) && (condition)) {
192 if ((!(*determined)) && (condition)) { 192 *target = value;
193 *target = value; 193 *determined = 1;
194 *determined = 1; 194 }
195 }
196 } while (0);
197} 195}
198 196
199static int32 bspp_h264_get_subwidthc(int32 chroma_format_idc, 197static int32 bspp_h264_get_subwidthc(int32 chroma_format_idc,
@@ -1282,7 +1280,7 @@ static enum bspp_error_type bspp_h264_pict_hdr_parser(void *swsr_context, void *
1282 h264_slice_hdr_info->redundant_pic_cnt = swsr_read_unsigned_expgoulomb(swsr_context); 1280 h264_slice_hdr_info->redundant_pic_cnt = swsr_read_unsigned_expgoulomb(swsr_context);
1283 1281
1284 /* For FMO streams, we need to go further */ 1282 /* For FMO streams, we need to go further */
1285 if (h264_pps_info->num_slice_groups_minus1 > 0 && 1283 if (h264_pps_info->num_slice_groups_minus1 != 0 &&
1286 h264_pps_info->slice_group_map_type >= 3 && 1284 h264_pps_info->slice_group_map_type >= 3 &&
1287 h264_pps_info->slice_group_map_type <= 5) { 1285 h264_pps_info->slice_group_map_type <= 5) {
1288 if (h264_slice_hdr_info->slice_type == B_SLICE) 1286 if (h264_slice_hdr_info->slice_type == B_SLICE)
@@ -1402,8 +1400,7 @@ static enum bspp_error_type bspp_h264_pict_hdr_parser(void *swsr_context, void *
1402 } 1400 }
1403 } 1401 }
1404 1402
1405 if (h264_pps_info->num_slice_groups_minus1 > 0 && 1403 if (h264_pps_info->slice_group_map_type >= 3 &&
1406 h264_pps_info->slice_group_map_type >= 3 &&
1407 h264_pps_info->slice_group_map_type <= 5) { 1404 h264_pps_info->slice_group_map_type <= 5) {
1408 uint32 num_slice_group_map_units = 1405 uint32 num_slice_group_map_units =
1409 (h264_seq_hdr_info->sps_info.pic_height_in_map_units_minus1 + 1) * 1406 (h264_seq_hdr_info->sps_info.pic_height_in_map_units_minus1 + 1) *
@@ -2317,320 +2314,308 @@ static int32 bspp_h264_unit_parser(void *swsr_context, struct bspp_unit_data *un
2317 2314
2318 /* Default */ 2315 /* Default */
2319 unit_data->out.pict_hdr_info->discontinuous_mbs = 0; 2316 unit_data->out.pict_hdr_info->discontinuous_mbs = 0;
2320 do { 2317
2318 /*
2319 * Parse the Pic Header, return Parse SPS/PPS
2320 * structures
2321 */
2322 parse_error = bspp_h264_pict_hdr_parser(swsr_context,
2323 unit_data->str_res_handle,
2324 &h264_slice_hdr_info,
2325 &pps_info,
2326 &sequ_hdr_info,
2327 nal_unit_type,
2328 nal_ref_idc);
2329
2330 if (parse_error) {
2331 unit_data->parse_error |= parse_error;
2332 return IMG_ERROR_CANCELLED;
2333 }
2334
2335 /*
2336 * We are signalling closed GOP at every I frame
2337 * This does not conform 100% with the
2338 * specification but insures that seeking always
2339 * works.
2340 */
2341 unit_data->new_closed_gop = h264_slice_hdr_info.slice_type == I_SLICE ? 1 : 0;
2342
2343 /*
2344 * Now pps_info and sequ_hdr_info contain the
2345 * PPS/SPS info related to this picture
2346 */
2347 h264_pps_info = (struct bspp_h264_pps_info *)pps_info->secure_pps_info;
2348 h264_seq_hdr_info =
2349 (struct bspp_h264_seq_hdr_info *)sequ_hdr_info->secure_sequence_info;
2350
2351 tmp1 = &pps_info->fw_pps;
2352 tmp2 = &sequ_hdr_info->fw_sequence;
2353
2354 h264fw_pps_info =
2355 (struct h264fw_picture_ps *)((uint8 *)tmp1->ddbuf_info.cpu_virt_addr +
2356 tmp1->buf_offset);
2357 h264_fwseq_hdr_info =
2358 (struct h264fw_sequence_ps *)((uint8 *)tmp2->ddbuf_info.cpu_virt_addr +
2359 tmp2->buf_offset);
2360 VDEC_ASSERT(h264_slice_hdr_info.pps_id == h264_pps_info->pps_id);
2361 VDEC_ASSERT(h264_pps_info->seq_parameter_set_id ==
2362 (uint32)h264_seq_hdr_info->sps_info.seq_parameter_set_id);
2363
2364 /*
2365 * Update the decoding-related FW SPS info related to the current picture with the SEI
2366 * data that were potentially received and also relate to the current info. Until we
2367 * receive the picture we do not know which sequence to update with the SEI data. Set
2368 * from last SEI, needed for decoding
2369 */
2370 h264_fwseq_hdr_info->disable_vdmc_filt = interpicctx->disable_vdmc_filt;
2371 h264_fwseq_hdr_info->transform4x4_mb_not_available =
2372 interpicctx->b4x4transform_mb_unavailable;
2373
2374 /*
2375 * Determine if current slice is a new picture, and update the related params for future
2376 * reference
2377 * Order of checks is important
2378 */
2379 {
2380 struct bspp_parse_state *state = unit_data->parse_state;
2381
2382 set_if_not_determined_yet(&determined, state->new_view, &current_pic_is_new, 1);
2383 set_if_not_determined_yet(&determined, state->next_pic_is_new,
2384 &current_pic_is_new, 1);
2385 set_if_not_determined_yet(&determined,
2386 (h264_slice_hdr_info.redundant_pic_cnt > 0),
2387 &current_pic_is_new, 0);
2388 set_if_not_determined_yet(&determined,
2389 (state->prev_frame_num !=
2390 h264_slice_hdr_info.frame_num),
2391 &current_pic_is_new,
2392 1);
2393 set_if_not_determined_yet(&determined,
2394 (state->prev_pps_id != h264_slice_hdr_info.pps_id),
2395 &current_pic_is_new,
2396 1);
2397 set_if_not_determined_yet(&determined,
2398 (state->prev_field_pic_flag !=
2399 h264_slice_hdr_info.field_pic_flag),
2400 &current_pic_is_new,
2401 1);
2402 set_if_not_determined_yet(&determined,
2403 ((h264_slice_hdr_info.field_pic_flag) &&
2404 (state->prev_bottom_pic_flag !=
2405 h264_slice_hdr_info.bottom_field_flag)),
2406 &current_pic_is_new,
2407 1);
2408 set_if_not_determined_yet(&determined,
2409 ((state->prev_nal_ref_idc == 0 || nal_ref_idc == 0) &&
2410 (state->prev_nal_ref_idc != nal_ref_idc)),
2411 &current_pic_is_new,
2412 1);
2413 set_if_not_determined_yet(&determined,
2414 ((h264_seq_hdr_info->sps_info.pic_order_cnt_type ==
2415 0) &&
2416 ((state->prev_pic_order_cnt_lsb !=
2417 h264_slice_hdr_info.pic_order_cnt_lsb) ||
2418 (state->prev_delta_pic_order_cnt_bottom !=
2419 h264_slice_hdr_info.delta_pic_order_cnt_bottom))),
2420 &current_pic_is_new,
2421 1);
2422 set_if_not_determined_yet(&determined,
2423 ((h264_seq_hdr_info->sps_info.pic_order_cnt_type ==
2424 1) &&
2425 ((state->prev_delta_pic_order_cnt[0] !=
2426 h264_slice_hdr_info.delta_pic_order_cnt[0]) ||
2427 (state->prev_delta_pic_order_cnt[1] !=
2428 h264_slice_hdr_info.delta_pic_order_cnt[1]))),
2429 &current_pic_is_new,
2430 1);
2431 set_if_not_determined_yet(&determined,
2432 ((state->prev_nal_unit_type ==
2433 (int32)H264_NALTYPE_IDR_SLICE ||
2434 nal_unit_type == (int32)H264_NALTYPE_IDR_SLICE) &&
2435 (state->prev_nal_unit_type !=
2436 (int32)nal_unit_type)),
2437 &current_pic_is_new,
2438 1);
2439 set_if_not_determined_yet(&determined,
2440 ((state->prev_nal_unit_type ==
2441 (int32)H264_NALTYPE_IDR_SLICE) &&
2442 (state->prev_idr_pic_id !=
2443 h264_slice_hdr_info.idr_pic_id)),
2444 &current_pic_is_new,
2445 1);
2446
2321 /* 2447 /*
2322 * Parse the Pic Header, return Parse SPS/PPS 2448 * Update whatever is not updated already in different places of the code or
2323 * structures 2449 * just needs to be updated here
2324 */ 2450 */
2325 parse_error = bspp_h264_pict_hdr_parser(swsr_context, 2451 state->prev_frame_num = h264_slice_hdr_info.frame_num;
2326 unit_data->str_res_handle, 2452 state->prev_pps_id = h264_slice_hdr_info.pps_id;
2327 &h264_slice_hdr_info, 2453 state->prev_field_pic_flag =
2328 &pps_info, 2454 h264_slice_hdr_info.field_pic_flag;
2329 &sequ_hdr_info, 2455 state->prev_nal_ref_idc = nal_ref_idc;
2330 nal_unit_type, 2456 state->prev_pic_order_cnt_lsb =
2331 nal_ref_idc); 2457 h264_slice_hdr_info.pic_order_cnt_lsb;
2332 2458 state->prev_delta_pic_order_cnt_bottom =
2333 if (parse_error) { 2459 h264_slice_hdr_info.delta_pic_order_cnt_bottom;
2334 unit_data->parse_error |= parse_error; 2460 state->prev_delta_pic_order_cnt[0] =
2335 return IMG_ERROR_CANCELLED; 2461 h264_slice_hdr_info.delta_pic_order_cnt[0];
2462 state->prev_delta_pic_order_cnt[1] =
2463 h264_slice_hdr_info.delta_pic_order_cnt[1];
2464 state->prev_nal_unit_type = (int32)nal_unit_type;
2465 state->prev_idr_pic_id = h264_slice_hdr_info.idr_pic_id;
2466 }
2467
2468 /* Detect second field and manage the prev_bottom_pic_flag flag */
2469 if (h264_slice_hdr_info.field_pic_flag && current_pic_is_new) {
2470 unit_data->parse_state->prev_bottom_pic_flag =
2471 h264_slice_hdr_info.bottom_field_flag;
2472 }
2473
2474 /* Detect ASO Just met new pic */
2475 id = h264_slice_hdr_info.colour_plane_id;
2476 if (current_pic_is_new) {
2477 uint32 i;
2478
2479 for (i = 0; i < MAX_COMPONENTS; i++)
2480 unit_data->parse_state->prev_first_mb_in_slice[i] = 0;
2481 } else if (unit_data->parse_state->prev_first_mb_in_slice[id] >
2482 h264_slice_hdr_info.first_mb_in_slice) {
2483 /* We just found ASO */
2484 unit_data->parse_state->discontinuous_mb = 1;
2485 }
2486 unit_data->parse_state->prev_first_mb_in_slice[id] =
2487 h264_slice_hdr_info.first_mb_in_slice;
2488
2489 /* We may already knew we were DiscontinuousMB */
2490 if (unit_data->parse_state->discontinuous_mb)
2491 unit_data->out.pict_hdr_info->discontinuous_mbs =
2492 unit_data->parse_state->discontinuous_mb;
2493
2494 /*
2495 * We want to calculate the scaling lists only once per picture/field, not every slice
2496 * We want to populate the VDEC Picture Header Info only once per picture/field, not
2497 * every slice
2498 */
2499 if (current_pic_is_new) {
2500 /* Common Sequence Header Info fetched */
2501 struct vdec_comsequ_hdrinfo *comseq_hdr_info =
2502 &sequ_hdr_info->sequ_hdr_info.com_sequ_hdr_info;
2503 struct bspp_pict_data *type_pict_aux_data;
2504
2505 unit_data->parse_state->next_pic_is_new = 0;
2506
2507 /* Generate SGM for this picture */
2508 if (h264_pps_info->num_slice_groups_minus1 != 0 &&
2509 h264_pps_info->slice_group_map_type <= 6) {
2510 bspp_h264_unitparser_compile_sgmdata(&h264_slice_hdr_info,
2511 h264_seq_hdr_info,
2512 h264_pps_info,
2513 unit_data->out.pict_hdr_info);
2514 } else {
2515 unit_data->out.pict_hdr_info->pict_sgm_data.pic_data = NULL;
2516 unit_data->out.pict_hdr_info->pict_sgm_data.bufmap_id = 0;
2517 unit_data->out.pict_hdr_info->pict_sgm_data.buf_offset = 0;
2518 unit_data->out.pict_hdr_info->pict_sgm_data.id = BSPP_INVALID;
2519 unit_data->out.pict_hdr_info->pict_sgm_data.size = 0;
2336 } 2520 }
2337 2521
2338 /* 2522 unit_data->parse_state->discontinuous_mb =
2339 * We are signalling closed GOP at every I frame 2523 unit_data->out.pict_hdr_info->discontinuous_mbs;
2340 * This does not conform 100% with the
2341 * specification but insures that seeking always
2342 * works.
2343 */
2344 unit_data->new_closed_gop = h264_slice_hdr_info.slice_type == I_SLICE ? 1 : 0;
2345 2524
2346 /* 2525 /*
2347 * Now pps_info and sequ_hdr_info contain the 2526 * Select the scaling lists based on h264_pps_info and h264_seq_hdr_info and
2348 * PPS/SPS info related to this picture 2527 * pass them to h264fw_pps_info
2349 */ 2528 */
2350 h264_pps_info = (struct bspp_h264_pps_info *)pps_info->secure_pps_info; 2529 bspp_h264_select_scaling_list(h264fw_pps_info,
2351 h264_seq_hdr_info = 2530 h264_pps_info,
2352 (struct bspp_h264_seq_hdr_info *)sequ_hdr_info->secure_sequence_info; 2531 h264_seq_hdr_info);
2353
2354 tmp1 = &pps_info->fw_pps;
2355 tmp2 = &sequ_hdr_info->fw_sequence;
2356
2357 h264fw_pps_info =
2358 (struct h264fw_picture_ps *)((uint8 *)tmp1->ddbuf_info.cpu_virt_addr +
2359 tmp1->buf_offset);
2360 h264_fwseq_hdr_info =
2361 (struct h264fw_sequence_ps *)((uint8 *)tmp2->ddbuf_info.cpu_virt_addr +
2362 tmp2->buf_offset);
2363 VDEC_ASSERT(h264_slice_hdr_info.pps_id == h264_pps_info->pps_id);
2364 VDEC_ASSERT(h264_pps_info->seq_parameter_set_id ==
2365 (uint32)h264_seq_hdr_info->sps_info.seq_parameter_set_id);
2366 2532
2367 /* 2533 /*
2368 * Update the decoding-related FW SPS info related to the current picture with the SEI 2534 * Uses the common sequence/SINGLE-slice info to populate the
2369 * data that were potentially received and also relate to the current info. Until we 2535 * VDEC Picture Header Info
2370 * receive the picture we do not know which sequence to update with the SEI data. Set
2371 * from last SEI, needed for decoding
2372 */ 2536 */
2373 h264_fwseq_hdr_info->disable_vdmc_filt = interpicctx->disable_vdmc_filt; 2537 bspp_h264_pict_hdr_populate(nal_unit_type, &h264_slice_hdr_info,
2374 h264_fwseq_hdr_info->transform4x4_mb_not_available = 2538 comseq_hdr_info,
2375 interpicctx->b4x4transform_mb_unavailable; 2539 unit_data->out.pict_hdr_info);
2540
2541 /* Store some raw bitstream fields for output. */
2542 unit_data->out.pict_hdr_info->h264_pict_hdr_info.frame_num =
2543 h264_slice_hdr_info.frame_num;
2544 unit_data->out.pict_hdr_info->h264_pict_hdr_info.nal_ref_idc = nal_ref_idc;
2376 2545
2377 /* 2546 /*
2378 * Determine if current slice is a new picture, and update the related params for future 2547 * Update the display-related picture header information with the related
2379 * reference 2548 * SEI parsed data
2380 * Order of checks is important 2549 * The display-related SEI is used only for the first picture after the SEI
2381 */ 2550 */
2382 { 2551 if (!interpicctx->sei_info_attached_to_pic) {
2383 struct bspp_parse_state *state = unit_data->parse_state; 2552 interpicctx->sei_info_attached_to_pic = 1;
2384 2553 if (interpicctx->active_sps_for_sei_parsing !=
2385 set_if_not_determined_yet(&determined, state->new_view, &current_pic_is_new, 1); 2554 h264_seq_hdr_info->sps_info.seq_parameter_set_id) {
2386 set_if_not_determined_yet(&determined, state->next_pic_is_new, 2555 /*
2387 &current_pic_is_new, 1); 2556 * We tried to guess the SPS ID that we should use to parse the
2388 set_if_not_determined_yet(&determined, 2557 * SEI, but we guessed wrong
2389 (h264_slice_hdr_info.redundant_pic_cnt > 0), 2558 */
2390 &current_pic_is_new, 0); 2559 OSA_PR_ERR("Parsed SEI with wrong SPS, data may be parsed wrong");
2391 set_if_not_determined_yet(&determined,
2392 (state->prev_frame_num !=
2393 h264_slice_hdr_info.frame_num),
2394 &current_pic_is_new,
2395 1);
2396 set_if_not_determined_yet(&determined,
2397 (state->prev_pps_id != h264_slice_hdr_info.pps_id),
2398 &current_pic_is_new,
2399 1);
2400 set_if_not_determined_yet(&determined,
2401 (state->prev_field_pic_flag !=
2402 h264_slice_hdr_info.field_pic_flag),
2403 &current_pic_is_new,
2404 1);
2405 set_if_not_determined_yet(&determined,
2406 ((h264_slice_hdr_info.field_pic_flag) &&
2407 (state->prev_bottom_pic_flag !=
2408 h264_slice_hdr_info.bottom_field_flag)),
2409 &current_pic_is_new,
2410 1);
2411 set_if_not_determined_yet(&determined,
2412 ((state->prev_nal_ref_idc == 0 || nal_ref_idc == 0) &&
2413 (state->prev_nal_ref_idc != nal_ref_idc)),
2414 &current_pic_is_new,
2415 1);
2416 set_if_not_determined_yet(&determined,
2417 ((h264_seq_hdr_info->sps_info.pic_order_cnt_type ==
2418 0) &&
2419 ((state->prev_pic_order_cnt_lsb !=
2420 h264_slice_hdr_info.pic_order_cnt_lsb) ||
2421 (state->prev_delta_pic_order_cnt_bottom !=
2422 h264_slice_hdr_info.delta_pic_order_cnt_bottom))),
2423 &current_pic_is_new,
2424 1);
2425 set_if_not_determined_yet(&determined,
2426 ((h264_seq_hdr_info->sps_info.pic_order_cnt_type ==
2427 1) &&
2428 ((state->prev_delta_pic_order_cnt[0] !=
2429 h264_slice_hdr_info.delta_pic_order_cnt[0]) ||
2430 (state->prev_delta_pic_order_cnt[1] !=
2431 h264_slice_hdr_info.delta_pic_order_cnt[1]))),
2432 &current_pic_is_new,
2433 1);
2434 set_if_not_determined_yet(&determined,
2435 ((state->prev_nal_unit_type ==
2436 (int32)H264_NALTYPE_IDR_SLICE ||
2437 nal_unit_type == (int32)H264_NALTYPE_IDR_SLICE) &&
2438 (state->prev_nal_unit_type !=
2439 (int32)nal_unit_type)),
2440 &current_pic_is_new,
2441 1);
2442 set_if_not_determined_yet(&determined,
2443 ((state->prev_nal_unit_type ==
2444 (int32)H264_NALTYPE_IDR_SLICE) &&
2445 (state->prev_idr_pic_id !=
2446 h264_slice_hdr_info.idr_pic_id)),
2447 &current_pic_is_new,
2448 1);
2449
2450 /*
2451 * Update whatever is not updated already in different places of the code or
2452 * just needs to be updated here
2453 */
2454 state->prev_frame_num = h264_slice_hdr_info.frame_num;
2455 state->prev_pps_id = h264_slice_hdr_info.pps_id;
2456 state->prev_field_pic_flag =
2457 h264_slice_hdr_info.field_pic_flag;
2458 state->prev_nal_ref_idc = nal_ref_idc;
2459 state->prev_pic_order_cnt_lsb =
2460 h264_slice_hdr_info.pic_order_cnt_lsb;
2461 state->prev_delta_pic_order_cnt_bottom =
2462 h264_slice_hdr_info.delta_pic_order_cnt_bottom;
2463 state->prev_delta_pic_order_cnt[0] =
2464 h264_slice_hdr_info.delta_pic_order_cnt[0];
2465 state->prev_delta_pic_order_cnt[1] =
2466 h264_slice_hdr_info.delta_pic_order_cnt[1];
2467 state->prev_nal_unit_type = (int32)nal_unit_type;
2468 state->prev_idr_pic_id = h264_slice_hdr_info.idr_pic_id;
2469 }
2470
2471 /* Detect second field and manage the prev_bottom_pic_flag flag */
2472 if (h264_slice_hdr_info.field_pic_flag && current_pic_is_new) {
2473 unit_data->parse_state->prev_bottom_pic_flag = (uint8)BSPP_INVALID;
2474 /* Do not confuse 1st slice as new (second) field */
2475 if (unit_data->parse_state->prev_bottom_pic_flag !=
2476 (uint8)BSPP_INVALID) {
2477 /* We should have not flagged 2nd field already */
2478 VDEC_ASSERT(unit_data->parse_state->second_field_flag == 0);
2479 /* If 2 fields in same buffer, they should be a pair */
2480 VDEC_ASSERT(unit_data->parse_state->prev_bottom_pic_flag !=
2481 h264_slice_hdr_info.bottom_field_flag);
2482 unit_data->parse_state->second_field_flag = 1;
2483 } 2560 }
2484 unit_data->parse_state->prev_bottom_pic_flag = 2561 unit_data->out.pict_hdr_info->disp_info.repeat_first_fld =
2485 h264_slice_hdr_info.bottom_field_flag; 2562 interpicctx->repeat_first_field;
2563 unit_data->out.pict_hdr_info->disp_info.max_frm_repeat =
2564 interpicctx->max_frm_repeat;
2565 /* SEI - Not supported */
2486 } 2566 }
2487 2567
2488 /* Detect ASO Just met new pic */ 2568 /*
2489 id = h264_slice_hdr_info.colour_plane_id; 2569 * For Idr slices update the Active
2490 if (current_pic_is_new) { 2570 * Sequence ID for SEI parsing,
2491 uint32 i; 2571 * error resilient
2492 2572 */
2493 for (i = 0; i < MAX_COMPONENTS; i++) 2573 if (nal_unit_type == H264_NALTYPE_IDR_SLICE)
2494 unit_data->parse_state->prev_first_mb_in_slice[i] = 0; 2574 interpicctx->active_sps_for_sei_parsing =
2495 } else if (unit_data->parse_state->prev_first_mb_in_slice[id] > 2575 h264_seq_hdr_info->sps_info.seq_parameter_set_id;
2496 h264_slice_hdr_info.first_mb_in_slice) {
2497 /* We just found ASO */
2498 unit_data->parse_state->discontinuous_mb = 1;
2499 }
2500 unit_data->parse_state->prev_first_mb_in_slice[id] =
2501 h264_slice_hdr_info.first_mb_in_slice;
2502 2576
2503 /* We may already knew we were DiscontinuousMB */ 2577 /*
2504 if (unit_data->parse_state->discontinuous_mb) 2578 * Choose the appropriate auxiliary data
2505 unit_data->out.pict_hdr_info->discontinuous_mbs = 2579 * structure to populate.
2506 unit_data->parse_state->discontinuous_mb; 2580 */
2581 if (unit_data->parse_state->second_field_flag)
2582 type_pict_aux_data =
2583 &unit_data->out.pict_hdr_info->second_pict_aux_data;
2584
2585 else
2586 type_pict_aux_data = &unit_data->out.pict_hdr_info->pict_aux_data;
2507 2587
2508 /* 2588 /*
2509 * We want to calculate the scaling lists only once per picture/field, not every slice 2589 * We have no container for the PPS that
2510 * We want to populate the VDEC Picture Header Info only once per picture/field, not 2590 * passes down to the kernel, for this
2511 * every slice 2591 * reason the h264 secure parser needs
2592 * to populate that info into the
2593 * picture header (Second)PictAuxData.
2512 */ 2594 */
2513 if (current_pic_is_new) { 2595 type_pict_aux_data->bufmap_id = pps_info->bufmap_id;
2514 /* Common Sequence Header Info fetched */ 2596 type_pict_aux_data->buf_offset = pps_info->buf_offset;
2515 struct vdec_comsequ_hdrinfo *comseq_hdr_info = 2597 type_pict_aux_data->pic_data = (void *)h264fw_pps_info;
2516 &sequ_hdr_info->sequ_hdr_info.com_sequ_hdr_info; 2598 type_pict_aux_data->id = h264_pps_info->pps_id;
2517 struct bspp_pict_data *type_pict_aux_data; 2599 type_pict_aux_data->size = sizeof(struct h264fw_picture_ps);
2518
2519 unit_data->parse_state->next_pic_is_new = 0;
2520
2521 /* Generate SGM for this picture */
2522 if (h264_pps_info->num_slice_groups_minus1 > 0 &&
2523 h264_pps_info->slice_group_map_type <= 6) {
2524 bspp_h264_unitparser_compile_sgmdata(&h264_slice_hdr_info,
2525 h264_seq_hdr_info,
2526 h264_pps_info,
2527 unit_data->out.pict_hdr_info);
2528 } else {
2529 unit_data->out.pict_hdr_info->pict_sgm_data.pic_data = NULL;
2530 unit_data->out.pict_hdr_info->pict_sgm_data.bufmap_id = 0;
2531 unit_data->out.pict_hdr_info->pict_sgm_data.buf_offset = 0;
2532 unit_data->out.pict_hdr_info->pict_sgm_data.id = BSPP_INVALID;
2533 unit_data->out.pict_hdr_info->pict_sgm_data.size = 0;
2534 }
2535 2600
2536 unit_data->parse_state->discontinuous_mb = 2601 pps_info->ref_count++;
2537 unit_data->out.pict_hdr_info->discontinuous_mbs;
2538
2539 /*
2540 * Select the scaling lists based on h264_pps_info and h264_seq_hdr_info and
2541 * pass them to h264fw_pps_info
2542 */
2543 bspp_h264_select_scaling_list(h264fw_pps_info,
2544 h264_pps_info,
2545 h264_seq_hdr_info);
2546
2547 /*
2548 * Uses the common sequence/SINGLE-slice info to populate the
2549 * VDEC Picture Header Info
2550 */
2551 bspp_h264_pict_hdr_populate(nal_unit_type, &h264_slice_hdr_info,
2552 comseq_hdr_info,
2553 unit_data->out.pict_hdr_info);
2554
2555 /* Store some raw bitstream fields for output. */
2556 unit_data->out.pict_hdr_info->h264_pict_hdr_info.frame_num =
2557 h264_slice_hdr_info.frame_num;
2558 unit_data->out.pict_hdr_info->h264_pict_hdr_info.nal_ref_idc = nal_ref_idc;
2559
2560 /*
2561 * Update the display-related picture header information with the related
2562 * SEI parsed data
2563 * The display-related SEI is used only for the first picture after the SEI
2564 */
2565 if (!interpicctx->sei_info_attached_to_pic) {
2566 interpicctx->sei_info_attached_to_pic = 1;
2567 if (interpicctx->active_sps_for_sei_parsing !=
2568 h264_seq_hdr_info->sps_info.seq_parameter_set_id) {
2569 /*
2570 * We tried to guess the SPS ID that we should use to parse the
2571 * SEI, but we guessed wrong
2572 */
2573 OSA_PR_ERR("Parsed SEI with wrong SPS, data may be parsed wrong");
2574 }
2575 unit_data->out.pict_hdr_info->disp_info.repeat_first_fld =
2576 interpicctx->repeat_first_field;
2577 unit_data->out.pict_hdr_info->disp_info.max_frm_repeat =
2578 interpicctx->max_frm_repeat;
2579 /* SEI - Not supported */
2580 }
2581 2602
2582 /* 2603 /* This info comes from NAL directly */
2583 * For Idr slices update the Active 2604 unit_data->out.pict_hdr_info->ref = (nal_ref_idc == 0) ? 0 : 1;
2584 * Sequence ID for SEI parsing, 2605 }
2585 * error resilient 2606 if (nal_unit_type == H264_NALTYPE_IDR_SLICE)
2586 */ 2607 unit_data->new_closed_gop = 1;
2587 if (nal_unit_type == H264_NALTYPE_IDR_SLICE)
2588 interpicctx->active_sps_for_sei_parsing =
2589 h264_seq_hdr_info->sps_info.seq_parameter_set_id;
2590
2591 /*
2592 * Choose the appropriate auxiliary data
2593 * structure to populate.
2594 */
2595 if (unit_data->parse_state->second_field_flag)
2596 type_pict_aux_data =
2597 &unit_data->out.pict_hdr_info->second_pict_aux_data;
2598 2608
2599 else 2609 /* Return the SPS ID */
2600 type_pict_aux_data = &unit_data->out.pict_hdr_info->pict_aux_data; 2610 /*
2601 2611 * seq_parameter_set_id is always in range 0-31, so we can add offset indicating
2602 /* 2612 * subsequence header
2603 * We have no container for the PPS that 2613 */
2604 * passes down to the kernel, for this 2614 id_loc = h264_pps_info->seq_parameter_set_id;
2605 * reason the h264 secure parser needs 2615 unit_data->pict_sequ_hdr_id =
2606 * to populate that info into the 2616 (nal_unit_type == H264_NALTYPE_SLICE_SCALABLE ||
2607 * picture header (Second)PictAuxData. 2617 nal_unit_type == H264_NALTYPE_SLICE_IDR_SCALABLE) ? id_loc + 32 : id_loc;
2608 */
2609 type_pict_aux_data->bufmap_id = pps_info->bufmap_id;
2610 type_pict_aux_data->buf_offset = pps_info->buf_offset;
2611 type_pict_aux_data->pic_data = (void *)h264fw_pps_info;
2612 type_pict_aux_data->id = h264_pps_info->pps_id;
2613 type_pict_aux_data->size = sizeof(struct h264fw_picture_ps);
2614
2615 pps_info->ref_count++;
2616
2617 /* This info comes from NAL directly */
2618 unit_data->out.pict_hdr_info->ref = (nal_ref_idc == 0) ? 0 : 1;
2619 }
2620 if (nal_unit_type == H264_NALTYPE_IDR_SLICE)
2621 unit_data->new_closed_gop = 1;
2622 2618
2623 /* Return the SPS ID */
2624 /*
2625 * seq_parameter_set_id is always in range 0-31, so we can add offset indicating
2626 * subsequence header
2627 */
2628 id_loc = h264_pps_info->seq_parameter_set_id;
2629 unit_data->pict_sequ_hdr_id =
2630 (nal_unit_type == H264_NALTYPE_SLICE_SCALABLE ||
2631 nal_unit_type == H264_NALTYPE_SLICE_IDR_SCALABLE ||
2632 nal_unit_type == H264_NALTYPE_SUBSET_SPS) ? id_loc + 32 : id_loc;
2633 } while (0);
2634 } else if (nal_unit_type == H264_NALTYPE_SLICE_PARTITION_A || 2619 } else if (nal_unit_type == H264_NALTYPE_SLICE_PARTITION_A ||
2635 nal_unit_type == H264_NALTYPE_SLICE_PARTITION_B || 2620 nal_unit_type == H264_NALTYPE_SLICE_PARTITION_B ||
2636 nal_unit_type == H264_NALTYPE_SLICE_PARTITION_C) { 2621 nal_unit_type == H264_NALTYPE_SLICE_PARTITION_C) {
diff --git a/driver/decoder/hevc_secure_parser.c b/driver/decoder/hevc_secure_parser.c
index ef87acc..8573fa4 100644
--- a/driver/decoder/hevc_secure_parser.c
+++ b/driver/decoder/hevc_secure_parser.c
@@ -915,8 +915,10 @@ static enum bspp_error_type bspp_hevc_parsesps(void *sr_ctx,
915 uint8 i; 915 uint8 i;
916 uint32 min_cblog2_size_y; 916 uint32 min_cblog2_size_y;
917 917
918 VDEC_ASSERT(sr_ctx); 918 if(!sr_ctx || !sps) {
919 VDEC_ASSERT(sps); 919 VDEC_ASSERT(0);
920 return BSPP_ERROR_INVALID_VALUE;
921 }
920 922
921 memset(sps, 0, sizeof(struct bspp_hevc_sps)); 923 memset(sps, 0, sizeof(struct bspp_hevc_sps));
922 924
@@ -1167,11 +1169,9 @@ static enum bspp_error_type bspp_hevc_parsesps(void *sr_ctx,
1167 1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4); 1169 1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
1168 1170
1169 for (i = 0; i <= sps->sps_max_sub_layers_minus1; ++i) { 1171 for (i = 0; i <= sps->sps_max_sub_layers_minus1; ++i) {
1170 if (sps->sps_max_latency_increase_plus1) {
1171 sps->sps_max_latency_pictures[i] = 1172 sps->sps_max_latency_pictures[i] =
1172 sps->sps_max_num_reorder_pics[i] + 1173 sps->sps_max_num_reorder_pics[i] +
1173 sps->sps_max_latency_increase_plus1[i] - 1; 1174 sps->sps_max_latency_increase_plus1[i] - 1;
1174 }
1175 } 1175 }
1176 1176
1177 BSPP_HEVC_SYNTAX("ctb_size_y: %u", sps->ctb_size_y); 1177 BSPP_HEVC_SYNTAX("ctb_size_y: %u", sps->ctb_size_y);
diff --git a/driver/decoder/hw_control.c b/driver/decoder/hw_control.c
index c06fad0..d931bfc 100644
--- a/driver/decoder/hw_control.c
+++ b/driver/decoder/hw_control.c
@@ -933,46 +933,38 @@ int32 hwctrl_process_msg(void *hndl_hwctx, uint32 msg_flags, uint32 *msg,
933 933
934 val_first = pdecpict->first_fld_fwmsg->pict_attrs.pict_attrs.deverror; 934 val_first = pdecpict->first_fld_fwmsg->pict_attrs.pict_attrs.deverror;
935 val_sec = pdecpict->second_fld_fwmsg->pict_attrs.pict_attrs.deverror; 935 val_sec = pdecpict->second_fld_fwmsg->pict_attrs.pict_attrs.deverror;
936 if (pdecpict) {
937 if ((pdecpict->first_fld_fwmsg && val_first) ||
938 (pdecpict->second_fld_fwmsg && val_sec))
939 OSA_PR_ERR("device signaled critical error!!!\n");
940 936
941 if (msg_attr == VXD_MSG_ATTR_DECODED) { 937 if (val_first || val_sec)
942 pdecpict->state = DECODER_PICTURE_STATE_DECODED; 938 OSA_PR_ERR("device signaled critical error!!!\n");
943 /* 939
944 * We have successfully decoded a picture as normally or 940 if (msg_attr == VXD_MSG_ATTR_DECODED) {
945 * after the replay. 941 pdecpict->state = DECODER_PICTURE_STATE_DECODED;
946 * Mark HW is in good state. 942 /*
947 */ 943 * We have successfully decoded a picture as normally or
948 hwctx->is_fatal_state = 0; 944 * after the replay.
949 } else if (msg_attr == VXD_MSG_ATTR_FATAL) { 945 * Mark HW is in good state.
950 struct hwctrl_state state; 946 */
951 uint8 pipe_minus1 = 0; 947 hwctx->is_fatal_state = 0;
952 948 } else if (msg_attr == VXD_MSG_ATTR_FATAL) {
953 memset(&state, 0, sizeof(state)); 949 struct hwctrl_state state;
954 if (!(pdecpict->second_fld_fwmsg)) { 950 uint8 pipe_minus1 = 0;
955 OSA_PR_ERR("No pending picture found\n");
956 return IMG_ERROR_FATAL;
957 }
958 951
959 result = hwctrl_get_core_status(hwctx, &state); 952 memset(&state, 0, sizeof(state));
960 if (result == 0) { 953
961 hwctx->is_prev_hw_state_set = 1; 954 result = hwctrl_get_core_status(hwctx, &state);
962 memcpy(&hwctx->prev_state, &state, 955 if (result == 0) {
963 sizeof(struct hwctrl_state)); 956 hwctx->is_prev_hw_state_set = 1;
964 957 memcpy(&hwctx->prev_state, &state, sizeof(struct hwctrl_state));
965 for (pipe_minus1 = 0; 958
966 pipe_minus1 < hwctx->num_pipes; 959 for (pipe_minus1 = 0; pipe_minus1 < hwctx->num_pipes;
967 pipe_minus1++) { 960 pipe_minus1++) {
968 hwctrl_dump_state(&state.core_state, 961 hwctrl_dump_state(&state.core_state, &state.core_state,
969 &state.core_state, 962 pipe_minus1);
970 pipe_minus1);
971 }
972 } 963 }
973 } 964 }
974 *decpict = pdecpict;
975 } 965 }
966 *decpict = pdecpict;
967
976 return 0; 968 return 0;
977} 969}
978 970
@@ -994,12 +986,8 @@ int32 hwctrl_get_core_status(void *hndl_hwctx, struct hwctrl_state *state)
994 uint32 result = IMG_ERROR_GENERIC_FAILURE; 986 uint32 result = IMG_ERROR_GENERIC_FAILURE;
995 987
996 if (!hwctx->is_fatal_state && state) { 988 if (!hwctx->is_fatal_state && state) {
997 struct vxd_states corestate;
998 struct vxd_states *pcorestate = NULL; 989 struct vxd_states *pcorestate = NULL;
999 990
1000 if (!state)
1001 pcorestate = &corestate;
1002 else
1003 pcorestate = &state->core_state; 991 pcorestate = &state->core_state;
1004 992
1005 memset(pcorestate, 0, sizeof(*(pcorestate))); 993 memset(pcorestate, 0, sizeof(*(pcorestate)));
@@ -1090,7 +1078,7 @@ int32 hwctrl_getdecodedpicture(void *hndl_hwctx, struct dec_decpict **decpict)
1090 return IMG_ERROR_VALUE_OUT_OF_RANGE; 1078 return IMG_ERROR_VALUE_OUT_OF_RANGE;
1091} 1079}
1092 1080
1093int32 hwctrl_removefrom_piclist(void *hndl_hwctx, struct dec_decpict *decpict) 1081void hwctrl_removefrom_piclist(void *hndl_hwctx, struct dec_decpict *decpict)
1094{ 1082{
1095 struct hwctrl_ctx *hwctx = (struct hwctrl_ctx *)hndl_hwctx; 1083 struct hwctrl_ctx *hwctx = (struct hwctrl_ctx *)hndl_hwctx;
1096 1084
@@ -1110,7 +1098,7 @@ int32 hwctrl_removefrom_piclist(void *hndl_hwctx, struct dec_decpict *decpict)
1110 } 1098 }
1111 } 1099 }
1112 1100
1113 return 0; 1101 return;
1114} 1102}
1115 1103
1116int32 hwctrl_getregsoffset(void *hndl_hwctx, 1104int32 hwctrl_getregsoffset(void *hndl_hwctx,
@@ -1145,10 +1133,8 @@ static int32 pvdec_create(struct vxd_dev *vxd, struct vxd_coreprops *core_props,
1145 if (result != 0) 1133 if (result != 0)
1146 return result; 1134 return result;
1147 1135
1148 result = vxd_get_coreproperties(&hndl_core_props, &corectx->props); 1136 vxd_get_coreproperties(&hndl_core_props, &corectx->props);
1149 1137
1150 if (result != 0)
1151 return result;
1152 1138
1153 memcpy(core_props, &corectx->props, sizeof(*core_props)); 1139 memcpy(core_props, &corectx->props, sizeof(*core_props));
1154 1140
@@ -1205,10 +1191,7 @@ int32 hwctrl_initialise(void *dec_core, void *comp_int_userdata,
1205 1191
1206 return 0; 1192 return 0;
1207error: 1193error:
1208 if (hwctx->is_initialised) 1194 hwctrl_deinitialise(*hndl_hwctx);
1209 hwctrl_deinitialise(*hndl_hwctx);
1210 else
1211 osa_free(*hndl_hwctx);
1212 1195
1213 return result; 1196 return result;
1214} 1197}
diff --git a/driver/decoder/hw_control.h b/driver/decoder/hw_control.h
index 208126d..dfa754a 100644
--- a/driver/decoder/hw_control.h
+++ b/driver/decoder/hw_control.h
@@ -132,7 +132,7 @@ int32 hwctrl_peekheadpiclist(void *hndl_hwctx, struct dec_decpict **decpict);
132 132
133int32 hwctrl_getdecodedpicture(void *hndl_hwctx, struct dec_decpict **decpict); 133int32 hwctrl_getdecodedpicture(void *hndl_hwctx, struct dec_decpict **decpict);
134 134
135int32 hwctrl_removefrom_piclist(void *hndl_hwctx, struct dec_decpict *decpict); 135void hwctrl_removefrom_piclist(void *hndl_hwctx, struct dec_decpict *decpict);
136 136
137int32 hwctrl_getregsoffset(void *hndl_hwctx, 137int32 hwctrl_getregsoffset(void *hndl_hwctx,
138 struct decoder_regsoffsets *regs_offsets); 138 struct decoder_regsoffsets *regs_offsets);
diff --git a/driver/decoder/pixel_api.c b/driver/decoder/pixel_api.c
index cfca031..79b7454 100644
--- a/driver/decoder/pixel_api.c
+++ b/driver/decoder/pixel_api.c
@@ -676,7 +676,7 @@ enum img_pixfmt pixel_get_pixfmt(enum pixel_fmt_idc chroma_fmt_idc,
676 return fmt_found->pixfmt; 676 return fmt_found->pixfmt;
677} 677}
678 678
679static int32 pixel_get_internal_pixelinfo(struct pixel_pixinfo *pixinfo, 679static void pixel_get_internal_pixelinfo(struct pixel_pixinfo *pixinfo,
680 struct pixel_info *pix_bufinfo) 680 struct pixel_info *pix_bufinfo)
681{ 681{
682 if (pixinfo->bitdepth_y == 8 && pixinfo->bitdepth_c == 8) 682 if (pixinfo->bitdepth_y == 8 && pixinfo->bitdepth_c == 8)
@@ -735,11 +735,9 @@ static int32 pixel_get_internal_pixelinfo(struct pixel_pixinfo *pixinfo,
735 pix_bufinfo->uv_stride_ratio_times4 /= 2; 735 pix_bufinfo->uv_stride_ratio_times4 /= 2;
736 736
737 pix_bufinfo->has_alpha = osa_false; 737 pix_bufinfo->has_alpha = osa_false;
738
739 return IMG_SUCCESS;
740} 738}
741 739
742static int32 pixel_yuv_get_descriptor_int(struct pixel_info *pixinfo, 740static void pixel_yuv_get_descriptor_int(struct pixel_info *pixinfo,
743 struct img_pixfmt_desc *pix_desc) 741 struct img_pixfmt_desc *pix_desc)
744{ 742{
745 pix_desc->bop_denom = pixinfo->pixels_in_bop; 743 pix_desc->bop_denom = pixinfo->pixels_in_bop;
@@ -769,14 +767,13 @@ static int32 pixel_yuv_get_descriptor_int(struct pixel_info *pixinfo,
769 pix_desc->h_numer[3] = pix_desc->h_denom; 767 pix_desc->h_numer[3] = pix_desc->h_denom;
770 pix_desc->v_numer[3] = pix_desc->v_denom; 768 pix_desc->v_numer[3] = pix_desc->v_denom;
771 769
772 return IMG_SUCCESS; 770 return;
773} 771}
774 772
775int32 pixel_yuv_get_desc(struct pixel_pixinfo *pix_info, 773int32 pixel_yuv_get_desc(struct pixel_pixinfo *pix_info,
776 struct img_pixfmt_desc *pix_desc) 774 struct img_pixfmt_desc *pix_desc)
777{ 775{
778 struct pixel_info int_pix_info; 776 struct pixel_info int_pix_info;
779 uint32 ret;
780 777
781 struct pixel_info *int_pix_info_old = NULL; 778 struct pixel_info *int_pix_info_old = NULL;
782 enum img_pixfmt pix_fmt = pixel_get_pixfmt(pix_info->chroma_fmt_idc, 779 enum img_pixfmt pix_fmt = pixel_get_pixfmt(pix_info->chroma_fmt_idc,
@@ -790,10 +787,7 @@ int32 pixel_yuv_get_desc(struct pixel_pixinfo *pix_info,
790 if (pix_fmt != IMG_PIXFMT_UNDEFINED) 787 if (pix_fmt != IMG_PIXFMT_UNDEFINED)
791 int_pix_info_old = pixel_get_bufinfo_from_pixfmt(pix_fmt); 788 int_pix_info_old = pixel_get_bufinfo_from_pixfmt(pix_fmt);
792 789
793 ret = pixel_get_internal_pixelinfo(pix_info, &int_pix_info); 790 pixel_get_internal_pixelinfo(pix_info, &int_pix_info);
794 VDEC_ASSERT(ret == IMG_SUCCESS);
795 if (ret != IMG_SUCCESS)
796 return ret;
797 791
798 if (int_pix_info_old) { 792 if (int_pix_info_old) {
799 VDEC_ASSERT(int_pix_info_old->has_alpha == 793 VDEC_ASSERT(int_pix_info_old->has_alpha ==
@@ -816,10 +810,7 @@ int32 pixel_yuv_get_desc(struct pixel_pixinfo *pix_info,
816 int_pix_info.ybytes_in_bop); 810 int_pix_info.ybytes_in_bop);
817 } 811 }
818 812
819 ret = pixel_yuv_get_descriptor_int(&int_pix_info, pix_desc); 813 pixel_yuv_get_descriptor_int(&int_pix_info, pix_desc);
820 VDEC_ASSERT(ret == IMG_SUCCESS);
821 if (ret != IMG_SUCCESS)
822 return ret;
823 814
824 return IMG_SUCCESS; 815 return IMG_SUCCESS;
825} 816}
diff --git a/driver/decoder/swsr.c b/driver/decoder/swsr.c
index c5ffcd2..eb9db42 100644
--- a/driver/decoder/swsr.c
+++ b/driver/decoder/swsr.c
@@ -877,7 +877,6 @@ int32 swsr_get_total_bitsconsumed(void *ctx_hndl, uint64 *total_bitsconsumed)
877 return IMG_ERROR_NOT_INITIALISED; 877 return IMG_ERROR_NOT_INITIALISED;
878 } 878 }
879 879
880 if (total_bitsconsumed)
881 *total_bitsconsumed = ctx->output.totalbits_consumed; 880 *total_bitsconsumed = ctx->output.totalbits_consumed;
882 881
883 return 0; 882 return 0;
@@ -886,6 +885,7 @@ int32 swsr_get_total_bitsconsumed(void *ctx_hndl, uint64 *total_bitsconsumed)
886int32 swsr_get_byte_offset_curbuf(void *ctx_hndl, uint64 *byte_offset) 885int32 swsr_get_byte_offset_curbuf(void *ctx_hndl, uint64 *byte_offset)
887{ 886{
888 struct swsr_context *ctx = (struct swsr_context *)ctx_hndl; 887 struct swsr_context *ctx = (struct swsr_context *)ctx_hndl;
888 struct swsr_buffer *outbuf;
889 889
890 /* Validate input arguments. */ 890 /* Validate input arguments. */
891 if (!ctx || !byte_offset) { 891 if (!ctx || !byte_offset) {
@@ -904,15 +904,11 @@ int32 swsr_get_byte_offset_curbuf(void *ctx_hndl, uint64 *byte_offset)
904 return IMG_ERROR_OPERATION_PROHIBITED; 904 return IMG_ERROR_OPERATION_PROHIBITED;
905 } 905 }
906 906
907 if (byte_offset) { 907 outbuf = lst_first(&ctx->buffer_ctx.used_buffer_list);
908 struct swsr_buffer *outbuf; 908 if (outbuf)
909 909 *byte_offset = outbuf->num_bytes_read;
910 outbuf = lst_first(&ctx->buffer_ctx.used_buffer_list); 910 else
911 if (outbuf) 911 return IMG_ERROR_COULD_NOT_OBTAIN_RESOURCE;
912 *byte_offset = outbuf->num_bytes_read;
913 else
914 return IMG_ERROR_COULD_NOT_OBTAIN_RESOURCE;
915 }
916 912
917 return 0; 913 return 0;
918} 914}
@@ -1491,14 +1487,12 @@ int32 swsr_initialise(swsr_except_handler_fxn exception_handler_fxn,
1491 1487
1492 return 0; 1488 return 0;
1493error: 1489error:
1494 if (ctx) { 1490 buffer = lst_removehead(&ctx->buffer_ctx.free_buffer_list);
1491 while (buffer) {
1492 osa_free(buffer);
1495 buffer = lst_removehead(&ctx->buffer_ctx.free_buffer_list); 1493 buffer = lst_removehead(&ctx->buffer_ctx.free_buffer_list);
1496 while (buffer) {
1497 osa_free(buffer);
1498 buffer = lst_removehead(&ctx->buffer_ctx.free_buffer_list);
1499 }
1500 osa_free(ctx);
1501 } 1494 }
1495 osa_free(ctx);
1502 1496
1503 return result; 1497 return result;
1504} 1498}
diff --git a/driver/decoder/translation_api.c b/driver/decoder/translation_api.c
index 9b7bfcb..7c2b1a8 100644
--- a/driver/decoder/translation_api.c
+++ b/driver/decoder/translation_api.c
@@ -345,7 +345,7 @@ static uint32 translation_getctx_loadaddr(struct dec_decpict *psdecpict)
345 return 0; 345 return 0;
346} 346}
347 347
348static int32 translation_setup_std_header 348static void translation_setup_std_header
349 (struct vdec_str_configdata *str_configdata, 349 (struct vdec_str_configdata *str_configdata,
350 struct dec_decpict *dec_pict, 350 struct dec_decpict *dec_pict,
351 struct vdecdd_str_unit *str_unit, uint32 *psr_hdrsize, 351 struct vdecdd_str_unit *str_unit, uint32 *psr_hdrsize,
@@ -420,7 +420,7 @@ static int32 translation_setup_std_header
420 *psr_hdrsize = 0; 420 *psr_hdrsize = 0;
421 break; 421 break;
422 } 422 }
423 return IMG_SUCCESS; 423 return;
424} 424}
425 425
426#define VDEC_INITIAL_DEVA_DMA_CMD_SIZE 3 426#define VDEC_INITIAL_DEVA_DMA_CMD_SIZE 3
@@ -941,7 +941,7 @@ static void fill_rendec_chunk(int32 num, ...)
941 * Creates DEVA commands for configuring rendec and writes them into control 941 * Creates DEVA commands for configuring rendec and writes them into control
942 * allocation buffer. 942 * allocation buffer.
943 */ 943 */
944static int32 translation_pvdec_setup_commands 944static void translation_pvdec_setup_commands
945 (uint32 *pic_cmds, 945 (uint32 *pic_cmds,
946 uint32 **ctrl_allocbuf, uint32 ctrl_allocsize, 946 uint32 **ctrl_allocbuf, uint32 ctrl_allocsize,
947 uint32 vdmc_cmd_offset) 947 uint32 vdmc_cmd_offset)
@@ -1043,7 +1043,7 @@ static int32 translation_pvdec_setup_commands
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 return IMG_SUCCESS; 1046 return;
1047} 1047}
1048 1048
1049#ifdef HAS_HEVC 1049#ifdef HAS_HEVC
@@ -1420,11 +1420,9 @@ int32 translation_ctrl_alloc_prepare(struct vdec_str_configdata *pstr_config_dat
1420 if (result != IMG_SUCCESS) 1420 if (result != IMG_SUCCESS)
1421 return result; 1421 return result;
1422 1422
1423 result = translation_setup_std_header(pstr_config_data, dec_pict, 1423 translation_setup_std_header(pstr_config_data, dec_pict,
1424 str_unit, &hdr_size, picture, 1424 str_unit, &hdr_size, picture,
1425 pict_cmds, &parser_mode); 1425 pict_cmds, &parser_mode);
1426 if (result != IMG_SUCCESS)
1427 return result;
1428 1426
1429 buffers.recon_pict = dec_pict->recon_pict; 1427 buffers.recon_pict = dec_pict->recon_pict;
1430 buffers.alt_pict = dec_pict->alt_pict; 1428 buffers.alt_pict = dec_pict->alt_pict;
@@ -1467,11 +1465,9 @@ int32 translation_ctrl_alloc_prepare(struct vdec_str_configdata *pstr_config_dat
1467 * MSVDX_CMDS_ALTERNATIVE_OUTPUT_PICTURE_ROTATION, 1465 * MSVDX_CMDS_ALTERNATIVE_OUTPUT_PICTURE_ROTATION,
1468 * MSVDX_CMDS_CHROMA_ROW_STRIDE is the same for both MSVDX and PVDEC. 1466 * MSVDX_CMDS_CHROMA_ROW_STRIDE is the same for both MSVDX and PVDEC.
1469 */ 1467 */
1470 result = vxd_set_reconpictcmds(str_unit, pstr_config_data, 1468 vxd_set_reconpictcmds(str_unit, pstr_config_data,
1471 &picture->op_config, core_props, 1469 &picture->op_config, core_props,
1472 &buffers, pict_cmds); 1470 &buffers, pict_cmds);
1473 if (result != IMG_SUCCESS)
1474 return result;
1475 1471
1476 /* Alternative Picture Configuration */ 1472 /* Alternative Picture Configuration */
1477 if (dec_pict->alt_pict) { 1473 if (dec_pict->alt_pict) {
@@ -1491,11 +1487,9 @@ int32 translation_ctrl_alloc_prepare(struct vdec_str_configdata *pstr_config_dat
1491 * Configure second buffer for out-of-loop processing 1487 * Configure second buffer for out-of-loop processing
1492 * (e.g. scaling etc.). 1488 * (e.g. scaling etc.).
1493 */ 1489 */
1494 result = vxd_set_altpictcmds(str_unit, pstr_config_data, 1490 vxd_set_altpictcmds(str_unit, pstr_config_data,
1495 &picture->op_config, core_props, 1491 &picture->op_config, core_props,
1496 &buffers, pict_cmds); 1492 &buffers, pict_cmds);
1497 if (result != IMG_SUCCESS)
1498 return result;
1499 } 1493 }
1500 1494
1501 /* 1495 /*
@@ -1577,14 +1571,11 @@ int32 translation_ctrl_alloc_prepare(struct vdec_str_configdata *pstr_config_dat
1577 1571
1578 /* Setup commands for standards other than HEVC */ 1572 /* Setup commands for standards other than HEVC */
1579 if (pstr_config_data->vid_std != VDEC_STD_HEVC) { 1573 if (pstr_config_data->vid_std != VDEC_STD_HEVC) {
1580 result = translation_pvdec_setup_commands(pict_cmds, &cmd_buf, 1574 translation_pvdec_setup_commands(pict_cmds, &cmd_buf,
1581 (ctrl_alloc_end - 1575 (ctrl_alloc_end -
1582 (ulong)cmd_buf) / 1576 (ulong)cmd_buf) /
1583 sizeof(uint32), 1577 sizeof(uint32),
1584 regs_offset->vdmc_cmd_offset); 1578 regs_offset->vdmc_cmd_offset);
1585
1586 if (result != IMG_SUCCESS)
1587 return result;
1588 } 1579 }
1589 1580
1590 /* Setup commands for HEVC */ 1581 /* Setup commands for HEVC */
diff --git a/driver/decoder/vdec_mmu_wrapper.c b/driver/decoder/vdec_mmu_wrapper.c
index ac3bf48..8f4971d 100644
--- a/driver/decoder/vdec_mmu_wrapper.c
+++ b/driver/decoder/vdec_mmu_wrapper.c
@@ -132,7 +132,6 @@ static int32 mmu_devmem_context_create(struct mmu_dev_context *dev_ctx,
132 union talmmu_heap_options heap_opt1; 132 union talmmu_heap_options heap_opt1;
133 uint32 i; 133 uint32 i;
134 osa_bool use_guardband; 134 osa_bool use_guardband;
135 uint32 guardband_option;
136 enum talmmu_heap_option_id heap_option_id; 135 enum talmmu_heap_option_id heap_option_id;
137 136
138 dev_ctx->next_ctx_id++; 137 dev_ctx->next_ctx_id++;
@@ -155,14 +154,11 @@ static int32 mmu_devmem_context_create(struct mmu_dev_context *dev_ctx,
155 return result; 154 return result;
156 155
157 use_guardband = mmu_heaps[i].use_guard_band; 156 use_guardband = mmu_heaps[i].use_guard_band;
158 guardband_option = heap_opt1.guardband_opt.guardband;
159 heap_option_id = TALMMU_HEAP_OPT_ADD_GUARD_BAND; 157 heap_option_id = TALMMU_HEAP_OPT_ADD_GUARD_BAND;
160 if (use_guardband && guardband_option > 0) { 158 if (use_guardband) {
161 result = talmmu_devmem_heap_options(devmem_heap_hndl, 159 talmmu_devmem_heap_options(devmem_heap_hndl,
162 heap_option_id, 160 heap_option_id,
163 heap_opt1); 161 heap_opt1);
164 if (result != IMG_SUCCESS)
165 return result;
166 } 162 }
167 } 163 }
168 164
diff --git a/driver/decoder/vdecdd_utils_buf.c b/driver/decoder/vdecdd_utils_buf.c
index a428f21..433c886 100644
--- a/driver/decoder/vdecdd_utils_buf.c
+++ b/driver/decoder/vdecdd_utils_buf.c
@@ -283,7 +283,7 @@ vdecddutils_ref_pict_get_maxnum(const struct vdec_str_configdata *str_cfg_data,
283 return ret; 283 return ret;
284} 284}
285 285
286static int32 286static void
287vdecddutils_update_rend_pictsize(struct vdec_pict_size pict_size, 287vdecddutils_update_rend_pictsize(struct vdec_pict_size pict_size,
288 struct vdec_pict_size *rend_pict_size) 288 struct vdec_pict_size *rend_pict_size)
289{ 289{
@@ -306,7 +306,7 @@ vdecddutils_update_rend_pictsize(struct vdec_pict_size pict_size,
306 rend_pict_size->height; 306 rend_pict_size->height;
307 } 307 }
308 308
309 return IMG_SUCCESS; 309 return;
310} 310}
311 311
312int32 312int32
@@ -318,7 +318,6 @@ vdecddutils_convert_buffer_config(const struct vdec_str_configdata
318{ 318{
319 const struct pixel_pixinfo *pix_info; 319 const struct pixel_pixinfo *pix_info;
320 struct img_pixfmt_desc pixfmt; 320 struct img_pixfmt_desc pixfmt;
321 uint32 ret;
322 uint32 i; 321 uint32 i;
323 uint32 total_vert_samples = 0; 322 uint32 total_vert_samples = 0;
324 uint32 vert_samples[IMG_MAX_NUM_PLANES]; 323 uint32 vert_samples[IMG_MAX_NUM_PLANES];
@@ -428,11 +427,8 @@ vdecddutils_convert_buffer_config(const struct vdec_str_configdata
428 pict_size.height = 427 pict_size.height =
429 (vert_samples[i] * pixfmt.v_denom) / 428 (vert_samples[i] * pixfmt.v_denom) /
430 pixfmt.v_numer[i]; 429 pixfmt.v_numer[i];
431 ret = vdecddutils_update_rend_pictsize(pict_size, 430 vdecddutils_update_rend_pictsize(pict_size,
432 &pict_rend_info->rend_pict_size); 431 &pict_rend_info->rend_pict_size);
433 VDEC_ASSERT(ret == IMG_SUCCESS);
434 if (ret != IMG_SUCCESS)
435 return ret;
436 } 432 }
437 } 433 }
438 434
@@ -531,13 +527,13 @@ vdecddutils_get_minrequired_numpicts(const struct vdec_str_configdata
531 return IMG_SUCCESS; 527 return IMG_SUCCESS;
532} 528}
533 529
534static int32 530static void
535vdecddutils_get_codedsize(const struct vdec_pict_rend_config *pict_rend_cfg, 531vdecddutils_get_codedsize(const struct vdec_pict_rend_config *pict_rend_cfg,
536 struct vdec_pict_size *decoded_pict_size) 532 struct vdec_pict_size *decoded_pict_size)
537{ 533{
538 decoded_pict_size->width = pict_rend_cfg->coded_pict_size.width; 534 decoded_pict_size->width = pict_rend_cfg->coded_pict_size.width;
539 decoded_pict_size->height = pict_rend_cfg->coded_pict_size.height; 535 decoded_pict_size->height = pict_rend_cfg->coded_pict_size.height;
540 return IMG_SUCCESS; 536 return;
541} 537}
542 538
543static uint8 539static uint8
@@ -641,10 +637,7 @@ vdecddutils_get_render_info(const struct vdec_str_configdata *str_cfg_data,
641 pixel_get_fmt_desc(pix_info->pixfmt, &pixfmt); 637 pixel_get_fmt_desc(pix_info->pixfmt, &pixfmt);
642 638
643 /* Get the coded size for the appropriate orientation */ 639 /* Get the coded size for the appropriate orientation */
644 result = vdecddutils_get_codedsize(pict_rend_cfg, &coded_pict_size); 640 vdecddutils_get_codedsize(pict_rend_cfg, &coded_pict_size);
645 VDEC_ASSERT(result == IMG_SUCCESS);
646 if (result != IMG_SUCCESS)
647 return result;
648 641
649 /* 642 /*
650 * Calculate the hardware (inc. constraints) strides and 643 * Calculate the hardware (inc. constraints) strides and
@@ -677,14 +670,12 @@ vdecddutils_get_render_info(const struct vdec_str_configdata *str_cfg_data,
677 pict_rend_cfg, 670 pict_rend_cfg,
678 vert_sample[i], 671 vert_sample[i],
679 &h_stride, (enum vdec_color_planes)i); 672 &h_stride, (enum vdec_color_planes)i);
680 VDEC_ASSERT(result == IMG_SUCCESS ||
681 result == IMG_ERROR_NOT_SUPPORTED);
682 if (result != IMG_SUCCESS) { 673 if (result != IMG_SUCCESS) {
683 if (result == IMG_ERROR_NOT_SUPPORTED) 674 VDEC_ASSERT(0);
684 OSA_PR_ERR("No valid VXD stride found for picture with decoded dimensions [%d x %d] and min stride [%d]", 675 OSA_PR_ERR(
685 coded_pict_size.width, 676 "No valid VXD stride found for picture with decoded dimensions [%d x %d] and min stride [%d]",
686 coded_pict_size.height, 677 coded_pict_size.width, coded_pict_size.height,
687 h_stride); 678 h_stride);
688 return result; 679 return result;
689 } 680 }
690 681
@@ -772,11 +763,8 @@ vdecddutils_get_render_info(const struct vdec_str_configdata *str_cfg_data,
772 pict_size.height = (vert_sample[i] * pixfmt.v_denom) / 763 pict_size.height = (vert_sample[i] * pixfmt.v_denom) /
773 pixfmt.v_numer[i]; 764 pixfmt.v_numer[i];
774 765
775 result = vdecddutils_update_rend_pictsize(pict_size, 766 vdecddutils_update_rend_pictsize(pict_size,
776 &pict_rend_info->rend_pict_size); 767 &pict_rend_info->rend_pict_size);
777 VDEC_ASSERT(result == IMG_SUCCESS);
778 if (result != IMG_SUCCESS)
779 return result;
780 768
781 OSA_PR_INFO("vdecddutils_GetRenderInfo() plane %d stride %u size %u offset %u", 769 OSA_PR_INFO("vdecddutils_GetRenderInfo() plane %d stride %u size %u offset %u",
782 i, pict_rend_info->plane_info[i].stride, 770 i, pict_rend_info->plane_info[i].stride,
@@ -800,6 +788,7 @@ vdecddutils_pictbuf_getconfig(const struct vdec_str_configdata *str_cfg_data,
800 struct vdec_pict_rendinfo disp_pict_rendinfo; 788 struct vdec_pict_rendinfo disp_pict_rendinfo;
801 struct vdec_pict_size coded_pict_size; 789 struct vdec_pict_size coded_pict_size;
802 uint32 ret, i; 790 uint32 ret, i;
791 uint32 size0, size1;
803 792
804 /* Validate inputs. */ 793 /* Validate inputs. */
805 VDEC_ASSERT(str_cfg_data); 794 VDEC_ASSERT(str_cfg_data);
@@ -819,10 +808,7 @@ vdecddutils_pictbuf_getconfig(const struct vdec_str_configdata *str_cfg_data,
819 return ret; 808 return ret;
820 809
821 /* Get the coded size for the appropriate orientation */ 810 /* Get the coded size for the appropriate orientation */
822 ret = vdecddutils_get_codedsize(pict_rend_cfg, &coded_pict_size); 811 vdecddutils_get_codedsize(pict_rend_cfg, &coded_pict_size);
823 VDEC_ASSERT(ret == IMG_SUCCESS);
824 if (ret != IMG_SUCCESS)
825 return ret;
826 812
827 pict_bufcfg->coded_width = coded_pict_size.width; 813 pict_bufcfg->coded_width = coded_pict_size.width;
828 pict_bufcfg->coded_height = coded_pict_size.height; 814 pict_bufcfg->coded_height = coded_pict_size.height;
@@ -870,18 +856,16 @@ vdecddutils_pictbuf_getconfig(const struct vdec_str_configdata *str_cfg_data,
870 return IMG_ERROR_NOT_SUPPORTED; 856 return IMG_ERROR_NOT_SUPPORTED;
871 } 857 }
872 858
873 if (pict_rend_cfg->packed) { 859 size0 = OSA_ALIGN(pict_bufcfg->chroma_offset[0],
874 uint32 size0 = OSA_ALIGN(pict_bufcfg->chroma_offset[0], 860 VDEC_VXD_PICTBUF_ALIGNMENT, uint32);
875 VDEC_VXD_PICTBUF_ALIGNMENT, uint32); 861 size1 = OSA_ALIGN(pict_bufcfg->chroma_offset[1],
876 uint32 size1 = OSA_ALIGN(pict_bufcfg->chroma_offset[1], 862 VDEC_VXD_PICTBUF_ALIGNMENT, uint32);
877 VDEC_VXD_PICTBUF_ALIGNMENT, uint32); 863
878 864 if (pict_bufcfg->chroma_offset[0] != size0 ||
879 if (pict_bufcfg->chroma_offset[0] != size0 || 865 pict_bufcfg->chroma_offset[1] != size1) {
880 pict_bufcfg->chroma_offset[1] != size1) { 866 OSA_PR_ERR("Chroma plane could not be located on a %d byte boundary (investigate stride calculations)",
881 OSA_PR_ERR("Chroma plane could not be located on a %d byte boundary (investigate stride calculations)", 867 VDEC_VXD_PICTBUF_ALIGNMENT);
882 VDEC_VXD_PICTBUF_ALIGNMENT); 868 return IMG_ERROR_NOT_SUPPORTED;
883 return IMG_ERROR_NOT_SUPPORTED;
884 }
885 } 869 }
886 } else { 870 } else {
887 pict_bufcfg->packed = osa_false; 871 pict_bufcfg->packed = osa_false;
diff --git a/driver/decoder/vxd_core.c b/driver/decoder/vxd_core.c
index e6371f2..0a4b5b1 100644
--- a/driver/decoder/vxd_core.c
+++ b/driver/decoder/vxd_core.c
@@ -463,7 +463,7 @@ static int32 vxd_sched_single_locked(struct vxd_dev *vxd)
463 * enabled. 463 * enabled.
464 */ 464 */
465 vxd_monitor_locked(vxd); 465 vxd_monitor_locked(vxd);
466 } else if (ret != 0) { 466 } else {
467 OSA_DEV_ERR(vxd->dev, "%s: failed to check space for msg!\n", 467 OSA_DEV_ERR(vxd->dev, "%s: failed to check space for msg!\n",
468 __func__); 468 __func__);
469 } 469 }
@@ -1273,7 +1273,7 @@ static void vxd_fw_loaded(void *fw, void *context)
1273 struct vxd_fw_hdr *hdr; 1273 struct vxd_fw_hdr *hdr;
1274 void *buf_kptr; 1274 void *buf_kptr;
1275 int32 ret; 1275 int32 ret;
1276 size_t size; 1276 size_t size = 0;
1277 const uint8 *data = NULL; 1277 const uint8 *data = NULL;
1278 1278
1279 if(!fw) { 1279 if(!fw) {
@@ -1288,7 +1288,7 @@ static void vxd_fw_loaded(void *fw, void *context)
1288 OSA_DEV_INFO(vxd->dev, "FW: acquired %s size %zu\n", drv_fw_name, size); 1288 OSA_DEV_INFO(vxd->dev, "FW: acquired %s size %zu\n", drv_fw_name, size);
1289 1289
1290 /* Sanity verification of the firmware */ 1290 /* Sanity verification of the firmware */
1291 if (size < sizeof(struct vxd_fw_hdr) || !size) { 1291 if (size < sizeof(struct vxd_fw_hdr)) {
1292 OSA_DEV_ERR(vxd->dev, "%s: firmware file too small!\n", __func__); 1292 OSA_DEV_ERR(vxd->dev, "%s: firmware file too small!\n", __func__);
1293 goto out; 1293 goto out;
1294 } 1294 }
diff --git a/driver/decoder/vxd_int.c b/driver/decoder/vxd_int.c
index 144f190..df30903 100644
--- a/driver/decoder/vxd_int.c
+++ b/driver/decoder/vxd_int.c
@@ -489,7 +489,7 @@ static osa_bool vxd_is_supported_byatleast_onepipe(const uint8 *features,
489 return 0; 489 return 0;
490} 490}
491 491
492int32 vxd_set_reconpictcmds(const struct vdecdd_str_unit *str_unit, 492void vxd_set_reconpictcmds(const struct vdecdd_str_unit *str_unit,
493 const struct vdec_str_configdata *str_configdata, 493 const struct vdec_str_configdata *str_configdata,
494 const struct vdec_str_opconfig *output_config, 494 const struct vdec_str_opconfig *output_config,
495 const struct vxd_coreprops *coreprops, 495 const struct vxd_coreprops *coreprops,
@@ -793,10 +793,10 @@ int32 vxd_set_reconpictcmds(const struct vdecdd_str_unit *str_unit,
793 MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION, 793 MSVDX_CMDS, ALTERNATIVE_OUTPUT_PICTURE_ROTATION,
794 USE_AUX_LINE_BUF, benable_auxline_buf ? 1 : 0, uint32, int32); 794 USE_AUX_LINE_BUF, benable_auxline_buf ? 1 : 0, uint32, int32);
795 795
796 return 0; 796 return;
797} 797}
798 798
799int32 vxd_set_altpictcmds(const struct vdecdd_str_unit *str_unit, 799void vxd_set_altpictcmds(const struct vdecdd_str_unit *str_unit,
800 const struct vdec_str_configdata *str_configdata, 800 const struct vdec_str_configdata *str_configdata,
801 const struct vdec_str_opconfig *output_config, 801 const struct vdec_str_opconfig *output_config,
802 const struct vxd_coreprops *coreprops, 802 const struct vxd_coreprops *coreprops,
@@ -893,7 +893,7 @@ int32 vxd_set_altpictcmds(const struct vdecdd_str_unit *str_unit,
893 (uint32)GET_HOST_ADDR(&buffers->alt_pict->pict_buf->ddbuf_info) + 893 (uint32)GET_HOST_ADDR(&buffers->alt_pict->pict_buf->ddbuf_info) +
894 buffers->alt_pict->rend_info.plane_info[2].offset; 894 buffers->alt_pict->rend_info.plane_info[2].offset;
895 895
896 return 0; 896 return;
897} 897}
898 898
899int32 vxd_getscalercmds(const struct scaler_config *scaler_config, 899int32 vxd_getscalercmds(const struct scaler_config *scaler_config,
@@ -1059,7 +1059,7 @@ uint8 vxd_get_codedmode(enum vdec_vid_std vidstd)
1059 return (uint8)amsvdx_codecmode[vidstd]; 1059 return (uint8)amsvdx_codecmode[vidstd];
1060} 1060}
1061 1061
1062int32 vxd_get_coreproperties(void *hndl_coreproperties, 1062void vxd_get_coreproperties(void *hndl_coreproperties,
1063 struct vxd_coreprops *vxd_coreprops) 1063 struct vxd_coreprops *vxd_coreprops)
1064{ 1064{
1065 struct vxd_core_props *props = 1065 struct vxd_core_props *props =
@@ -1073,7 +1073,7 @@ int32 vxd_get_coreproperties(void *hndl_coreproperties,
1073 props->pixel_pipe_cfg, 1073 props->pixel_pipe_cfg,
1074 props->pixel_misc_cfg, 1074 props->pixel_misc_cfg,
1075 props->pixel_max_frame_cfg); 1075 props->pixel_max_frame_cfg);
1076 return 0; 1076 return;
1077} 1077}
1078 1078
1079int32 vxd_get_pictattrs(uint32 flags, struct vxd_pict_attrs *pict_attrs) 1079int32 vxd_get_pictattrs(uint32 flags, struct vxd_pict_attrs *pict_attrs)
diff --git a/driver/decoder/vxd_int.h b/driver/decoder/vxd_int.h
index d406c23..c6c6a6b 100644
--- a/driver/decoder/vxd_int.h
+++ b/driver/decoder/vxd_int.h
@@ -71,7 +71,7 @@ struct pvdec_core_rev {
71 * this has all that it needs to translate a Stream Unit for a picture 71 * this has all that it needs to translate a Stream Unit for a picture
72 * into a transaction. 72 * into a transaction.
73 */ 73 */
74int32 vxd_set_altpictcmds(const struct vdecdd_str_unit *str_unit, 74void vxd_set_altpictcmds(const struct vdecdd_str_unit *str_unit,
75 const struct vdec_str_configdata *str_configdata, 75 const struct vdec_str_configdata *str_configdata,
76 const struct vdec_str_opconfig *output_config, 76 const struct vdec_str_opconfig *output_config,
77 const struct vxd_coreprops *coreprops, 77 const struct vxd_coreprops *coreprops,
@@ -82,7 +82,7 @@ int32 vxd_set_altpictcmds(const struct vdecdd_str_unit *str_unit,
82 * this has all that it needs to translate a Stream Unit for 82 * this has all that it needs to translate a Stream Unit for
83 * a picture into a transaction. 83 * a picture into a transaction.
84 */ 84 */
85int32 vxd_set_reconpictcmds(const struct vdecdd_str_unit *str_unit, 85void vxd_set_reconpictcmds(const struct vdecdd_str_unit *str_unit,
86 const struct vdec_str_configdata *str_configdata, 86 const struct vdec_str_configdata *str_configdata,
87 const struct vdec_str_opconfig *output_config, 87 const struct vdec_str_opconfig *output_config,
88 const struct vxd_coreprops *coreprops, 88 const struct vxd_coreprops *coreprops,
@@ -109,7 +109,7 @@ uint8 vxd_get_codedmode(enum vdec_vid_std vidstd);
109/* 109/*
110 * translates core properties to the form of the struct vxd_coreprops struct. 110 * translates core properties to the form of the struct vxd_coreprops struct.
111 */ 111 */
112int32 vxd_get_coreproperties(void *hndl_coreproperties, 112void vxd_get_coreproperties(void *hndl_coreproperties,
113 struct vxd_coreprops *vxd_coreprops); 113 struct vxd_coreprops *vxd_coreprops);
114 114
115/* 115/*
diff --git a/osal/inc/osa_queue.h b/osal/inc/osa_queue.h
index be4ca8f..6f9a08e 100644
--- a/osal/inc/osa_queue.h
+++ b/osal/inc/osa_queue.h
@@ -145,7 +145,7 @@ typedef struct {
145 * 145 *
146 ******************************************************************************* 146 *******************************************************************************
147 */ 147 */
148int32 osa_utils_quecreate(osa_utils_quehandle *handle, 148void osa_utils_quecreate(osa_utils_quehandle *handle,
149 uint32 maxElements, void *queueMem, uint32 flags); 149 uint32 maxElements, void *queueMem, uint32 flags);
150 150
151/** 151/**
diff --git a/osal/inc/osa_time.h b/osal/inc/osa_time.h
index af72e5c..d74fddf 100644
--- a/osal/inc/osa_time.h
+++ b/osal/inc/osa_time.h
@@ -20,9 +20,9 @@
20 20
21#include "osa_types.h" 21#include "osa_types.h"
22 22
23#define osa_time_before(a, b) ((long)((a) - (b)) < 0) 23#define osa_time_before(a, b) ((int64)((a) - (b)) < 0)
24#define osa_time_is_before_eq_jiffies(a, b) ((long)((a) - (b)) >= 0) 24#define osa_time_is_before_eq_jiffies(a, b) ((int64)((a) - (b)) >= 0)
25#define osa_time_is_after_jiffies(a, b) ((long)((a) - (b)) < 0) 25#define osa_time_is_after_jiffies(a, b) ((int64)((a) - (b)) < 0)
26 26
27#if defined(OSAL_LINUX) 27#if defined(OSAL_LINUX)
28#include <linux/time.h> 28#include <linux/time.h>
diff --git a/osal/src/tirtos/osa_queue.c b/osal/src/tirtos/osa_queue.c
index 7173218..6596914 100644
--- a/osal/src/tirtos/osa_queue.c
+++ b/osal/src/tirtos/osa_queue.c
@@ -26,7 +26,7 @@
26 __LINE__, __FILE__);\ 26 __LINE__, __FILE__);\
27 while(1); }} 27 while(1); }}
28 28
29int32 osa_utils_quecreate(osa_utils_quehandle *handle, 29void osa_utils_quecreate(osa_utils_quehandle *handle,
30 uint32 maxElements, void *queueMem, uint32 flags) 30 uint32 maxElements, void *queueMem, uint32 flags)
31{ 31{
32 SemaphoreP_Params semParams; 32 SemaphoreP_Params semParams;
@@ -82,7 +82,7 @@ int32 osa_utils_quecreate(osa_utils_quehandle *handle,
82 handle->forceUnblockGet = (osa_bool)FALSE; 82 handle->forceUnblockGet = (osa_bool)FALSE;
83 handle->forceUnblockPut = (osa_bool)FALSE; 83 handle->forceUnblockPut = (osa_bool)FALSE;
84 84
85 return OSA_STATUS_SOK; 85 return;
86} 86}
87 87
88int32 osa_utils_quedelete(osa_utils_quehandle *handle) 88int32 osa_utils_quedelete(osa_utils_quehandle *handle)
diff --git a/timmlib/decoder/mm_dec_create.c b/timmlib/decoder/mm_dec_create.c
index 1158477..9547cf5 100644
--- a/timmlib/decoder/mm_dec_create.c
+++ b/timmlib/decoder/mm_dec_create.c
@@ -270,10 +270,6 @@ int32_t MM_DEC_BufPrepare(struct mm_buffer *buffer, uint32_t chId)
270 page[0].sgt = &sgt; 270 page[0].sgt = &sgt;
271 osa_sg_set_page(&sgl[0], &page[0], OSA_PAGE_SIZE, 0); 271 osa_sg_set_page(&sgl[0], &page[0], OSA_PAGE_SIZE, 0);
272 272
273 if (!&sgt) {
274 OSA_DEV_ERR(dev, "Could not get sg_table from plane 0\n");
275 return -OSA_EINVAL;
276 }
277 273
278 if (MM_TYPE_IS_OUTPUT(buf->buffer->type)) { 274 if (MM_TYPE_IS_OUTPUT(buf->buffer->type)) {
279 275
@@ -418,14 +414,10 @@ static int dec_create_stream_worker_task(struct vxd_dec_ctx *ctx, uint32 chId)
418 return OSA_STATUS_EFAIL; 414 return OSA_STATUS_EFAIL;
419 } 415 }
420 416
421 if(OSA_STATUS_SOK != osa_utils_quecreate(stream_work_queue->queue_handle, 417 osa_utils_quecreate(stream_work_queue->queue_handle,
422 WORK_MAX_QUEUE_ELEMENTS, 418 WORK_MAX_QUEUE_ELEMENTS,
423 stream_work_queue->queueMem, 419 stream_work_queue->queueMem,
424 OSA_UTILS_QUE_FLAG_BLOCK_QUE)) 420 OSA_UTILS_QUE_FLAG_BLOCK_QUE);
425 {
426 OSA_PR_ERR("%s: Failed to create Queue!", __func__);
427 return OSA_STATUS_EFAIL;
428 }
429 421
430 stream_work_queue->workq_sem_handle = osa_semaphore_create(osa_semaphore_mode_binary, 0); 422 stream_work_queue->workq_sem_handle = osa_semaphore_create(osa_semaphore_mode_binary, 0);
431 if(NULL == stream_work_queue->workq_sem_handle) 423 if(NULL == stream_work_queue->workq_sem_handle)
diff --git a/timmlib/decoder/mm_dec_init.c b/timmlib/decoder/mm_dec_init.c
index d8b5d1e..f493840 100644
--- a/timmlib/decoder/mm_dec_init.c
+++ b/timmlib/decoder/mm_dec_init.c
@@ -253,14 +253,10 @@ static int dec_create_vxd_worker_task(void)
253 return OSA_STATUS_EFAIL; 253 return OSA_STATUS_EFAIL;
254 } 254 }
255 255
256 if(OSA_STATUS_SOK != osa_utils_quecreate(vxd_work_queue->queue_handle, 256 osa_utils_quecreate(vxd_work_queue->queue_handle,
257 WORK_MAX_QUEUE_ELEMENTS, 257 WORK_MAX_QUEUE_ELEMENTS,
258 vxd_work_queue->queueMem, 258 vxd_work_queue->queueMem,
259 OSA_UTILS_QUE_FLAG_BLOCK_QUE)) 259 OSA_UTILS_QUE_FLAG_BLOCK_QUE);
260 {
261 OSA_PR_ERR("%s: Failed to create Queue!", __func__);
262 return OSA_STATUS_EFAIL;
263 }
264 260
265 vxd_work_queue->workq_sem_handle = osa_semaphore_create(osa_semaphore_mode_binary, 0); 261 vxd_work_queue->workq_sem_handle = osa_semaphore_create(osa_semaphore_mode_binary, 0);
266 if(NULL == vxd_work_queue->workq_sem_handle) 262 if(NULL == vxd_work_queue->workq_sem_handle)