Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nouveau_video.h
4570 views
#ifndef __NOUVEAU_VIDEO_H__1#define __NOUVEAU_VIDEO_H__23#include "nv17_mpeg.xml.h"4#include "nv31_mpeg.xml.h"5#include "nv_object.xml.h"67#include "nouveau_winsys.h"89struct nouveau_video_buffer {10struct pipe_video_buffer base;11unsigned num_planes;12struct pipe_resource *resources[VL_NUM_COMPONENTS];13struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS];14struct pipe_sampler_view *sampler_view_components[VL_NUM_COMPONENTS];15struct pipe_surface *surfaces[VL_NUM_COMPONENTS * 2];16};1718struct nouveau_decoder {19struct pipe_video_codec base;20struct nouveau_screen *screen;21struct nouveau_pushbuf *push;22struct nouveau_object *chan;23struct nouveau_client *client;24struct nouveau_bufctx *bufctx;25struct nouveau_object *mpeg;26struct nouveau_bo *cmd_bo, *data_bo, *fence_bo;2728unsigned *fence_map;29unsigned fence_seq;3031unsigned ofs;32unsigned *cmds;3334unsigned *data;35unsigned data_pos;36unsigned picture_structure;3738unsigned past, future, current;39unsigned num_surfaces;40struct nouveau_video_buffer *surfaces[8];41};4243#define NV31_VIDEO_BIND_IMG(i) i44#define NV31_VIDEO_BIND_CMD NV31_MPEG_IMAGE_Y_OFFSET__LEN45#define NV31_VIDEO_BIND_COUNT (NV31_MPEG_IMAGE_Y_OFFSET__LEN + 1)4647static inline void48nouveau_vpe_write(struct nouveau_decoder *dec, unsigned data) {49dec->cmds[dec->ofs++] = data;50}5152#define SUBC_MPEG(mthd) 1, mthd53#define NV31_MPEG(mthd) SUBC_MPEG(NV31_MPEG_##mthd)54#define NV84_MPEG(mthd) SUBC_MPEG(NV84_MPEG_##mthd)5556static inline uint32_t57NV04_FIFO_PKHDR(int subc, int mthd, unsigned size)58{59return 0x00000000 | (size << 18) | (subc << 13) | mthd;60}6162static inline uint32_t63NV04_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)64{65return 0x40000000 | (size << 18) | (subc << 13) | mthd;66}6768static inline void69BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)70{71PUSH_SPACE(push, size + 1);72PUSH_DATA (push, NV04_FIFO_PKHDR(subc, mthd, size));73}7475static inline void76BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)77{78PUSH_SPACE(push, size + 1);79PUSH_DATA (push, NV04_FIFO_PKHDR_NI(subc, mthd, size));80}8182static inline void83PUSH_MTHDl(struct nouveau_pushbuf *push, int subc, int mthd,84struct nouveau_bo *bo, uint32_t offset,85struct nouveau_bufctx *ctx, int bin, uint32_t rw)86{87nouveau_bufctx_mthd(ctx, bin, NV04_FIFO_PKHDR(subc, mthd, 1),88bo, offset,89NOUVEAU_BO_LOW | (bo->flags & NOUVEAU_BO_APER) | rw,900, 0);9192PUSH_DATA(push, bo->offset + offset);93}9495#endif969798