On 15.08.2013 02:10, Emil Velikov wrote:
Fix a typo introduced with commit d1ba1055d9 -
vl: Add support for max level query v2

Cc: Rico Schüller <kgbric...@web.de>
Cc: Christian König <christian.koe...@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68126
Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com>
---

FWIW the original patch could have introduced default params for all profiles,
and let the individual driver provide their own function to ease duplication.
A call to get_params(VIDEO_CAP_SUPPORTED) ensures that we do not request the
CAP_MAX_LEVEL of a unsupported profile

And what are the correct default values? Are these the values which most hardware can do (at this time) or the maximum values? (for reference only for H.264 see: http://en.wikipedia.org/wiki/H.264#Levels ) It's pretty much likely that some video decoding units may have different supported levels and then we would add that back in again. I'm not sure this is really better. Does something like the attached meet your needs?

Thanks for the fix.

Cheers
Rico



  src/gallium/drivers/nouveau/nouveau_video.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_video.c 
b/src/gallium/drivers/nouveau/nouveau_video.c
index 1563b22..5c4ec0f 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -863,7 +863,7 @@ nouveau_screen_get_video_param(struct pipe_screen *pscreen,
     case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
        return true;
     case PIPE_VIDEO_CAP_MAX_LEVEL:
-      return vl_level_supported(screen, profile);
+      return vl_level_supported(pscreen, profile);
     default:
        debug_printf("unknown video param: %d\n", param);
        return 0;


commit d53abeff5304bb6148ddc1aae1d4810282042ee5
Author: Rico Schüller <kgbric...@web.de>
Date:   Wed Aug 14 13:00:33 2013 +0200

    vl/decoder: Use defaults for the supported level.

diff --git a/src/gallium/auxiliary/vl/vl_decoder.c b/src/gallium/auxiliary/vl/vl_decoder.c
index 16f09b5..68c6e4c 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_decoder.c
@@ -54,6 +54,20 @@ vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
       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;
    }
diff --git a/src/gallium/auxiliary/vl/vl_decoder.h b/src/gallium/auxiliary/vl/vl_decoder.h
index b0b4161..cb4811d 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.h
+++ b/src/gallium/auxiliary/vl/vl_decoder.h
@@ -38,7 +38,7 @@ 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
+ * get the default maximum supported level for the given profile
  */
 int
 vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
diff --git a/src/gallium/drivers/nv50/nv84_video.c b/src/gallium/drivers/nv50/nv84_video.c
index 3602a6d..0d1af8e 100644
--- a/src/gallium/drivers/nv50/nv84_video.c
+++ b/src/gallium/drivers/nv50/nv84_video.c
@@ -779,20 +779,7 @@ nv84_screen_get_video_param(struct pipe_screen *pscreen,
    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;
-      }
+      return vl_level_supported(pscreen, profile);
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
diff --git a/src/gallium/drivers/nvc0/nvc0_video.c b/src/gallium/drivers/nvc0/nvc0_video.c
index a871ab7..b987344 100644
--- a/src/gallium/drivers/nvc0/nvc0_video.c
+++ b/src/gallium/drivers/nvc0/nvc0_video.c
@@ -49,30 +49,7 @@ nvc0_screen_get_video_param(struct pipe_screen *pscreen,
    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;
-      }
+      return vl_level_supported(pscreen, profile);
    default:
       debug_printf("unknown video param: %d\n", param);
       return 0;
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index c27f42c..a72479c 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -42,6 +42,7 @@
 #include "util/u_memory.h"
 #include "util/u_video.h"
 
+#include "vl/vl_decoder.h"
 #include "vl/vl_defines.h"
 #include "vl/vl_mpeg12_decoder.h"
 
@@ -1114,29 +1115,7 @@ int ruvd_get_video_param(struct pipe_screen *screen,
 	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;
-		}
+		return vl_level_supported(screen, profile);
 	default:
 		return 0;
 	}
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to