1/*
2 * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 *    Shengquan Yuan  <shengquan.yuan@intel.com>
26 *    Zhaohan Ren  <zhaohan.ren@intel.com>
27 *
28 */
29
30
31
32#ifndef _PSB_X11_H_
33#define _PSB_X11_H_
34
35#include <X11/Xutil.h>
36
37#include <inttypes.h>
38#include "psb_drv_video.h"
39#include "psb_drm.h"
40#include "psb_surface.h"
41#include "psb_output.h"
42#include "psb_surface_ext.h"
43
44#include <va/va.h>
45
46#define USING_OVERLAY_PORT  1
47#define USING_TEXTURE_PORT  2
48
49typedef struct {
50    /*src coordinate*/
51    short srcx;
52    short srcy;
53    unsigned short sWidth;
54    unsigned short sHeight;
55    /*dest coordinate*/
56    short destx;
57    short desty;
58    unsigned short dWidth;
59    unsigned short dHeight;
60} psb_overlay_rect_t, *psb_overlay_rect_p;
61
62typedef struct {
63    int                 i32Left;
64    int                 i32Top;
65    int                 i32Right;
66    int                 i32Bottom;
67    unsigned int        ui32Width;
68    unsigned int        ui32Height;
69} psb_x11_win_t;
70
71typedef struct x11_rect_list {
72    psb_x11_win_t     rect;
73    struct x11_rect_list * next;
74} psb_x11_clip_list_t;
75
76typedef struct _psb_x11_output_s {
77    /* information for xvideo */
78    XvPortID textured_portID;
79    XvPortID overlay_portID;
80    XvImage *textured_xvimage;
81    XvImage *overlay_xvimage;
82    PsbXvVAPutSurfaceRec        imgdata_vasrf;
83    GC                          gc;
84    Drawable                    output_drawable;
85    int                         is_pixmap;
86    Drawable                    output_drawable_save;
87    GC                          extend_gc;
88    Drawable                    extend_drawable;
89    unsigned short              output_width;
90    unsigned short              output_height;
91    int                         using_port;
92
93    int bIsVisible;
94    psb_x11_win_t winRect;
95    psb_x11_clip_list_t *pClipBoxList;
96    unsigned int ui32NumClipBoxList;
97    unsigned int frame_count;
98
99    int ignore_dpm;
100
101    /*for video rotation with overlay adaptor*/
102    psb_surface_p rotate_surface;
103    int rotate_surfaceID;
104    int rotate;
105    unsigned int sprite_enabled;
106
107} psb_x11_output_s, *psb_x11_output_p;
108
109VAStatus psb_putsurface_coverlay(
110    VADriverContextP ctx,
111    VASurfaceID surface,
112    Drawable draw, /* X Drawable */
113    short srcx,
114    short srcy,
115    unsigned short srcw,
116    unsigned short srch,
117    short destx,
118    short desty,
119    unsigned short destw,
120    unsigned short desth,
121    VARectangle *cliprects, /* client supplied clip list */
122    unsigned int number_cliprects, /* number of clip rects in the clip list */
123    unsigned int flags /* de-interlacing flags */
124);
125
126
127VAStatus psb_putsurface_xvideo(
128    VADriverContextP ctx,
129    VASurfaceID surface,
130    Drawable draw,
131    short srcx,
132    short srcy,
133    unsigned short srcw,
134    unsigned short srch,
135    short destx,
136    short desty,
137    unsigned short destw,
138    unsigned short desth,
139    VARectangle *cliprects, /* client supplied clip list */
140    unsigned int number_cliprects, /* number of clip rects in the clip list */
141    unsigned int flags /* de-interlacing flags */
142);
143
144VAStatus psb_putsurface_ctexture(
145    VADriverContextP ctx,
146    VASurfaceID surface,
147    Drawable draw,
148    short srcx,
149    short srcy,
150    unsigned short srcw,
151    unsigned short srch,
152    short destx,
153    short desty,
154    unsigned short destw,
155    unsigned short desth,
156    unsigned int flags /* de-interlacing flags */
157);
158
159VAStatus psb_init_xvideo(VADriverContextP ctx, psb_x11_output_p output);
160VAStatus psb_deinit_xvideo(VADriverContextP ctx);
161
162#endif
163