[g3dvl] rename is_format_supported to is_video_format_supported and move it into...
authorChristian König <deathsimple@vodafone.de>
Fri, 8 Jul 2011 09:20:39 +0000 (11:20 +0200)
committerChristian König <deathsimple@vodafone.de>
Fri, 8 Jul 2011 09:20:39 +0000 (11:20 +0200)
src/gallium/auxiliary/vl/vl_context.c
src/gallium/auxiliary/vl/vl_video_buffer.c
src/gallium/auxiliary/vl/vl_video_buffer.h
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_video_context.h

index 3a90a247bd81041b7fb940b67f8e8eb9ec259f4e..46e1981cc9ff714c666843cbc857ff8c2f568d9e 100644 (file)
@@ -47,33 +47,6 @@ vl_context_destroy(struct pipe_video_context *context)
    FREE(ctx);
 }
 
-static boolean
-vl_context_is_format_supported(struct pipe_video_context *context,
-                               enum pipe_format format,
-                               enum pipe_video_profile profile)
-{
-   struct vl_context *ctx = (struct vl_context*)context;
-   const enum pipe_format *resource_formats;
-   unsigned i;
-
-   assert(context);
-
-   resource_formats = vl_video_buffer_formats(ctx->pipe, format);
-   if (!resource_formats)
-      return false;
-
-   for(i = 0; i < VL_MAX_PLANES; ++i) {
-      if (!resource_formats[i])
-         continue;
-
-      if (!ctx->pipe->screen->is_format_supported(ctx->pipe->screen, resource_formats[i],
-                                                  PIPE_TEXTURE_2D, 0, PIPE_USAGE_STATIC))
-         return false;
-   }
-
-   return true;
-}
-
 static struct pipe_surface *
 vl_context_create_surface(struct pipe_video_context *context,
                           struct pipe_resource *resource,
@@ -220,7 +193,7 @@ vl_context_create_buffer(struct pipe_video_context *context,
       PIPE_VIDEO_CAP_NPOT_TEXTURES
    );
 
-   resource_formats = vl_video_buffer_formats(ctx->pipe, buffer_format);
+   resource_formats = vl_video_buffer_formats(ctx->pipe->screen, buffer_format);
    if (!resource_formats)
       return NULL;
 
@@ -261,7 +234,6 @@ vl_create_context(struct pipe_context *pipe)
    ctx->base.screen = pipe->screen;
 
    ctx->base.destroy = vl_context_destroy;
-   ctx->base.is_format_supported = vl_context_is_format_supported;
    ctx->base.create_surface = vl_context_create_surface;
    ctx->base.create_sampler_view = vl_context_create_sampler_view;
    ctx->base.clear_sampler = vl_context_clear_sampler;
index 93bc096b7332aaa1b590bbc2d5c76fc2fff0bf83..9b7bab47484cdbbf1981300ad1fda397d08f88fa 100644 (file)
@@ -51,7 +51,7 @@ const enum pipe_format const_resource_formats_NV12[3] = {
 };
 
 const enum pipe_format *
-vl_video_buffer_formats(struct pipe_context *pipe, enum pipe_format format)
+vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format)
 {
    switch(format) {
    case PIPE_FORMAT_YV12:
@@ -65,6 +65,29 @@ vl_video_buffer_formats(struct pipe_context *pipe, enum pipe_format format)
    }
 }
 
