summaryrefslogtreecommitdiff
path: root/src/via_mpeg.h
blob: c56d8b3f350d284cf711191ecc042cf8274da689 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Copyright 2006-2009 Luc Verhaegen <libv@skynet.be>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sub license,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

/*
 * Unichrome MPEG acceleration, driver side support.
 *
 */
#ifndef HAVE_VIA_MPEG_H
#define HAVE_VIA_MPEG_H 1

#define FOURCC_MPEG (('G' << 24) | ('E' << 16) | ('P' << 8) | 'M')

/* xine seems to need at least 8, engine can only handle 4,
 * so we keep the others in limbo in the FB. */
#define VIAMPEG_BUFFERS_MAX 16

struct ViaMpeg {
    int scrnIndex;

    XID ContextID; /* The XvMC way. */
    CARD16 Width;
    CARD16 Height;
    CARD16 MBWidth;
    CARD16 MBHeight;

    XID CurrentID;
    XID FlippingID;
    XID FRefID;
    XID BRefID;

    struct {
	XID ID;
        struct ViaMem *Mem;
    } Buffers[VIAMPEG_BUFFERS_MAX];

    /* Provide direct register access */
    struct ViaMpegRegs *Regs;
};

/*
 *
 */
struct ViaSubPicture {
    int scrnIndex;

    CARD16 Width;
    CARD16 Height;

    struct ViaMem *Mem;

    struct ViaSubPictureRegs *Regs;
};

/* from via_mpeg.c, to allow via_video.c to sync this engine */
void ViaMpegEngineIdle(struct ViaMpeg *Mpeg);

/* from via_video.c, to allow via_mpeg.c to sync this engine */
void ViaHQVIdle(struct ViaSwov *Swov);

/* from via_video.c - to copy over the SubPicture */
Bool ViaSwovCopy(ScrnInfoPtr pScrn, struct ViaMem *Mem, unsigned char *Buffer);

/* Function prototypes for via_video.c */
void ViaSubPictureInit(ScrnInfoPtr pScrn);
void ViaSubPictureStop(ScrnInfoPtr pScrn);
void ViaSubPictureDestroy(ScrnInfoPtr pScrn);

void ViaMpegInit(ScrnInfoPtr pScrn);
void ViaMpegStop(ScrnInfoPtr pScrn);
void ViaMpegDestroy(ScrnInfoPtr pScrn);
Bool ViaMpegBufferIDVerify(struct ViaMpeg *Mpeg, XID BufferID,
			   int Width, int Height);
unsigned long ViaMpegBufferFlip(struct ViaMpeg *Mpeg, XID BufferID);

/* prototypes for the X extension. */
Bool ViaMpegEngineInit(struct ViaMpeg *Mpeg, CARD16 Width, CARD16 Height);
Bool ViaMpegBufferGrab(struct ViaMpeg *Mpeg, XID BufferID);
void ViaMpegBufferRelease(struct ViaMpeg *Mpeg, XID BufferID);
int ViaMpegSliceInit(struct ViaMpeg *Mpeg, XID BufferID, XID FRefID, XID BRefID,
		     CARD8 F_MV_Range, CARD8 B_MV_Range, CARD8 PictureStructure,
		     CARD8 PictureCoding, CARD8 IntraDCPrecision, CARD8 Flags);
int ViaMpegSlicePut(struct ViaMpeg *Mpeg, XID BufferID, CARD8 SliceCode,
		    CARD32 SliceLength, CARD8 *Slice);

#endif /* HAVE_VIA_MPEG_H */