psb_surface_ext.h revision bde3ed7517cc876cb2a6e174ea2a96a75938e787
1/*
2 * INTEL CONFIDENTIAL
3 * Copyright 2007 Intel Corporation. All Rights Reserved.
4 *
5 * The source code contained or described herein and all documents related to
6 * the source code ("Material") are owned by Intel Corporation or its suppliers
7 * or licensors. Title to the Material remains with Intel Corporation or its
8 * suppliers and licensors. The Material may contain trade secrets and
9 * proprietary and confidential information of Intel Corporation and its
10 * suppliers and licensors, and is protected by worldwide copyright and trade
11 * secret laws and treaty provisions. No part of the Material may be used,
12 * copied, reproduced, modified, published, uploaded, posted, transmitted,
13 * distributed, or disclosed in any way without Intel's prior express written
14 * permission.
15 *
16 * No license under any patent, copyright, trade secret or other intellectual
17 * property right is granted to or conferred upon you by disclosure or delivery
18 * of the Materials, either expressly, by implication, inducement, estoppel or
19 * otherwise. Any license under such intellectual property rights must be
20 * express and approved by Intel in writing.
21 */
22
23
24/*
25 * Authors:
26 *    Shengquan Yuan  <shengquan.yuan@intel.com>
27 *    Zhaohan Ren  <zhaohan.ren@intel.com>
28 *
29 */
30
31#ifndef _PSB_XVVA_H
32#define _PSB_XVVA_H
33
34#include <pthread.h>
35#include <stdint.h>
36
37
38#ifndef MAKEFOURCC
39
40#define MAKEFOURCC(ch0, ch1, ch2, ch3)                                  \
41    ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
42    ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
43
44/* a few common FourCCs */
45#define VA_FOURCC_AI44         0x34344149
46#define VA_FOURCC_UYVY          0x59565955
47#define VA_FOURCC_YUY2          0x32595559
48#define VA_FOURCC_AYUV          0x56555941
49#define VA_FOURCC_NV11          0x3131564e
50#define VA_FOURCC_YV12          0x32315659
51#define VA_FOURCC_P208          0x38303250
52#define VA_FOURCC_IYUV          0x56555949
53#define VA_FOURCC_I420          0x30323449
54
55#endif
56
57/* XvDrawable information */
58#define XVDRAWABLE_NORMAL       0x00
59#define XVDRAWABLE_PIXMAP       0x01
60#define XVDRAWABLE_ROTATE_90    0x02
61#define XVDRAWABLE_ROTATE_180   0x04
62#define XVDRAWABLE_ROTATE_270   0x08
63#define XVDRAWABLE_REDIRECT_WINDOW 0x10
64#define XVDRAWABLE_SCALE        0x20
65
66#define XVDRAWABLE_INVALID_DRAWABLE     0x8000
67
68typedef struct _PsbAYUVSample8 {
69    unsigned char     Cr;
70    unsigned char     Cb;
71    unsigned char     Y;
72    unsigned char     Alpha;
73} PsbAYUVSample8;
74
75typedef struct _VaClipBox {
76    short x;
77    short y;
78    unsigned short width;
79    unsigned short height;
80} VaClipBox;
81
82
83struct _PsbVASurface {
84    struct _PsbVASurface *next; /* next subpicture, only used by client */
85
86    struct _WsbmBufferObject *bo;
87    uint32_t bufid;
88    uint64_t pl_flags; /* placement */
89    uint32_t size;
90
91    unsigned int fourcc;
92    unsigned int planar;
93    unsigned int width;
94    unsigned int height;
95    unsigned int bytes_pp;
96    unsigned int stride;
97    unsigned int pre_add;
98    unsigned int reserved_phyaddr; /* for reserved memory, e.g. CI/RAR */
99
100    unsigned int clear_color;
101
102    unsigned int subpic_id; /* subpic id, only used by client */
103    unsigned int subpic_flags;/* flags for subpictures
104                               * #define VA_SUBPICTURE_CHROMA_KEYING    0x0001
105                               * #define VA_SUBPICTURE_GLOBAL_ALPHA     0x0002
106                                *#define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD 0x0004
107                               */
108    float global_alpha;
109    unsigned int chromakey_min;
110    unsigned int chromakey_max;
111    unsigned int chromakey_mask;
112
113    PsbAYUVSample8 *palette_ptr; /* point to image palette */
114    union {
115        uint32_t  palette[16]; /* used to pass palette to server */
116        PsbAYUVSample8  constant[16]; /* server convert palette into SGX constants */
117    };
118    int subpic_srcx;
119    int subpic_srcy;
120    int subpic_srcw;
121    int subpic_srch;
122
123    int subpic_dstx;
124    int subpic_dsty;
125    int subpic_dstw;
126    int subpic_dsth;
127
128    /* only used by server side */
129    unsigned int num_constant;
130    unsigned int *constants;
131
132    unsigned int mem_layout;
133    unsigned int tex_fmt;
134    unsigned int pack_mode;
135
136    unsigned int fragment_start;
137    unsigned int fragment_end;
138};
139
140typedef struct _PsbVASurface PsbVASurfaceRec;
141typedef struct _PsbVASurface *PsbVASurfacePtr;
142
143
144#ifndef VA_FRAME_PICTURE
145
146/* de-interlace flags for vaPutSurface */
147#define VA_FRAME_PICTURE        0x00000000
148#define VA_TOP_FIELD            0x00000001
149#define VA_BOTTOM_FIELD         0x00000002
150/*
151 * clears the drawable with background color.
152 * for hardware overlay based implementation this flag
153 * can be used to turn off the overlay
154 */
155#define VA_CLEAR_DRAWABLE       0x00000008
156
157/* color space conversion flags for vaPutSurface */
158#define VA_SRC_BT601            0x00000010
159#define VA_SRC_BT709            0x00000020
160
161#endif /* end for _VA_X11_H_ */
162
163
164
165#define PSB_SUBPIC_MAX_NUM      6
166#define PSB_CLIPBOX_MAX_NUM     6
167
168typedef struct _PsbXvVAPutSurface {
169    uint32_t flags;/* #define VA_FRAME_PICTURE 0x00000000
170                    * #define VA_TOP_FIELD     0x00000001
171                    * #define VA_BOTTOM_FIELD  0x00000002
172                    */
173    unsigned int num_subpicture;
174    unsigned int num_clipbox;
175
176    PsbVASurfaceRec dst_srf; /* filled by Xserver */
177    PsbVASurfaceRec src_srf; /* provided by VA client */
178    PsbVASurfaceRec subpic_srf[PSB_SUBPIC_MAX_NUM];
179    VaClipBox clipbox[PSB_CLIPBOX_MAX_NUM];
180} PsbXvVAPutSurfaceRec, *PsbXvVAPutSurfacePtr;
181
182#endif
183