nvc0: move video param and format support functions to nouveau

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
Ilia Mirkin 2013-08-10 18:02:49 -04:00 committed by Maarten Lankhorst
parent 9255019a53
commit 4ea191fb2d
5 changed files with 76 additions and 70 deletions

View file

@ -327,3 +327,65 @@ nouveau_vp3_load_firmware(struct nouveau_vp3_decoder *dec,
dec->fw_bo->map = NULL;
return 0;
}
int
nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
enum pipe_video_profile profile,
enum pipe_video_cap param)
{
switch (param) {
case PIPE_VIDEO_CAP_SUPPORTED:
return profile >= PIPE_VIDEO_PROFILE_MPEG1;
case PIPE_VIDEO_CAP_NPOT_TEXTURES:
return 1;
case PIPE_VIDEO_CAP_MAX_WIDTH:
case PIPE_VIDEO_CAP_MAX_HEIGHT:
return nouveau_screen(pscreen)->device->chipset < 0xd0 ? 2048 : 4096;
case PIPE_VIDEO_CAP_PREFERED_FORMAT:
return PIPE_FORMAT_NV12;
case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
return true;
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;
}
default:
debug_printf("unknown video param: %d\n", param);
return 0;
}
}
boolean
nouveau_vp3_screen_video_supported(struct pipe_screen *screen,
enum pipe_format format,
enum pipe_video_profile profile)
{
if (profile != PIPE_VIDEO_PROFILE_UNKNOWN)
return format == PIPE_FORMAT_NV12;
return vl_video_buffer_is_format_supported(screen, format, profile);
}

View file

@ -216,3 +216,13 @@ nouveau_vp3_vp_caps(struct nouveau_vp3_decoder *dec, union pipe_desc desc,
struct nouveau_vp3_video_buffer *target, unsigned comm_seq,
unsigned *caps, unsigned *is_ref,
struct nouveau_vp3_video_buffer *refs[16]);
int
nouveau_vp3_screen_get_video_param(struct pipe_screen *pscreen,
enum pipe_video_profile profile,
enum pipe_video_cap param);
boolean
nouveau_vp3_screen_video_supported(struct pipe_screen *screen,
enum pipe_format format,
enum pipe_video_profile profile);

View file

@ -346,11 +346,6 @@ struct pipe_video_buffer *
nvc0_video_buffer_create(struct pipe_context *pipe,
const struct pipe_video_buffer *templat);
int
nvc0_screen_get_video_param(struct pipe_screen *pscreen,
enum pipe_video_profile profile,
enum pipe_video_cap param);
/* nvc0_push.c */
void nvc0_push_vbo(struct nvc0_context *, const struct pipe_draw_info *);

View file

@ -27,6 +27,8 @@
#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
#include "nouveau/nouveau_vp3_video.h"
#include "nvc0_context.h"
#include "nvc0_screen.h"
@ -63,18 +65,6 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
return (nvc0_format_table[format].usage & bindings) == bindings;
}
static boolean
nvc0_screen_video_supported(struct pipe_screen *screen,
enum pipe_format format,
enum pipe_video_profile profile)
{
if (profile != PIPE_VIDEO_PROFILE_UNKNOWN)
return format == PIPE_FORMAT_NV12;
return vl_video_buffer_is_format_supported(screen, format, profile);
}
static int
nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
{
@ -593,8 +583,8 @@ nvc0_screen_create(struct nouveau_device *dev)
nvc0_screen_init_resource_functions(pscreen);
screen->base.base.get_video_param = nvc0_screen_get_video_param;
screen->base.base.is_video_format_supported = nvc0_screen_video_supported;
screen->base.base.get_video_param = nouveau_vp3_screen_get_video_param;
screen->base.base.is_video_format_supported = nouveau_vp3_screen_video_supported;
ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, 4096, NULL,
&screen->fence.bo);

View file

@ -25,57 +25,6 @@
#include "util/u_sampler.h"
#include "util/u_format.h"
int
nvc0_screen_get_video_param(struct pipe_screen *pscreen,
enum pipe_video_profile profile,
enum pipe_video_cap param)
{
switch (param) {
case PIPE_VIDEO_CAP_SUPPORTED:
return profile >= PIPE_VIDEO_PROFILE_MPEG1;
case PIPE_VIDEO_CAP_NPOT_TEXTURES:
return 1;
case PIPE_VIDEO_CAP_MAX_WIDTH:
case PIPE_VIDEO_CAP_MAX_HEIGHT:
return nouveau_screen(pscreen)->device->chipset < 0xd0 ? 2048 : 4096;
case PIPE_VIDEO_CAP_PREFERED_FORMAT:
return PIPE_FORMAT_NV12;
case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
return true;
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;
}
default:
debug_printf("unknown video param: %d\n", param);
return 0;
}
}
static void
nvc0_decoder_decode_bitstream(struct pipe_video_decoder *decoder,
struct pipe_video_buffer *video_target,