vpp: don't overwrite on_pending state when enable vd layer [1/1]
authorBrian Zhu <brian.zhu@amlogic.com>
Tue, 16 Apr 2019 18:35:27 +0000 (02:35 +0800)
committerNick Xie <nick@khadas.com>
Mon, 5 Aug 2019 05:54:53 +0000 (13:54 +0800)
PD#OTT-3244

Problem:
When vd layer state is on_pending, calling enable videolayer
function will overwrite the state. Then it will not enable video
layer really.

Solution:
Add the judgement to check if the state is on_pending.

Verify:
verified on W400

Change-Id: I0513a6610fdb108bec05858c7f6c7976be5e7edb
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index 8b5ea3d..fc1d900 100644 (file)
@@ -329,7 +329,8 @@ atomic_t capture_use_cnt = ATOMIC_INIT(CAPTURE_STATE_OFF);
        do { \
                unsigned long flags; \
                spin_lock_irqsave(&video_onoff_lock, flags); \
-               video_onoff_state = VIDEO_ENABLE_STATE_ON_REQ; \
+               if (video_onoff_state != VIDEO_ENABLE_STATE_ON_PENDING) \
+                       video_onoff_state = VIDEO_ENABLE_STATE_ON_REQ; \
                video_enabled = 1; \
                video_status_saved = 1; \
                spin_unlock_irqrestore(&video_onoff_lock, flags); \
@@ -357,7 +358,8 @@ atomic_t capture_use_cnt = ATOMIC_INIT(CAPTURE_STATE_OFF);
        do { \
                unsigned long flags; \
                spin_lock_irqsave(&video2_onoff_lock, flags); \
-               video2_onoff_state = VIDEO_ENABLE_STATE_ON_REQ; \
+               if (video2_onoff_state != VIDEO_ENABLE_STATE_ON_PENDING) \
+                       video2_onoff_state = VIDEO_ENABLE_STATE_ON_REQ; \
                video2_enabled = 1; \
                video2_status_saved = 1; \
                spin_unlock_irqrestore(&video2_onoff_lock, flags); \