Skip to content

Commit ac8d5fa

Browse files
Guosong Zhouakiernan
Guosong Zhou
authored andcommitted
1 parent 509c5a8 commit ac8d5fa

File tree

1 file changed

+31
-64
lines changed
  • drivers/amlogic/media/video_processor/video_dev

1 file changed

+31
-64
lines changed

drivers/amlogic/media/video_processor/video_dev/amlvideo2.c

+31-64
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static unsigned int debug;
132132
/* MODULE_PARM_DESC(debug, "activates debug info"); */
133133

134134
#define DEF_FRAMERATE 30
135+
static unsigned int mirror_value;
135136

136137
static unsigned int vid_limit = 32;
137138
module_param(vid_limit, uint, 0644);
@@ -856,7 +857,7 @@ struct amlvideo2_node *node)
856857
int src_top, src_left, src_width, src_height;
857858
int dst_top, dst_left, dst_width, dst_height;
858859
struct canvas_s cs0, cs1, cs2, cd;
859-
int current_mirror = 0;
860+
int current_mirror;
860861
int cur_angle = 0;
861862
int output_canvas = vf->canvas0Addr;
862863

@@ -942,7 +943,7 @@ struct amlvideo2_node *node)
942943
dst_width = output->width;
943944
dst_height = output->height;
944945

945-
current_mirror = 0;
946+
current_mirror = mirror_value;
946947
cur_angle = output->angle;
947948
if (current_mirror == 1)
948949
cur_angle = (360 - cur_angle % 360);
@@ -1307,7 +1308,7 @@ struct amlvideo2_node *node)
13071308
dst_width = output->width;
13081309
dst_height = output->height;
13091310

1310-
current_mirror = 0;
1311+
current_mirror = mirror_value;
13111312
cur_angle = output->angle;
13121313
if (current_mirror == 1)
13131314
cur_angle = (360 - cur_angle % 360);
@@ -1600,7 +1601,7 @@ struct amlvideo2_node *node)
16001601
int src_top, src_left, src_width, src_height;
16011602
int dst_top, dst_left, dst_width, dst_height;
16021603
struct canvas_s cs0, cs1, cs2, cd;
1603-
int current_mirror = 0;
1604+
int current_mirror;
16041605
int cur_angle = 0;
16051606
int output_canvas = output->canvas_id;
16061607

@@ -1681,7 +1682,7 @@ struct amlvideo2_node *node)
16811682
dst_width = output->width;
16821683
dst_height = output->height;
16831684

1684-
current_mirror = 0;
1685+
current_mirror = mirror_value;
16851686
cur_angle = output->angle;
16861687
if (current_mirror == 1)
16871688
cur_angle = (360 - cur_angle % 360);
@@ -2001,7 +2002,7 @@ struct amlvideo2_node *node)
20012002
int src_top, src_left, src_width, src_height;
20022003
int dst_top, dst_left, dst_width, dst_height;
20032004
struct canvas_s cs0, cs1, cs2, cd;
2004-
int current_mirror = 0;
2005+
int current_mirror;
20052006
int cur_angle = 0;
20062007
int output_canvas = output->canvas_id;
20072008

@@ -2083,7 +2084,7 @@ struct amlvideo2_node *node)
20832084
dst_width = output->width;
20842085
dst_height = output->height;
20852086

2086-
current_mirror = 0;
2087+
current_mirror = mirror_value;
20872088
cur_angle = output->angle;
20882089
if (current_mirror == 1)
20892090
cur_angle = (360 - cur_angle % 360);
@@ -2401,7 +2402,7 @@ struct amlvideo2_node *node)
24012402
int src_top, src_left, src_width, src_height;
24022403
int dst_top, dst_left, dst_width, dst_height;
24032404
struct canvas_s cs0, cs1, cs2, cd;
2404-
int current_mirror = 0;
2405+
int current_mirror;
24052406
int cur_angle = 0;
24062407
int output_canvas = output->canvas_id;
24072408

@@ -2483,7 +2484,7 @@ struct amlvideo2_node *node)
24832484
dst_width = output->width;
24842485
dst_height = output->height;
24852486

