X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnouveau%2Fnouveau_vp3_video.h;h=809e971a67824cec719fe14d64b6d4d8e1f16a37;hb=c35e926a81bada062404acbd18727bf83d3cf5be;hp=7322138623a46f44b61c7739d0f8d2f3f4435b3f;hpb=d6a82a7747a983cc1bd617e9a6e34fc422d1ec10;p=mesa.git diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.h b/src/gallium/drivers/nouveau/nouveau_vp3_video.h index 7322138623a..809e971a678 100644 --- a/src/gallium/drivers/nouveau/nouveau_vp3_video.h +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.h @@ -20,10 +20,10 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "pipe/p_defines.h" +#include +#include "pipe/p_defines.h" #include "vl/vl_video_buffer.h" - #include "util/u_video.h" struct nouveau_vp3_video_buffer { @@ -39,6 +39,8 @@ struct nouveau_vp3_video_buffer { #define VP_OFFSET 0x200 #define COMM_OFFSET 0x500 +#define NOUVEAU_VP3_BSP_RESERVED_SIZE 0x700 + #define NOUVEAU_VP3_DEBUG_FENCE 0 #if NOUVEAU_VP3_DEBUG_FENCE @@ -60,7 +62,7 @@ union pipe_desc { }; struct nouveau_vp3_decoder { - struct pipe_video_decoder base; + struct pipe_video_codec base; struct nouveau_client *client; struct nouveau_object *channel[3], *bsp, *vp, *ppp; struct nouveau_pushbuf *pushbuf[3]; @@ -107,47 +109,53 @@ struct nouveau_vp3_decoder { unsigned field_pic_flag : 1; unsigned decoded_top : 1; unsigned decoded_bottom : 1; + unsigned decoded_first : 1; } refs[17]; unsigned fence_seq, fw_sizes, last_frame_num, tmp_stride, ref_stride; unsigned bsp_idx, vp_idx, ppp_idx; + + /* End of the bsp bo where new data should be appended between one begin/end + * frame. + */ + char *bsp_ptr; }; struct comm { - uint32_t bsp_cur_index; // 000 - uint32_t byte_ofs; // 004 - uint32_t status[0x10]; // 008 - uint32_t pos[0x10]; // 048 - uint8_t pad[0x100 - 0x88]; // 0a0 bool comm_encrypted - - uint32_t pvp_cur_index; // 100 - uint32_t acked_byte_ofs; // 104 - uint32_t status_vp[0x10]; // 108 - uint16_t mb_y[0x10]; //148 - uint32_t pvp_stage; // 168 0xeeXX - uint16_t parse_endpos_index; // 16c - uint16_t irq_index; // 16e - uint8_t irq_470[0x10]; // 170 - uint32_t irq_pos[0x10]; // 180 - uint32_t parse_endpos[0x10]; // 1c0 + uint32_t bsp_cur_index; // 000 + uint32_t byte_ofs; // 004 + uint32_t status[0x10]; // 008 + uint32_t pos[0x10]; // 048 + uint8_t pad[0x100 - 0x88]; // 0a0 bool comm_encrypted + + uint32_t pvp_cur_index; // 100 + uint32_t acked_byte_ofs; // 104 + uint32_t status_vp[0x10]; // 108 + uint16_t mb_y[0x10]; //148 + uint32_t pvp_stage; // 168 0xeeXX + uint16_t parse_endpos_index; // 16c + uint16_t irq_index; // 16e + uint8_t irq_470[0x10]; // 170 + uint32_t irq_pos[0x10]; // 180 + uint32_t parse_endpos[0x10]; // 1c0 }; -static INLINE uint32_t nouveau_vp3_video_align(uint32_t h) +static inline uint32_t nouveau_vp3_video_align(uint32_t h) { return ((h+0x3f)&~0x3f); }; -static INLINE uint32_t mb(uint32_t coord) +static inline uint32_t mb(uint32_t coord) { return (coord + 0xf)>>4; } -static INLINE uint32_t mb_half(uint32_t coord) +static inline uint32_t mb_half(uint32_t coord) { return (coord + 0x1f)>>5; } -static INLINE uint64_t +static inline uint64_t nouveau_vp3_video_addr(struct nouveau_vp3_decoder *dec, struct nouveau_vp3_video_buffer *target) { uint64_t ret; @@ -158,7 +166,7 @@ nouveau_vp3_video_addr(struct nouveau_vp3_decoder *dec, struct nouveau_vp3_video return dec->ref_bo->offset + ret; } -static INLINE void +static inline void nouveau_vp3_ycbcr_offsets(struct nouveau_vp3_decoder *dec, uint32_t *y2, uint32_t *cbcr, uint32_t *cbcr2) { @@ -179,13 +187,13 @@ nouveau_vp3_ycbcr_offsets(struct nouveau_vp3_decoder *dec, uint32_t *y2, } } -static INLINE void +static inline void nouveau_vp3_inter_sizes(struct nouveau_vp3_decoder *dec, uint32_t slice_count, uint32_t *slice_size, uint32_t *bucket_size, uint32_t *ring_size) { *slice_size = (SLICE_SIZE * slice_count)>>8; - if (u_reduce_video_profile(dec->base.profile) == PIPE_VIDEO_CODEC_MPEG12) + if (u_reduce_video_profile(dec->base.profile) == PIPE_VIDEO_FORMAT_MPEG12) *bucket_size = 0; else *bucket_size = mb(dec->base.width) * 3; @@ -196,3 +204,39 @@ struct pipe_video_buffer * nouveau_vp3_video_buffer_create(struct pipe_context *pipe, const struct pipe_video_buffer *templat, int flags); + +void +nouveau_vp3_decoder_init_common(struct pipe_video_codec *decoder); + +int +nouveau_vp3_load_firmware(struct nouveau_vp3_decoder *dec, + enum pipe_video_profile profile, + unsigned chipset); + +void +nouveau_vp3_bsp_begin(struct nouveau_vp3_decoder *dec); + +void +nouveau_vp3_bsp_next(struct nouveau_vp3_decoder *dec, unsigned num_buffers, + const void *const *data, const unsigned *num_bytes); + +uint32_t +nouveau_vp3_bsp_end(struct nouveau_vp3_decoder *dec, union pipe_desc desc); + +void +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_entrypoint entrypoint, + enum pipe_video_cap param); + +boolean +nouveau_vp3_screen_video_supported(struct pipe_screen *screen, + enum pipe_format format, + enum pipe_video_profile profile, + enum pipe_video_entrypoint entrypoint);