[TTVD] Ensure video flip is applied correctly 07/318407/3 submit/tizen/20241001.160012
authorJakub Gajownik <j.gajownik2@samsung.com>
Tue, 24 Sep 2024 08:27:23 +0000 (10:27 +0200)
committerJakub Gajownik <j.gajownik2@samsung.com>
Tue, 1 Oct 2024 08:35:41 +0000 (08:35 +0000)
[Problem]
Several transformations on video are not applied correctly
when performed in specific order, e.g change from vertical
to horizontal flip.

[Cause]
When only flip attribute is changed, compositor does not
recognizes it as real change of geometry, hence no update
is done on video layer.

[Solution]
Workaround it to perform flip change only together with
transformation. It requires to split it into 2 phases in
such cases, but now geometry change is applied properly.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-550
Change-Id: I23a2e0ca1eaac37858f759d90fa9dec1554f7ae1
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
tizen_src/chromium_impl/ui/ozone/platform/efl/video_surface.cc
tizen_src/chromium_impl/ui/ozone/platform/efl/video_surface.h

index 587672ee71f9b1153215793e6341728460f4aa12..cc2d4f1fa3d23ca3c0da5ed55649de877d3d6e87 100644 (file)
@@ -317,10 +317,32 @@ void VideoSurface::SetGeometry(
       video_transformation.flip = kFlipHV;
     }
 
+    if (video_transformation.rotation == last_rotation_) {
+      // Flip is applied correctly only when whole geometry changes, so in case
+      // rotation remains the same, flip also won't be really updated.
+      // As an workaround apply different valid transform, commit it and then
+      // apply proper attributes again.
+      TIZEN_MEDIA_LOG(WARNING) << "Transform has not changed, but flip should!";
+      tizen_viewport_set_transform(video_viewport_.get(),
+                                   WL_OUTPUT_TRANSFORM_NORMAL);
+
+      RegisterCallbackAfterCommit(base::DoNothing());
+      wl_surface_attach(video_surface_.get(), buffer_.get(), 0, 0);
+      wl_surface_damage(video_surface_.get(), 0, 0, kDefaultGraphicsWidth,
+                        kDefaultGraphicsHeight);
+      wl_surface_commit(video_surface_.get());
+      wl_display_flush(display_);
+
+      // Wait synchronously for all the changes being applied at the
+      // compositor level.
+      WaitForCallbacksToFinish();
+    }
+
     tizen_viewport_set_transform(video_viewport_.get(),
                                  video_transformation.rotation);
     tizen_video_object_set_attribute(video_object_.get(), "flip",
                                      video_transformation.flip);
+    last_rotation_ = video_transformation.rotation;
   }
 
   wl_subsurface_set_desync(video_subsurface_.get());
index 6b3bcac6ca9e4a3ad2def9f5a1271f78d0f12404..0538c1eb121a32a4fde9bab32e8886ce33203e97 100644 (file)
@@ -135,6 +135,8 @@ class VideoSurface {
 
   absl::optional<uint32_t> last_plane_id_;
 
+  wl_output_transform last_rotation_ = WL_OUTPUT_TRANSFORM_NORMAL;
+
   using VideoSinkType = std::unique_ptr<void, VideoSinkDeleter>;
   VideoSinkType video_sink_;