vl: Add support for max level query v2
authorRico Schüller <kgbricola@web.de>
Wed, 14 Aug 2013 11:17:22 +0000 (13:17 +0200)
committerChristian König <christian.koenig@amd.com>
Wed, 14 Aug 2013 11:20:01 +0000 (13:20 +0200)
This patch adds the level query support to the video decoders
and uses some more reasonable defaults.

v2: (ck) add commit message

Reviewed-by: Christian König <christian.koenig@amd.com>
12 files changed:
src/gallium/auxiliary/vl/vl_decoder.c
src/gallium/auxiliary/vl/vl_decoder.h
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/nouveau/nouveau_video.c
src/gallium/drivers/nv50/nv84_video.c
src/gallium/drivers/nvc0/nvc0_video.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeon/radeon_uvd.c
src/gallium/drivers/radeonsi/radeonsi_pipe.c
src/gallium/include/pipe/p_video_enums.h
src/gallium/state_trackers/vdpau/query.c

index d6909cbfc0d3155bea7c7ca387634fdb22b9e833..16f09b501e6454784bbd10cb179a85404a3ef9b5 100644 (file)
@@ -44,6 +44,21 @@ vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile
    }
 }
 
+int
+vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
+{
+   assert(screen);
+   switch (profile) {
+      case PIPE_VIDEO_PROFILE_MPEG1:
+         return 0;
+      case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
+      case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+         return 3;
+      default:
+         return 0;
+   }
+}
+
 struct pipe_video_decoder *
 vl_create_decoder(struct pipe_context *pipe,
                   enum pipe_video_profile profile,
index 8fa6527ce5493dd42ddb4eeb98c2cc50456180d8..b0b4161d4ec389f62b5b22f211cf7ace02de257a 100644 (file)
 bool
 vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
 
+/**
+ * get the maximum supported level for the given profile with shader based decoding
+ */
+int
+vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
+
 /**
  * standard implementation of pipe->create_video_decoder
  */
index e8262bc133cd23418188510830aa8ba99df2a301..5f97226bb82fa38b172d3a576890da5e9fe960f6 100644 (file)
@@ -170,7 +170,8 @@ ilo_get_video_param(struct pipe_screen *screen,
       return 1;
    case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
       return 0;
-
+   case PIPE_VIDEO_CAP_MAX_LEVEL:
+      return vl_level_supported(screen, profile);
    default:
       return 0;
    }
index 935750836b75584c1811d3b802a200248f53b917..1563b2243604bc29a445e322ec99b59661ef63f6 100644 (file)
@@ -862,6 +862,8 @@ nouveau_screen_get_video_param(struct pipe_screen *pscreen,
       return false;
    case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
       return true;
+   case PIPE_VIDEO_CAP_MAX_LEVEL:
+      return vl_level_supported(screen, profile);
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
index d5f6295a850c6088da8565c9b7b91d8497be7bcf..3602a6d179901492a3f5453e9a1c71efcd14f9a5 100644 (file)
@@ -778,6 +778,21 @@ nv84_screen_get_video_param(struct pipe_screen *pscreen,
       return true;
    case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
       return false;
+   case PIPE_VIDEO_CAP_MAX_LEVEL:
+      switch (profile) {
+      case PIPE_VIDEO_PROFILE_MPEG1:
+         return 0;
+      case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
+      case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+         return 3;
+      case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+      case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
+      case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
+         return 41;
+      default:
+         debug_printf("unknown video profile: %d\n", profile);
+         return 0;
+      }
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
index 7cc086a0e8c0fb973fe34f6f49cd779faf10aea9..a871ab792d70b14b0f001a326f8dca35b7385d7e 100644 (file)
@@ -48,6 +48,31 @@ nvc0_screen_get_video_param(struct pipe_screen *pscreen,
       return true;
    case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
       return false;
+   case PIPE_VIDEO_CAP_MAX_LEVEL:
+      switch (profile) {
+      case PIPE_VIDEO_PROFILE_MPEG1:
+         return 0;
+      case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
+      case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+         return 3;
+      case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
+         return 3;
+      case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
+         return 5;
+      case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
+         return 1;
+      case PIPE_VIDEO_PROFILE_VC1_MAIN:
+         return 2;
+      case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
+         return 4;
+      case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+      case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
+      case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
+         return 41;
+      default:
+         debug_printf("unknown video profile: %d\n", profile);
+         return 0;
+      }
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
index 7ead292af38d30be88de67f9fb93994125e97581..25ff286389275beb30df6e6ea54ae240763476db 100644 (file)
@@ -359,6 +359,8 @@ static int r300_get_video_param(struct pipe_screen *screen,
          return false;
       case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
          return true;
+      case PIPE_VIDEO_CAP_MAX_LEVEL:
+         return vl_level_supported(screen, profile);
       default:
          return 0;
    }
index 74dd9606a34decdcd1784e69be304a5e7019bf13..e5aa55e46a9e2a5f6171ee0a364e31f85f0a25cf 100644 (file)
@@ -795,6 +795,8 @@ static int r600_get_video_param(struct pipe_screen *screen,
                return false;
        case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
                return true;
+       case PIPE_VIDEO_CAP_MAX_LEVEL:
+               return vl_level_supported(screen, profile);
        default:
                return 0;
        }
index 2f98de21f2283e96acdfbc1b9bf3b65b989225f3..e3c3dd63d4f0c88dccaf5d8b54c596da0c14dadd 100644 (file)
@@ -1113,6 +1113,30 @@ int ruvd_get_video_param(struct pipe_screen *screen,
                return true;
        case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
                return true;
+       case PIPE_VIDEO_CAP_MAX_LEVEL:
+               switch (profile) {
+               case PIPE_VIDEO_PROFILE_MPEG1:
+                       return 0;
+               case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
+               case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
+                       return 3;
+               case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
+                       return 3;
+               case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
+                       return 5;
+               case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
+                       return 1;
+               case PIPE_VIDEO_PROFILE_VC1_MAIN:
+                       return 2;
+               case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
+                       return 4;
+               case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
+               case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
+               case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
+                       return 41;
+               default:
+                       return 0;
+               }
        default:
                return 0;
        }
index 69b9ca978984e38f1bce32d3b0167a9249c56aa9..3c736792c64fde4c6f51669685bf14453764c4bb 100644 (file)
@@ -546,6 +546,8 @@ static int r600_get_video_param(struct pipe_screen *screen,
                return vl_video_buffer_max_size(screen);
        case PIPE_VIDEO_CAP_PREFERED_FORMAT:
                return PIPE_FORMAT_NV12;
+       case PIPE_VIDEO_CAP_MAX_LEVEL:
+               return vl_level_supported(screen, profile);
        default:
                return 0;
        }
index deacf8d1d9cf0f551227ce0f0c1899a507fcb45a..e66948e1e954577ccad18be9a0eafca646a480ec 100644 (file)
@@ -54,7 +54,8 @@ enum pipe_video_cap
    PIPE_VIDEO_CAP_PREFERED_FORMAT = 4,
    PIPE_VIDEO_CAP_PREFERS_INTERLACED = 5,
    PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = 6,
-   PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7
+   PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7,
+   PIPE_VIDEO_CAP_MAX_LEVEL = 8
 };
 
 enum pipe_video_codec
index 2281dcfd60f96460956b77d52bb82e76a974f815..a6b34c719b71e7b5c8a512c821c381f48aa6b731 100644 (file)
@@ -176,13 +176,13 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
       *is_supported = false;
       return VDP_STATUS_OK;
    }
-   
+
    pipe_mutex_lock(dev->mutex);
    *is_supported = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_SUPPORTED);
    if (*is_supported) {
       *max_width = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_WIDTH); 
       *max_height = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_HEIGHT);
-      *max_level = 16;
+      *max_level = pscreen->get_video_param(pscreen, p_profile, PIPE_VIDEO_CAP_MAX_LEVEL);
       *max_macroblocks = (*max_width/16)*(*max_height/16);
    } else {
       *max_width = 0;