summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nouveau_video.h
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2012-04-06 15:41:55 +0200
committerBen Skeggs <[email protected]>2012-04-14 02:56:33 +1000
commit6d1cdec3ba151168bfc3aef222fba6265dfb41fb (patch)
treec8c013eaa14e1b7463b6b3f39221524d901370f6 /src/gallium/drivers/nouveau/nouveau_video.h
parent3c7872f35f4ae439082d413ab31333cf99be7e91 (diff)
nouveau: switch to libdrm_nouveau-2.0
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_video.h')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_video.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_video.h b/src/gallium/drivers/nouveau/nouveau_video.h
index 22593ff9bbc..1d6ced035fb 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.h
+++ b/src/gallium/drivers/nouveau/nouveau_video.h
@@ -1,8 +1,11 @@
#ifndef __NOUVEAU_VIDEO_H__
-#define __NOUVEAU_SCREEN_H__
+#define __NOUVEAU_VIDEO_H__
#include "nv17_mpeg.xml.h"
#include "nv31_mpeg.xml.h"
+#include "nv_object.xml.h"
+
+#include "nouveau_winsys.h"
struct nouveau_video_buffer {
struct pipe_video_buffer base;
@@ -16,7 +19,11 @@ struct nouveau_video_buffer {
struct nouveau_decoder {
struct pipe_video_decoder base;
struct nouveau_screen *screen;
- struct nouveau_grobj *mpeg;
+ struct nouveau_pushbuf *push;
+ struct nouveau_object *chan;
+ struct nouveau_client *client;
+ struct nouveau_bufctx *bufctx;
+ struct nouveau_object *mpeg;
struct nouveau_bo *cmd_bo, *data_bo, *fence_bo;
unsigned *fence_map;
@@ -34,9 +41,56 @@ struct nouveau_decoder {
struct nouveau_video_buffer *surfaces[8];
};
+#define NV31_VIDEO_BIND_IMG(i) i
+#define NV31_VIDEO_BIND_CMD NV31_MPEG_IMAGE_Y_OFFSET__LEN
+#define NV31_VIDEO_BIND_COUNT (NV31_MPEG_IMAGE_Y_OFFSET__LEN + 1)
+
static INLINE void
nouveau_vpe_write(struct nouveau_decoder *dec, unsigned data) {
dec->cmds[dec->ofs++] = data;
}
+#define SUBC_MPEG(mthd) 1, mthd
+#define NV31_MPEG(mthd) SUBC_MPEG(NV31_MPEG_##mthd)
+#define NV84_MPEG(mthd) SUBC_MPEG(NV84_MPEG_##mthd)
+
+static INLINE uint32_t
+NV04_FIFO_PKHDR(int subc, int mthd, unsigned size)
+{
+ return 0x00000000 | (size << 18) | (subc << 13) | mthd;
+}
+
+static INLINE uint32_t
+NV04_FIFO_PKHDR_NI(int subc, int mthd, unsigned size)
+{
+ return 0x40000000 | (size << 18) | (subc << 13) | mthd;
+}
+
+static INLINE void
+BEGIN_NV04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
+{
+ PUSH_SPACE(push, size + 1);
+ PUSH_DATA (push, NV04_FIFO_PKHDR(subc, mthd, size));
+}
+
+static INLINE void
+BEGIN_NI04(struct nouveau_pushbuf *push, int subc, int mthd, unsigned size)
+{
+ PUSH_SPACE(push, size + 1);
+ PUSH_DATA (push, NV04_FIFO_PKHDR_NI(subc, mthd, size));
+}
+
+static INLINE void
+PUSH_MTHDl(struct nouveau_pushbuf *push, int subc, int mthd,
+ struct nouveau_bo *bo, uint32_t offset,
+ struct nouveau_bufctx *ctx, int bin, uint32_t rw)
+{
+ nouveau_bufctx_mthd(ctx, bin, NV04_FIFO_PKHDR(subc, mthd, 1),
+ bo, offset,
+ NOUVEAU_BO_LOW | (bo->flags & NOUVEAU_BO_APER) | rw,
+ 0, 0);
+
+ PUSH_DATA(push, bo->offset + offset);
+}
+
#endif