| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef NV84_VIDEO_H_ |
| 24 |
#define NV84_VIDEO_H_ |
| 25 |
|
| 26 |
#include "vl/vl_video_buffer.h" |
| 27 |
#include "vl/vl_types.h" |
| 28 |
|
| 29 |
#include "vl/vl_mpeg12_bitstream.h" |
| 30 |
|
| 31 |
#include "util/u_video.h" |
| 32 |
|
| 33 |
#include "nv50/nv50_context.h" |
| 34 |
|
| 35 |
|
| 36 |
#define SUBC_BSP(m) 2, (m) |
| 37 |
#define SUBC_VP(m) 2, (m) |
| 38 |
|
| 39 |
union pipe_desc { |
| 40 |
struct pipe_picture_desc *base; |
| 41 |
struct pipe_mpeg12_picture_desc *mpeg12; |
| 42 |
struct pipe_vc1_picture_desc *vc1; |
| 43 |
struct pipe_h264_picture_desc *h264; |
| 44 |
}; |
| 45 |
|
| 46 |
struct nv84_video_buffer { |
| 47 |
struct pipe_video_buffer base; |
| 48 |
struct pipe_resource *resources[VL_NUM_COMPONENTS]; |
| 49 |
struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS]; |
| 50 |
struct pipe_sampler_view *sampler_view_components[VL_NUM_COMPONENTS]; |
| 51 |
struct pipe_surface surfaces[VL_NUM_COMPONENTS * 2]; |
| 52 |
|
| 53 |
struct nouveau_bo *interlaced, *full; |
| 54 |
int mvidx; |
| 55 |
unsigned frame_num, frame_num_max; |
| 56 |
}; |
| 57 |
|
| 58 |
struct nv84_decoder { |
| 59 |
struct pipe_video_codec base; |
| 60 |
struct nouveau_client *client; |
| 61 |
struct nouveau_object *bsp_channel, *vp_channel, *bsp, *vp; |
| 62 |
struct nouveau_pushbuf *bsp_pushbuf, *vp_pushbuf; |
| 63 |
struct nouveau_bufctx *bsp_bufctx, *vp_bufctx; |
| 64 |
|
| 65 |
struct nouveau_bo *bsp_fw, *bsp_data; |
| 66 |
struct nouveau_bo *vp_fw, *vp_data; |
| 67 |
struct nouveau_bo *mbring, *vpring; |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
struct nouveau_bo *fence; |
| 77 |
|
| 78 |
struct nouveau_bo *bitstream; |
| 79 |
struct nouveau_bo *vp_params; |
| 80 |
|
| 81 |
size_t vp_fw2_offset; |
| 82 |
|
| 83 |
unsigned frame_mbs, frame_size; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
unsigned vpring_deblock, vpring_residual, vpring_ctrl; |
| 91 |
|
| 92 |
|
| 93 |
struct vl_mpg12_bs *mpeg12_bs; |
| 94 |
|
| 95 |
struct nouveau_bo *mpeg12_bo; |
| 96 |
void *mpeg12_mb_info; |
| 97 |
uint16_t *mpeg12_data; |
| 98 |
const int *zscan; |
| 99 |
uint8_t mpeg12_intra_matrix[64]; |
| 100 |
uint8_t mpeg12_non_intra_matrix[64]; |
| 101 |
}; |
| 102 |
|
| 103 |
static inline uint32_t mb(uint32_t coord) |
| 104 |
{ |
| 105 |
return (coord + 0xf)>>4; |
| 106 |
} |
| 107 |
|
| 108 |
static inline uint32_t mb_half(uint32_t coord) |
| 109 |
{ |
| 110 |
return (coord + 0x1f)>>5; |
| 111 |
} |
| 112 |
|
| 113 |
int |
| 114 |
nv84_decoder_bsp(struct nv84_decoder *dec, |
| 115 |
struct pipe_h264_picture_desc *desc, |
| 116 |
unsigned num_buffers, |
| 117 |
const void *const *data, |
| 118 |
const unsigned *num_bytes, |
| 119 |
struct nv84_video_buffer *dest); |
| 120 |
|
| 121 |
void |
| 122 |
nv84_decoder_vp_h264(struct nv84_decoder *dec, |
| 123 |
struct pipe_h264_picture_desc *desc, |
| 124 |
struct nv84_video_buffer *dest); |
| 125 |
|
| 126 |
void |
| 127 |
nv84_decoder_vp_mpeg12_mb(struct nv84_decoder *dec, |
| 128 |
struct pipe_mpeg12_picture_desc *desc, |
| 129 |
const struct pipe_mpeg12_macroblock *mb); |
| 130 |
|
| 131 |
void |
| 132 |
nv84_decoder_vp_mpeg12(struct nv84_decoder *dec, |
| 133 |
struct pipe_mpeg12_picture_desc *desc, |
| 134 |
struct nv84_video_buffer *dest); |
| 135 |
|
| 136 |
#endif |