@@ -132,6 +132,7 @@ static unsigned int debug;
132
132
/* MODULE_PARM_DESC(debug, "activates debug info"); */
133
133
134
134
#define DEF_FRAMERATE 30
135
+ static unsigned int mirror_value ;
135
136
136
137
static unsigned int vid_limit = 32 ;
137
138
module_param (vid_limit , uint , 0644 );
@@ -856,7 +857,7 @@ struct amlvideo2_node *node)
856
857
int src_top , src_left , src_width , src_height ;
857
858
int dst_top , dst_left , dst_width , dst_height ;
858
859
struct canvas_s cs0 , cs1 , cs2 , cd ;
859
- int current_mirror = 0 ;
860
+ int current_mirror ;
860
861
int cur_angle = 0 ;
861
862
int output_canvas = vf -> canvas0Addr ;
862
863
@@ -942,7 +943,7 @@ struct amlvideo2_node *node)
942
943
dst_width = output -> width ;
943
944
dst_height = output -> height ;
944
945
945
- current_mirror = 0 ;
946
+ current_mirror = mirror_value ;
946
947
cur_angle = output -> angle ;
947
948
if (current_mirror == 1 )
948
949
cur_angle = (360 - cur_angle % 360 );
@@ -1307,7 +1308,7 @@ struct amlvideo2_node *node)
1307
1308
dst_width = output -> width ;
1308
1309
dst_height = output -> height ;
1309
1310
1310
- current_mirror = 0 ;
1311
+ current_mirror = mirror_value ;
1311
1312
cur_angle = output -> angle ;
1312
1313
if (current_mirror == 1 )
1313
1314
cur_angle = (360 - cur_angle % 360 );
@@ -1600,7 +1601,7 @@ struct amlvideo2_node *node)
1600
1601
int src_top , src_left , src_width , src_height ;
1601
1602
int dst_top , dst_left , dst_width , dst_height ;
1602
1603
struct canvas_s cs0 , cs1 , cs2 , cd ;
1603
- int current_mirror = 0 ;
1604
+ int current_mirror ;
1604
1605
int cur_angle = 0 ;
1605
1606
int output_canvas = output -> canvas_id ;
1606
1607
@@ -1681,7 +1682,7 @@ struct amlvideo2_node *node)
1681
1682
dst_width = output -> width ;
1682
1683
dst_height = output -> height ;
1683
1684
1684
- current_mirror = 0 ;
1685
+ current_mirror = mirror_value ;
1685
1686
cur_angle = output -> angle ;
1686
1687
if (current_mirror == 1 )
1687
1688
cur_angle = (360 - cur_angle % 360 );
@@ -2001,7 +2002,7 @@ struct amlvideo2_node *node)
2001
2002
int src_top , src_left , src_width , src_height ;
2002
2003
int dst_top , dst_left , dst_width , dst_height ;
2003
2004
struct canvas_s cs0 , cs1 , cs2 , cd ;
2004
- int current_mirror = 0 ;
2005
+ int current_mirror ;
2005
2006
int cur_angle = 0 ;
2006
2007
int output_canvas = output -> canvas_id ;
2007
2008
@@ -2083,7 +2084,7 @@ struct amlvideo2_node *node)
2083
2084
dst_width = output -> width ;
2084
2085
dst_height = output -> height ;
2085
2086
2086
- current_mirror = 0 ;
2087
+ current_mirror = mirror_value ;
2087
2088
cur_angle = output -> angle ;
2088
2089
if (current_mirror == 1 )
2089
2090
cur_angle = (360 - cur_angle % 360 );
@@ -2401,7 +2402,7 @@ struct amlvideo2_node *node)
2401
2402
int src_top , src_left , src_width , src_height ;
2402
2403
int dst_top , dst_left , dst_width , dst_height ;
2403
2404
struct canvas_s cs0 , cs1 , cs2 , cd ;
2404
- int current_mirror = 0 ;
2405
+ int current_mirror ;
2405
2406
int cur_angle = 0 ;
2406
2407
int output_canvas = output -> canvas_id ;
2407
2408
@@ -2483,7 +2484,7 @@ struct amlvideo2_node *node)
2483
2484
dst_width = output -> width ;
2484
2485
dst_height = output -> height ;
2485
2486
2486
- current_mirror = 0 ;
2487
+ current_mirror = mirror_value ;
2487
2488
cur_angle = output -> angle ;
2488
2489
if (current_mirror == 1 )
2489
2490
cur_angle = (360 - cur_angle % 360 );
@@ -2802,7 +2803,7 @@ int amlvideo2_ge2d_multi_pre_process(struct vframe_s *vf,
2802
2803
int src_top , src_left , src_width , src_height ;
2803
2804
int dst_top , dst_left , dst_width , dst_height ;
2804
2805
struct canvas_s cs0 , cs1 , cs2 , cd ;
2805
- int current_mirror = 0 ;
2806
+ int current_mirror ;
2806
2807
int cur_angle = 0 ;
2807
2808
int output_canvas = output -> canvas_id ;
2808
2809
int temp_canvas = AMLVIDEO2_1_RES_CANVAS + 8 ;
@@ -2851,7 +2852,7 @@ int amlvideo2_ge2d_multi_pre_process(struct vframe_s *vf,
2851
2852
dst_width = output -> width ;
2852
2853
dst_height = output -> height ;
2853
2854
2854
- current_mirror = 0 ;
2855
+ current_mirror = mirror_value ;
2855
2856
cur_angle = 0 ;
2856
2857
2857
2858
@@ -3010,7 +3011,7 @@ int amlvideo2_ge2d_pre_process(struct vframe_s *vf,
3010
3011
int src_top , src_left , src_width , src_height ;
3011
3012
int dst_top , dst_left , dst_width , dst_height ;
3012
3013
struct canvas_s cs0 , cs1 , cs2 , cd ;
3013
- int current_mirror = 0 ;
3014
+ int current_mirror ;
3014
3015
int cur_angle = 0 ;
3015
3016
int output_canvas = output -> canvas_id ;
3016
3017
@@ -3091,7 +3092,7 @@ int amlvideo2_ge2d_pre_process(struct vframe_s *vf,
3091
3092
dst_width = output -> width ;
3092
3093
dst_height = output -> height ;
3093
3094
3094
- current_mirror = 0 ;
3095
+ current_mirror = mirror_value ;
3095
3096
cur_angle = output -> angle ;
3096
3097
if (current_mirror == 1 )
3097
3098
cur_angle = (360 - cur_angle % 360 );
@@ -3400,11 +3401,6 @@ int amlvideo2_ge2d_pre_process(struct vframe_s *vf,
3400
3401
return output_canvas ;
3401
3402
}
3402
3403
3403
- int amlvideo2_sw_post_process (int canvas , void * addr )
3404
- {
3405
- return 0 ;
3406
- }
3407
-
3408
3404
static int amlvideo2_fillbuff (struct amlvideo2_fh * fh ,
3409
3405
struct amlvideo2_node_buffer * buf ,
3410
3406
struct vframe_s * vf )
@@ -3414,9 +3410,7 @@ static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
3414
3410
struct amlvideo2_node * node = fh -> node ;
3415
3411
void * vbuf = NULL ;
3416
3412
int src_canvas = -1 ;
3417
- int magic = 0 ;
3418
3413
int ge2d_proc = 0 ;
3419
- int sw_proc = 0 ;
3420
3414
3421
3415
vbuf = (void * )videobuf_to_res (& buf -> vb );
3422
3416
@@ -3438,43 +3432,12 @@ static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
3438
3432
memcpy (& output .info .display_info , & (node -> display_info ),
3439
3433
sizeof (struct vdisplay_info_s ));
3440
3434
3441
- magic = MAGIC_RE_MEM ;
3442
- switch (magic ) {
3443
- case MAGIC_RE_MEM :
3444
- /* #if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 */
3445
- #if 1
3446
- if (output .canvas_id == 0 ) {
3447
- output .canvas_id = get_amlvideo2_canvas_index (
3435
+ if (output .canvas_id == 0 ) {
3436
+ output .canvas_id = get_amlvideo2_canvas_index (
3448
3437
& output , (node -> vid == 0 ) ?
3449
3438
(AMLVIDEO2_RES0_CANVAS_INDEX + buf -> vb .i * 3 ) :
3450
3439
(AMLVIDEO2_RES1_CANVAS_INDEX + buf -> vb .i * 3 ));
3451
- buf -> canvas_id = output .canvas_id ;
3452
- }
3453
- #else
3454
- #ifdef MULTI_NODE
3455
- output .canvas_id =
3456
- get_amlvideo2_canvas_index (
3457
- & output , (node -> vid == 0 )
3458
- ? AMLVIDEO2_RES0_CANVAS_INDEX
3459
- : AMLVIDEO2_RES1_CANVAS_INDEX );
3460
- #else
3461
- output .canvas_id =
3462
- get_amlvideo2_canvas_index (
3463
- & output , AMLVIDEO2_RES0_CANVAS_INDEX );
3464
- #endif
3465
- #endif
3466
- break ;
3467
- case MAGIC_VMAL_MEM :
3468
- /* canvas_index =
3469
- * get_amlvideo2_canvas_index(
3470
- * v4l2_format,&depth);
3471
- */
3472
- /* sw_proc = 1; */
3473
- /* break; */
3474
- case MAGIC_DC_MEM :
3475
- case MAGIC_SG_MEM :
3476
- default :
3477
- return -1 ;
3440
+ buf -> canvas_id = output .canvas_id ;
3478
3441
}
3479
3442
3480
3443
switch (output .v4l2_format ) {
@@ -3534,9 +3497,6 @@ static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
3534
3497
}
3535
3498
}
3536
3499
3537
- if ((sw_proc ) && (src_canvas > 0 ))
3538
- amlvideo2_sw_post_process (src_canvas , vbuf );
3539
-
3540
3500
buf -> vb .state = VIDEOBUF_DONE ;
3541
3501
/* do_gettimeofday(&buf->vb.ts); */
3542
3502
return 0 ;
@@ -4184,10 +4144,9 @@ enum aml_provider_type_e get_provider_type(const char *name)
4184
4144
return type ;
4185
4145
}
4186
4146
4187
- enum aml_provider_type_e get_sub_receiver_type (const char * name )
4147
+ enum aml_receiver_type_e get_sub_receiver_type (const char * name )
4188
4148
{
4189
- enum aml_provider_type_e type = AML_RECEIVER_NONE ;
4190
-
4149
+ enum aml_receiver_type_e type = AML_RECEIVER_NONE ;
4191
4150
if (!name )
4192
4151
return type ;
4193
4152
if (strncasecmp (name , "ppmgr" , 5 ) == 0 ) {
@@ -4855,6 +4814,7 @@ int amlvideo2_notify_callback(struct notifier_block *block, unsigned long cmd,
4855
4814
int i ;
4856
4815
int index = 0 ;
4857
4816
int ret = 0 ;
4817
+ int i_ret = 0 ;
4858
4818
4859
4819
for (i = 0 ; i < AMLVIDEO2_MAX_NODE ; i ++ ) {
4860
4820
if ((gAmlvideo2_Node [i ] != NULL ) &&
@@ -4869,23 +4829,27 @@ int amlvideo2_notify_callback(struct notifier_block *block, unsigned long cmd,
4869
4829
return ret ;
4870
4830
4871
4831
node = gAmlvideo2_Node [index ];
4872
- if ((node != NULL ) && (!node -> users ))
4832
+ if (node == NULL )
4833
+ return ret ;
4834
+ if (!(node -> users ))
4873
4835
return ret ;
4874
4836
4875
4837
mutex_lock (& node -> mutex );
4876
4838
switch (cmd ) {
4877
4839
case VOUT_EVENT_MODE_CHANGE :
4878
4840
pr_info ("mode changed in amlvideo2 .\n" );
4879
4841
vfp = vf_get_provider (node -> recv .name );
4880
- if ((node == NULL ) || ( vfp == NULL ) ||
4842
+ if ((vfp == NULL ) ||
4881
4843
(!node -> fh -> is_streamed_on )) {
4882
4844
pr_info ("driver is not ready or not need to screencap.\n" );
4883
4845
mutex_unlock (& node -> mutex );
4884
4846
return ret ;
4885
4847
}
4886
4848
node -> pflag = true;
4887
- wait_for_completion_timeout (& node -> plug_sema ,
4849
+ i_ret = wait_for_completion_timeout (& node -> plug_sema ,
4888
4850
msecs_to_jiffies (150 ));
4851
+ if (i_ret == 0 )
4852
+ return 0 ;
4889
4853
if (amlvideo2_dbg_en )
4890
4854
pr_info ("finish wait plug sema .\n" );
4891
4855
/* if local queue have vf , should give back to provider */
@@ -5327,7 +5291,7 @@ static int vidioc_s_output(struct file *file, void *fh,
5327
5291
{
5328
5292
struct amlvideo2_node * node = video_drvdata (file );
5329
5293
5330
- if (( mode < AML_SCREEN_MODE_RATIO ) || ( mode > AML_SCREEN_MODE_MAX ) )
5294
+ if (mode > AML_SCREEN_MODE_MAX )
5331
5295
return -1 ;
5332
5296
node -> mode = (enum aml_screen_mode_e )mode ;
5333
5297
return 0 ;
@@ -5689,6 +5653,9 @@ static int amlvideo2_receiver_event_fun(int type, void *data,
5689
5653
struct vframe_states frame_states ;
5690
5654
const char * name = (node -> vid == 0 ) ? DEVICE_NAME0 : DEVICE_NAME1 ;
5691
5655
5656
+ memset (& states , 0 , sizeof (struct vframe_states ));
5657
+ memset (& frame_states , 0 , sizeof (struct vframe_states ));
5658
+
5692
5659
switch (type ) {
5693
5660
case VFRAME_EVENT_PROVIDER_VFRAME_READY :
5694
5661
node -> provide_ready = 1 ;
0 commit comments