[TTVD] Prefer texture supporting decoder allocation on NikeL 40/314040/4
authorJakub Gajownik <j.gajownik2@samsung.com>
Mon, 1 Jul 2024 14:36:25 +0000 (16:36 +0200)
committerBot Blink <blinkbot@samsung.com>
Thu, 4 Jul 2024 10:24:30 +0000 (10:24 +0000)
Now, when some specific boards (NikeL) can peform better
when texture-supported decoder is used, we should prefer
selecting it during resource allocation. This CL implements
it by manipulating "progressive" property.
It makes use of corelation between interlaced format and
texturing support, since both of them are supported by MFC
decoder. So when "progressive" property is not set, only
MFC decoder might be selected (if applicable, e.g it's not
applicable for 4K resolution).

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-514
Change-Id: I5d0cf1d62db85356c9be08015d3e1e715c3b1f91
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
media/filters/tizen/decoder_promotion.cc
media/filters/tizen/decoder_promotion_test.cc
tizen_src/chromium_impl/base/tizen/resource_manager.cc
tizen_src/chromium_impl/base/tizen/resource_manager.h

index b55d985a0de8ce168157790337fa76cf169542e8..0db0f564a8315fddab64bd4fe366ba003246925c 100644 (file)
@@ -239,12 +239,14 @@ absl::optional<uint32_t> DetectMaximalFramerate(MediaVideoCodec codec,
   }
 }
 
-ri_rsc_category_e FindDecoderForResolution(base::ResourceManager* manager,
-                                           const char* codec_name,
-                                           int32_t color_depth,
-                                           const gfx::Size& resolution,
-                                           uint32_t framerate,
-                                           ri_sampling_format sampling_format) {
+ri_rsc_category_e FindDecoderForResolution(
+    base::ResourceManager* manager,
+    const char* codec_name,
+    int32_t color_depth,
+    const gfx::Size& resolution,
+    uint32_t framerate,
+    ri_sampling_format sampling_format,
+    base::PreferTexturingSupport prefer_texturing_support) {
   // Lists framerates thresholds for different resource manager decoder
   // categories, e.g.:
   // - RM_CATEGORY_VIDEO_DECODER_HEVC_UHD_8BIT_30P
@@ -262,7 +264,7 @@ ri_rsc_category_e FindDecoderForResolution(base::ResourceManager* manager,
     category_option =
         static_cast<ri_rsc_category_e>(manager->GetCapableVideoCategoryId(
             codec_name, color_depth, resolution.width(), resolution.height(),
-            fps, sampling_format));
+            fps, sampling_format, prefer_texturing_support));
     TIZEN_MEDIA_LOG_NO_INSTANCE(VERBOSE)
         << "codec: '" << codec_name << "'"
         << " size: " << resolution.ToString() << " fps: " << fps
@@ -799,6 +801,13 @@ absl::optional<AllocatedDecoder> DecoderPromotion::SelectDecoder(
           << "Disabling picking better decoder for game streaming";
     }
 
+    // When manual rendering is prefered, we should allocate decoder that
+    // supports texturing to be able to utilize software rendering mode.
+    const auto prefer_texturing_support =
+        workarounds->ttvd_prefer_manual_rendering_for_low_latency
+            ? base::PreferTexturingSupport::kYes
+            : base::PreferTexturingSupport::kNo;
+
     if (codec == MediaVideoCodec::kCodecH264 && has_udh_decoder &&
         (use_h264_level50_workaround ||
          should_use_faster_decoder_for_game_streaming)) {
@@ -812,7 +821,7 @@ absl::optional<AllocatedDecoder> DecoderPromotion::SelectDecoder(
               .value_or(kDefaultFramerate);
       category_option = FindDecoderForResolution(
           GetResourceManager(), codec_name, bit_depth, k4k, uhd_fps,
-          ConvertChromaSampling(sampling));
+          ConvertChromaSampling(sampling), prefer_texturing_support);
     }
 
     if (category_option <= 0) {
@@ -823,7 +832,7 @@ absl::optional<AllocatedDecoder> DecoderPromotion::SelectDecoder(
       //   try to use MFC.
       category_option = FindDecoderForResolution(
           GetResourceManager(), codec_name, bit_depth, coded_size, framerate,
-          ConvertChromaSampling(sampling));
+          ConvertChromaSampling(sampling), prefer_texturing_support);
     }
   }
 