2486-
current_mirror = 0;
2487+
current_mirror = mirror_value;
24872488
cur_angle = output->angle;
24882489
if (current_mirror == 1)
24892490
cur_angle = (360 - cur_angle % 360);
@@ -2802,7 +2803,7 @@ int amlvideo2_ge2d_multi_pre_process(struct vframe_s *vf,
28022803
int src_top, src_left, src_width, src_height;
28032804
int dst_top, dst_left, dst_width, dst_height;
28042805
struct canvas_s cs0, cs1, cs2, cd;
2805-
int current_mirror = 0;
2806+
int current_mirror;
28062807
int cur_angle = 0;
28072808
int output_canvas = output->canvas_id;
28082809
int temp_canvas = AMLVIDEO2_1_RES_CANVAS + 8;
@@ -2851,7 +2852,7 @@ int amlvideo2_ge2d_multi_pre_process(struct vframe_s *vf,
28512852
dst_width = output->width;
28522853
dst_height = output->height;
28532854

2854-
current_mirror = 0;
2855+
current_mirror = mirror_value;
28552856
cur_angle = 0;
28562857

28572858

@@ -3010,7 +3011,7 @@ int amlvideo2_ge2d_pre_process(struct vframe_s *vf,
30103011
int src_top, src_left, src_width, src_height;
30113012
int dst_top, dst_left, dst_width, dst_height;
30123013
struct canvas_s cs0, cs1, cs2, cd;
3013-
int current_mirror = 0;
3014+
int current_mirror;
30143015
int cur_angle = 0;
30153016
int output_canvas = output->canvas_id;
30163017

@@ -3091,7 +3092,7 @@ int amlvideo2_ge2d_pre_process(struct vframe_s *vf,
30913092
dst_width = output->width;
30923093
dst_height = output->height;
30933094

3094-
current_mirror = 0;
3095+
current_mirror = mirror_value;
30953096
cur_angle = output->angle;
30963097
if (current_mirror == 1)
30973098
cur_angle = (360 - cur_angle % 360);
@@ -3400,11 +3401,6 @@ int amlvideo2_ge2d_pre_process(struct vframe_s *vf,
34003401
return output_canvas;
34013402
}
34023403

3403-
int amlvideo2_sw_post_process(int canvas, void *addr)
3404-
{
3405-
return 0;
3406-
}
3407-
34083404
static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
34093405
struct amlvideo2_node_buffer *buf,
34103406
struct vframe_s *vf)
@@ -3414,9 +3410,7 @@ static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
34143410
struct amlvideo2_node *node = fh->node;
34153411
void *vbuf = NULL;
34163412
int src_canvas = -1;
3417-
int magic = 0;
34183413
int ge2d_proc = 0;
3419-
int sw_proc = 0;
34203414

34213415
vbuf = (void *)videobuf_to_res(&buf->vb);
34223416

@@ -3438,43 +3432,12 @@ static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
34383432
memcpy(&output.info.display_info, &(node->display_info),
34393433
sizeof(struct vdisplay_info_s));
34403434

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(
34483437
&output, (node->vid == 0) ?
34493438
(AMLVIDEO2_RES0_CANVAS_INDEX + buf->vb.i * 3) :
34503439
(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;
34783441
}
34793442

34803443
switch (output.v4l2_format) {
@@ -3534,9 +3497,6 @@ static int amlvideo2_fillbuff(struct amlvideo2_fh *fh,
35343497
}
35353498
}
35363499

3537-
if ((sw_proc) && (src_canvas > 0))
3538-
amlvideo2_sw_post_process(src_canvas, vbuf);
3539-
35403500
buf->vb.state = VIDEOBUF_DONE;
35413501
/* do_gettimeofday(&buf->vb.ts); */
35423502
return 0;
@@ -4184,10 +4144,9 @@ enum aml_provider_type_e get_provider_type(const char *name)
41844144
return type;
41854145
}
41864146

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)
41884148
{
4189-
enum aml_provider_type_e type = AML_RECEIVER_NONE;
4190-
4149+
enum aml_receiver_type_e type = AML_RECEIVER_NONE;
41914150
if (!name)
41924151
return type;
41934152
if (strncasecmp(name, "ppmgr", 5) == 0) {
@@ -4855,6 +4814,7 @@ int amlvideo2_notify_callback(struct notifier_block *block, unsigned long cmd,
48554814
int i;
48564815
int index = 0;
48574816
int ret = 0;
4817+
int i_ret = 0;
48584818

48594819
for (i = 0; i < AMLVIDEO2_MAX_NODE; i++) {
48604820
if ((gAmlvideo2_Node[i] != NULL) &&
@@ -4869,23 +4829,27 @@ int amlvideo2_notify_callback(struct notifier_block *block, unsigned long cmd,
48694829
return ret;
48704830

48714831
node = gAmlvideo2_Node[index];
4872-
if ((node != NULL) && (!node->users))
4832+
if (node == NULL)
4833+
return ret;
4834+
if (!(node->users))
48734835
return ret;
48744836

48754837
mutex_lock(&node->mutex);
48764838
switch (cmd) {
48774839
case VOUT_EVENT_MODE_CHANGE:
48784840
pr_info("mode changed in amlvideo2 .\n");
48794841
vfp = vf_get_provider(node->recv.name);
4880-
if ((node == NULL) || (vfp == NULL) ||
4842+
if ((vfp == NULL) ||
48814843
(!node->fh->is_streamed_on)) {
48824844
pr_info("driver is not ready or not need to screencap.\n");
48834845
mutex_unlock(&node->mutex);
48844846
return ret;
48854847
}
48864848
node->pflag = true;
4887-
wait_for_completion_timeout(&node->plug_sema,
4849+
i_ret = wait_for_completion_timeout(&node->plug_sema,
48884850
msecs_to_jiffies(150));
4851+
if (i_ret == 0)
4852+
return 0;
48894853
if (amlvideo2_dbg_en)
48904854
pr_info("finish wait plug sema .\n");
48914855
/* if local queue have vf , should give back to provider */
@@ -5327,7 +5291,7 @@ static int vidioc_s_output(struct file *file, void *fh,
53275291
{
53285292
struct amlvideo2_node *node = video_drvdata(file);
53295293

5330-
if ((mode < AML_SCREEN_MODE_RATIO) || (mode > AML_SCREEN_MODE_MAX))
5294+
if (mode > AML_SCREEN_MODE_MAX)
53315295
return -1;
53325296
node->mode = (enum aml_screen_mode_e)mode;
53335297
return 0;
@@ -5689,6 +5653,9 @@ static int amlvideo2_receiver_event_fun(int type, void *data,
56895653
struct vframe_states frame_states;
56905654
const char *name = (node->vid == 0) ? DEVICE_NAME0 : DEVICE_NAME1;
56915655

5656+
memset(&states, 0, sizeof(struct vframe_states));
5657+
memset(&frame_states, 0, sizeof(struct vframe_states));
5658+
56925659
switch (type) {
56935660
case VFRAME_EVENT_PROVIDER_VFRAME_READY:
56945661
node->provide_ready = 1;

0 commit comments

Comments
 (0)