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,
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;
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;
};
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:
}
}
+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)
{
* 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
#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"
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;
#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"
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;
#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"
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;
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.
*/
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
*/