[TTVD] Get frame buffer size for surface 96/318596/6
authorMichal Jurkiewicz <m.jurkiewicz@samsung.com>
Tue, 24 Sep 2024 08:10:26 +0000 (10:10 +0200)
committerBot Blink <blinkbot@samsung.com>
Thu, 3 Oct 2024 08:24:45 +0000 (08:24 +0000)
[Problem]
8K AV1 video is cropped and stretched during playback in overlay mode.

[Cause]
Assumed frame buffer size (4096) is lower than video dimensions,
which results in improper video rendering.

[Solution]
Get frame buffer size from platform API.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-583
Change-Id: Iafc66bc6f8661255305608f7d4a06bd26e907c21
Signed-off-by: Michal Jurkiewicz <m.jurkiewicz@samsung.com>
tizen_src/chromium_impl/ui/ozone/platform/efl/video_surface.cc

index f94f39860e1ba2f89e9ca9c08b6a102e88c9cb36..c41eb35fd7d99102fdf2d1fba3e843550e07ecab 100644 (file)
@@ -478,17 +478,36 @@ void VideoSurface::PreparePlane(const gfx::OverlayRenderData& render_data,
     return;
   }
 
-  // Dummy frame buffer size. It's not really used for rendering, just to
-  // notify renderer with metadata from the buffer object underneath what
-  // should be rendered.
-  constexpr const size_t kFrameBufferSize = 4096;
+  int frame_buffer_width = 0;
+  int frame_buffer_height = 0;
+
+#if TIZEN_VERSION_AT_LEAST(9, 0, 0) && !BUILDFLAG(IS_RISCV64_TV)
+  res = ppi_video_dp_control_get_frame_buffer_size(&frame_buffer_width,
+                                                   &frame_buffer_height);
+#else
+  res = IVideoDpControl::getInstance()->getFrameBufferSize(
+      &frame_buffer_width, &frame_buffer_height);
+#endif
+
+  if (res != 0) {
+    constexpr const int kDefaultFrameBufferSize = 4096;
+    TIZEN_MEDIA_LOG(ERROR)
+        << "Cannot get frame buffer width and height, error: " << res;
+
+    frame_buffer_width = kDefaultFrameBufferSize;
+    frame_buffer_height = kDefaultFrameBufferSize;
+  }
+
+  TIZEN_MEDIA_LOG(VERBOSE) << "Frame buffer size: [" << frame_buffer_width
+                           << "x" << frame_buffer_height << "]";
+
   tbm_surface_info_s ts_info;
-  ts_info.width = kFrameBufferSize;
-  ts_info.height = kFrameBufferSize;
+  ts_info.width = frame_buffer_width;
+  ts_info.height = frame_buffer_height;
   ts_info.format = TBM_FORMAT_XRGB8888;
   ts_info.bpp = tbm_surface_internal_get_bpp(ts_info.format);
   ts_info.num_planes = 1;
-  ts_info.planes[0].stride = kFrameBufferSize * 4;
+  ts_info.planes[0].stride = frame_buffer_width * 4;
   ts_info.planes[0].offset = 0;
 
   auto tbm_bo_raw = tbm_bo.get();