+boolean
+vl_video_buffer_is_format_supported(struct pipe_screen *screen,
+                                    enum pipe_format format,
+                                    enum pipe_video_profile profile)
+{
+   const enum pipe_format *resource_formats;
+   unsigned i;
+
+   resource_formats = vl_video_buffer_formats(screen, format);
+   if (!resource_formats)
+      return false;
+
+   for(i = 0; i < VL_MAX_PLANES; ++i) {
+      if (!resource_formats[i])
+         continue;
+
+      if (!screen->is_format_supported(screen, resource_formats[i], PIPE_TEXTURE_2D, 0, PIPE_USAGE_STATIC))
+         return false;
+   }
+
+   return true;
+}
+
 static void
 vl_video_buffer_destroy(struct pipe_video_buffer *buffer)
 {
index 728c6f5f0911b069fac5ed8e94b19a5b8d5ac853..8755c54dc73e8888b246940ece9e988ef56f9b7d 100644 (file)
@@ -53,7 +53,16 @@ struct vl_video_buffer
  * get subformats for each plane
  */
 const enum pipe_format *
-vl_video_buffer_formats(struct pipe_context *pipe, enum pipe_format format);
+vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format);
+
+/**
+ * check if video buffer format is supported for a codec/profile
+ * can be used as default implementation of screen->is_video_format_supported
+ */
+boolean
+vl_video_buffer_is_format_supported(struct pipe_screen *screen,
+                                    enum pipe_format format,
+                                    enum pipe_video_profile profile);
 
 /**
  * initialize a buffer, creating its resources
index a440ecb8c396116492befe3dace3723714b43bf0..53437d3ad080a9a4c002e7aa0af94e13f09e3126 100644 (file)
@@ -25,6 +25,7 @@
 #include "util/u_format_s3tc.h"
 #include "util/u_memory.h"
 #include "os/os_time.h"
+#include "vl/vl_video_buffer.h"
 
 #include "r300_context.h"
 #include "r300_texture.h"
@@ -522,6 +523,7 @@ struct pipe_screen* r300_screen_create(struct radeon_winsys *rws)
     r300screen->screen.get_paramf = r300_get_paramf;
     r300screen->screen.get_video_param = r300_get_video_param;
     r300screen->screen.is_format_supported = r300_is_format_supported;
+    r300screen->screen.is_video_format_supported = vl_video_buffer_is_format_supported;
     r300screen->screen.context_create = r300_create_context;
     r300screen->screen.video_context_create = r300_video_create;
     r300screen->screen.fence_reference = r300_fence_reference;
index a25b6d0ff9699ba948998ea687fd0509ec46dd11..4b923f8670450c7a370bbd0b47736c25ed0577fe 100644 (file)
@@ -38,6 +38,7 @@
 #include <util/u_memory.h>
 #include <util/u_inlines.h>
 #include "util/u_upload_mgr.h"
+#include <vl/vl_video_buffer.h>
 #include "os/os_time.h"
 #include <pipebuffer/pb_buffer.h>
 #include "r600.h"
@@ -667,6 +668,7 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon)
        rscreen->screen.get_paramf = r600_get_paramf;
        rscreen->screen.get_video_param = r600_get_video_param;
        rscreen->screen.is_format_supported = r600_is_format_supported;
+       rscreen->screen.is_video_format_supported = vl_video_buffer_is_format_supported;
        rscreen->screen.context_create = r600_create_context;
        rscreen->screen.video_context_create = r600_video_create;
        rscreen->screen.fence_reference = r600_fence_reference;
index f0467e9148de98087b926e57025fb68c9d5e1459..b978fb4f61e4a2e0ba9dd27523029fa1d15dd985 100644 (file)
@@ -34,6 +34,7 @@
 #include "pipe/p_screen.h"
 #include "draw/draw_context.h"
 #include "vl/vl_context.h"
+#include "vl/vl_video_buffer.h"
 
 #include "state_tracker/sw_winsys.h"
 #include "tgsi/tgsi_exec.h"
@@ -338,6 +339,7 @@ softpipe_create_screen(struct sw_winsys *winsys)
    screen->base.get_paramf = softpipe_get_paramf;
    screen->base.get_video_param = softpipe_get_video_param;
    screen->base.is_format_supported = softpipe_is_format_supported;
+   screen->base.is_video_format_supported = vl_video_buffer_is_format_supported;
    screen->base.context_create = softpipe_create_context;
    screen->base.flush_frontbuffer = softpipe_flush_frontbuffer;
    screen->base.video_context_create = sp_video_create;
index 2fa469bbea76a85c27b166526b48be71aad57e74..011724a79ccc6fc1f10237092408ceeb6303a2fb 100644 (file)
@@ -112,6 +112,14 @@ struct pipe_screen {
                                    enum pipe_texture_target target,
                                    unsigned sample_count,
                                    unsigned bindings );
+                                   
+   /**
+    * Check if the given pipe_format is supported as output for this codec/profile.
+    * \param profile  profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN
+    */
+   boolean (*is_video_format_supported)( struct pipe_screen *,
+                                         enum pipe_format format,
+                                         enum pipe_video_profile profile );
 
    /**
     * Create a new texture object, using the given template info.
index 1fb635f17560ad86b9c27bc36305c617943e5398..78cf43e2edce3f114a038072c6816f73a59ae7a7 100644 (file)
@@ -55,13 +55,6 @@ struct pipe_video_context
     */
    void (*destroy)(struct pipe_video_context *context);
 
-   /**
-    * Check if the given pipe_format is supported as a video buffer
-    */
-   boolean (*is_format_supported)(struct pipe_video_context *context,
-                                  enum pipe_format format,
-                                  enum pipe_video_profile profile);
-
    /**
     * create a surface of a texture
     */