1 #ifndef __NOUVEAU_VIDEO_H__
2 #define __NOUVEAU_VIDEO_H__
4 #include "nv17_mpeg.xml.h"
5 #include "nv31_mpeg.xml.h"
6 #include "nv_object.xml.h"
8 #include "nouveau_winsys.h"
10 struct nouveau_video_buffer
{
11 struct pipe_video_buffer base
;
13 struct pipe_resource
*resources
[VL_NUM_COMPONENTS
];
14 struct pipe_sampler_view
*sampler_view_planes
[VL_NUM_COMPONENTS
];
15 struct pipe_sampler_view
*sampler_view_components
[VL_NUM_COMPONENTS
];
16 struct pipe_surface
*surfaces
[VL_NUM_COMPONENTS
* 2];
19 struct nouveau_decoder
{
20 struct pipe_video_codec base
;
21 struct nouveau_screen
*screen
;
22 struct nouveau_pushbuf
*push
;
23 struct nouveau_object
*chan
;
24 struct nouveau_client
*client
;
25 struct nouveau_bufctx
*bufctx
;
26 struct nouveau_object
*mpeg
;
27 struct nouveau_bo
*cmd_bo
, *data_bo
, *fence_bo
;
37 unsigned picture_structure
;
39 unsigned past
, future
, current
;
40 unsigned num_surfaces
;
41 struct nouveau_video_buffer
*surfaces
[8];
44 #define NV31_VIDEO_BIND_IMG(i) i
45 #define NV31_VIDEO_BIND_CMD NV31_MPEG_IMAGE_Y_OFFSET__LEN
46 #define NV31_VIDEO_BIND_COUNT (NV31_MPEG_IMAGE_Y_OFFSET__LEN + 1)
49 nouveau_vpe_write(struct nouveau_decoder
*dec
, unsigned data
) {
50 dec
->cmds
[dec
->ofs
++] = data
;
53 #define SUBC_MPEG(mthd) 1, mthd
54 #define NV31_MPEG(mthd) SUBC_MPEG(NV31_MPEG_##mthd)
55 #define NV84_MPEG(mthd) SUBC_MPEG(NV84_MPEG_##mthd)
57 static inline uint32_t
58 NV04_FIFO_PKHDR(int subc
, int mthd
, unsigned size
)
60 return 0x00000000 | (size
<< 18) | (subc
<< 13) | mthd
;
63 static inline uint32_t
64 NV04_FIFO_PKHDR_NI(int subc
, int mthd
, unsigned size
)
66 return 0x40000000 | (size
<< 18) | (subc
<< 13) | mthd
;
70 BEGIN_NV04(struct nouveau_pushbuf
*push
, int subc
, int mthd
, unsigned size
)
72 PUSH_SPACE(push
, size
+ 1);
73 PUSH_DATA (push
, NV04_FIFO_PKHDR(subc
, mthd
, size
));
77 BEGIN_NI04(struct nouveau_pushbuf
*push
, int subc
, int mthd
, unsigned size
)
79 PUSH_SPACE(push
, size
+ 1);
80 PUSH_DATA (push
, NV04_FIFO_PKHDR_NI(subc
, mthd
, size
));
84 PUSH_MTHDl(struct nouveau_pushbuf
*push
, int subc
, int mthd
,
85 struct nouveau_bo
*bo
, uint32_t offset
,
86 struct nouveau_bufctx
*ctx
, int bin
, uint32_t rw
)
88 nouveau_bufctx_mthd(ctx
, bin
, NV04_FIFO_PKHDR(subc
, mthd
, 1),
90 NOUVEAU_BO_LOW
| (bo
->flags
& NOUVEAU_BO_APER
) | rw
,
93 PUSH_DATA(push
, bo
->offset
+ offset
);