index 1a8568b987d88d7ea729fba4530e15d1685cc762..9bc36b6041eb4a569813f153522df6a3723032e8 100644 (file)
@@ -46,12 +46,14 @@ class FakeResourceManager : public base::ResourceManager {
                         int /* h_size */) override {
     return 1;
   }
-  int GetCapableVideoCategoryId(const char* /* codec_name */,
-                                int /* color_depth */,
-                                int /* width */,
-                                int /* height */,
-                                int /* framerate */,
-                                int /* sampling_format */) override {
+  int GetCapableVideoCategoryId(
+      const char* /* codec_name */,
+      int /* color_depth */,
+      int /* width */,
+      int /* height */,
+      int /* framerate */,
+      int /* sampling_format */,
+      base::PreferTexturingSupport /* prefer_texturing_support */) override {
     return 1;
   }
 
index 971986f3bf15dab48643e255b4611f1b8d7b7630..36953b71eeddc4fc42ee810feab5aa3a7448023d 100644 (file)
@@ -341,16 +341,24 @@ int ResourceManager::GetJpegCategoryId(const char* codec_name, int h_size) {
   return ri_get_jpeg_category_id(codec_name, h_size);
 }
 
-int ResourceManager::GetCapableVideoCategoryId(const char* codec_name,
-                                               int color_depth,
-                                               int width,
-                                               int height,
-                                               int framerate,
-                                               int sampling_format) {
+int ResourceManager::GetCapableVideoCategoryId(
+    const char* codec_name,
+    int color_depth,
+    int width,
+    int height,
+    int framerate,
+    int sampling_format,
+    PreferTexturingSupport prefer_texturing_support) {
 #if TIZEN_VERSION_AT_LEAST(6, 5, 0)
   auto property = VideoPropertyType(ri_create_video_property(
       codec_name, width, height, framerate, color_depth, sampling_format));
-  if (ri_video_property_set_progressive(property.get(), true) != RI_OK) {
+  // Interlaced format is supported on MFC, so skipping setting progressive
+  // property should allow to request texturing supported decoder. Note that
+  // it does not prevent from allocating decoder other than MFC (e.g for 4K).
+  const bool use_progressive =
+      prefer_texturing_support == PreferTexturingSupport::kNo;
+  if (use_progressive &&
+      ri_video_property_set_progressive(property.get(), true) != RI_OK) {
     TIZEN_MEDIA_LOG(ERROR) << "Cannot set progressive on video property";
     return RI_CATEGORY_NONE;
   }
index fd305e4e01b2fb711e14a9d4ba818cb9485fbf67..524ca39ba864cc1dd4f65ac702fae6e0effee76a 100644 (file)
@@ -23,6 +23,8 @@ namespace base {
 
 class ResourceManager;
 
+enum class PreferTexturingSupport { kNo, kYes };
+
 struct AllocatedResource {
   using ID = uint32_t;
 
@@ -146,12 +148,14 @@ class ResourceManager : public suspend_resume::SuspendResumeClient {
   virtual bool IsCategorySupported(int category);
 
   virtual int GetJpegCategoryId(const char* codec_name, int h_size);
-  virtual int GetCapableVideoCategoryId(const char* codec_name,
-                                        int color_depth,
-                                        int width,
-                                        int height,
-                                        int framerate,
-                                        int sampling_format);
+  virtual int GetCapableVideoCategoryId(
+      const char* codec_name,
+      int color_depth,
+      int width,
+      int height,
+      int framerate,
+      int sampling_format,
+      PreferTexturingSupport prefer_texturing_support);
 
   // Checks if on the TV board there is physically present decoder capable
   // of decoding UHD (4K) content (aka DVDE).