#include "vl_decoder.h"
#include "vl_mpeg12_decoder.h"
+bool
+vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
+{
+ assert(screen);
+ switch (u_reduce_video_profile(profile)) {
+ case PIPE_VIDEO_CODEC_MPEG12:
+ return true;
+ default:
+ return false;
+ }
+}
+
struct pipe_video_decoder *
vl_create_decoder(struct pipe_context *pipe,
enum pipe_video_profile profile,
#include <pipe/p_video_decoder.h>
+/**
+ * check if a given profile is supported with shader based decoding
+ */
+bool
+vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
+
/**
* standard implementation of pipe->create_video_decoder
*/
return true;
}
+unsigned
+vl_video_buffer_max_size(struct pipe_screen *screen)
+{
+ uint32_t max_2d_texture_level;
+
+ max_2d_texture_level = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+
+ return 1 << (max_2d_texture_level-1);
+}
+
static void
vl_video_buffer_destroy(struct pipe_video_buffer *buffer)
{
const enum pipe_format *
vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format);
+/**
+ * get maximum size of video buffers
+ */
+unsigned
+vl_video_buffer_max_size(struct pipe_screen *screen);
+
/**
* check if video buffer format is supported for a codec/profile
* can be used as default implementation of screen->is_video_format_supported
#include "util/u_format.h"
#include "util/u_format_s3tc.h"
#include "util/u_simple_screen.h"
+#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
#include "nouveau/nouveau_screen.h"
enum pipe_video_cap param)
{
switch (param) {
+ case PIPE_VIDEO_CAP_SUPPORTED:
+ return vl_profile_supported(screen, profile);
case PIPE_VIDEO_CAP_NPOT_TEXTURES:
return 0;
+ case PIPE_VIDEO_CAP_MAX_WIDTH:
+ case PIPE_VIDEO_CAP_MAX_HEIGHT:
+ return vl_video_buffer_max_size(screen);
default:
return 0;
}
#include "util/u_format_s3tc.h"
#include "util/u_memory.h"
#include "os/os_time.h"
+#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
#include "r300_context.h"
enum pipe_video_profile profile,
enum pipe_video_cap param)
{
- switch (param) {
- case PIPE_VIDEO_CAP_NPOT_TEXTURES:
- return 0;
- default:
- return 0;
- }
+ switch (param) {
+ case PIPE_VIDEO_CAP_SUPPORTED:
+ return vl_profile_supported(screen, profile);
+ case PIPE_VIDEO_CAP_NPOT_TEXTURES:
+ return 0;
+ case PIPE_VIDEO_CAP_MAX_WIDTH:
+ case PIPE_VIDEO_CAP_MAX_HEIGHT:
+ return vl_video_buffer_max_size(screen);
+ default:
+ return 0;
+ }
}
static boolean r300_is_format_supported(struct pipe_screen* screen,
enum pipe_video_cap param)
{
switch (param) {
+ case PIPE_VIDEO_CAP_SUPPORTED:
+ return vl_profile_supported(screen, profile);
case PIPE_VIDEO_CAP_NPOT_TEXTURES:
return 1;
+ case PIPE_VIDEO_CAP_MAX_WIDTH:
+ case PIPE_VIDEO_CAP_MAX_HEIGHT:
+ return vl_video_buffer_max_size(screen);
default:
return 0;
}
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
#include "draw/draw_context.h"
+#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
#include "state_tracker/sw_winsys.h"
enum pipe_video_cap param)
{
switch (param) {
+ case PIPE_VIDEO_CAP_SUPPORTED:
+ return vl_profile_supported(screen, profile);
case PIPE_VIDEO_CAP_NPOT_TEXTURES:
return 0;
+ case PIPE_VIDEO_CAP_MAX_WIDTH:
+ case PIPE_VIDEO_CAP_MAX_HEIGHT:
+ return vl_video_buffer_max_size(screen);
default:
return 0;
}
/* Video caps, can be different for each codec/profile */
enum pipe_video_cap
{
- PIPE_VIDEO_CAP_NPOT_TEXTURES = 0,
+ PIPE_VIDEO_CAP_SUPPORTED = 0,
+ PIPE_VIDEO_CAP_NPOT_TEXTURES = 1,
+ PIPE_VIDEO_CAP_MAX_WIDTH = 2,
+ PIPE_VIDEO_CAP_MAX_HEIGHT = 3,
};
enum pipe_video_codec
{
vlVdpDevice *dev;
struct pipe_screen *pscreen;
-
enum pipe_video_profile p_profile;
- uint32_t max_decode_width;
- uint32_t max_decode_height;
- uint32_t max_2d_texture_level;
VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying decoder\n");
*is_supported = false;
return VDP_STATUS_OK;
}
-
- if (p_profile != PIPE_VIDEO_PROFILE_MPEG2_SIMPLE && p_profile != PIPE_VIDEO_PROFILE_MPEG2_MAIN) {
- *is_supported = false;
- return VDP_STATUS_OK;
+
+ *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_macroblocks = (*max_width/16)*(*max_height/16);
+ } else {
+ *max_width = 0;
+ *max_height = 0;
+ *max_level = 0;
+ *max_macroblocks = 0;
}
- /* XXX hack, need to implement something more sane when the decoders have been implemented */
- max_2d_texture_level = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
- max_decode_width = max_decode_height = pow(2,max_2d_texture_level-2);
- if (!(max_decode_width && max_decode_height))
- return VDP_STATUS_RESOURCES;
-
- *is_supported = true;
- *max_width = max_decode_width;
- *max_height = max_decode_height;
- *max_level = 16;
- *max_macroblocks = (max_decode_width/16) * (max_decode_height/16);
-
return VDP_STATUS_OK;
}