[g3dvl] add some more PIPE_VIDEO_CAPs

This commit is contained in:
Christian König
2011-07-12 00:12:12 +02:00
parent df5e0b9435
commit efc7fda462
10 changed files with 79 additions and 27 deletions
+12
View File
@@ -32,6 +32,18 @@
#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,
+6
View File
@@ -31,6 +31,12 @@
#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
*/
@@ -88,6 +88,16 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,
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)
{
@@ -54,6 +54,12 @@ struct vl_video_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
+6
View File
@@ -3,6 +3,7 @@
#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"
@@ -213,8 +214,13 @@ nvfx_screen_get_video_param(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 0;
case PIPE_VIDEO_CAP_MAX_WIDTH:
case PIPE_VIDEO_CAP_MAX_HEIGHT:
return vl_video_buffer_max_size(screen);
default:
return 0;
}
+12 -6
View File
@@ -25,6 +25,7 @@
#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"
@@ -307,12 +308,17 @@ static int r300_get_video_param(struct pipe_screen *screen,
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,
+5
View File
@@ -491,8 +491,13 @@ static int r600_get_video_param(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;
}
+6
View File
@@ -33,6 +33,7 @@
#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"
@@ -177,8 +178,13 @@ softpipe_get_video_param(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 0;
case PIPE_VIDEO_CAP_MAX_WIDTH:
case PIPE_VIDEO_CAP_MAX_HEIGHT:
return vl_video_buffer_max_size(screen);
default:
return 0;
}
+4 -1
View File
@@ -496,7 +496,10 @@ enum pipe_shader_cap
/* 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
+12 -20
View File
@@ -128,11 +128,7 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
{
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");
@@ -152,24 +148,20 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
*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;
}