vmwgfx_saa_priv.h revision 3bfa90b6
1/*
2 * Copyright 2011 VMWare, Inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * Author: Thomas Hellstrom <thellstrom@vmware.com>
26 */
27#ifndef _VMWGFX_SAA_PRIV_H_
28#define _VMWGFX_SAA_PRIV_H_
29
30#define VMWGFX_PIX_MALLOC  (1 << 0)
31#define VMWGFX_PIX_GMR     (1 << 1)
32#define VMWGFX_PIX_SURFACE (1 << 2)
33
34#include <xorg-server.h>
35#include <picturestr.h>
36#include "vmwgfx_saa.h"
37
38struct vmwgfx_saa {
39    struct saa_driver driver;
40    struct vmwgfx_dma_ctx *ctx;
41    struct xa_tracker *xat;
42    struct xa_context *xa_ctx;
43    ScreenPtr pScreen;
44    int drm_fd;
45    struct vmwgfx_saa_pixmap *src_vpix;
46    struct vmwgfx_saa_pixmap *dst_vpix;
47    Bool present_copy;
48    Bool diff_valid;
49    int xdiff;
50    int ydiff;
51    RegionRec present_region;
52    uint32_t src_handle;
53    Bool can_optimize_dma;
54    Bool use_present_opt;
55    Bool only_hw_presents;
56    Bool rendercheck;
57    void (*present_flush) (ScreenPtr pScreen);
58    struct _WsbmListHead sync_x_list;
59    struct vmwgfx_composite *vcomp;
60};
61
62static inline struct vmwgfx_saa *
63to_vmwgfx_saa(struct saa_driver *driver) {
64    return (struct vmwgfx_saa *) driver;
65}
66
67/*
68 * In vmwgfx_saa.c
69 */
70
71Bool
72vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
73	       struct saa_pixmap *spix);
74Bool
75vmwgfx_create_hw(struct vmwgfx_saa *vsaa,
76		 PixmapPtr pixmap);
77
78
79/*
80 * vmwgfx_xa_surface.c
81 */
82
83enum xa_formats
84vmwgfx_xa_format(enum _PictFormatShort format);
85Bool
86vmwgfx_hw_validate(PixmapPtr pixmap, RegionPtr region);
87
88Bool
89vmwgfx_hw_accel_stage(PixmapPtr pixmap, unsigned int depth,
90		      uint32_t add_flags, uint32_t remove_flags);
91Bool
92vmwgfx_hw_composite_src_stage(PixmapPtr pixmap,
93			      enum _PictFormatShort pict_format);
94Bool
95vmwgfx_hw_composite_dst_stage(PixmapPtr pixmap,
96			      enum _PictFormatShort pict_format);
97Bool
98vmwgfx_hw_commit(PixmapPtr pixmap);
99
100/*
101 * vmwgfx_xa_composite.c
102 */
103
104struct vmwgfx_composite;
105
106void
107vmwgfx_free_composite(struct vmwgfx_composite *vcomp);
108struct vmwgfx_composite *
109vmwgfx_alloc_composite(void);
110
111Bool
112vmwgfx_xa_update_comp(struct xa_composite *comp,
113		      PixmapPtr src_pix,
114		      PixmapPtr mask_pix,
115		      PixmapPtr dst_pix);
116
117struct xa_composite *
118vmwgfx_xa_setup_comp(struct vmwgfx_composite *vcomp,
119		     int op,
120		     PicturePtr src_pict,
121		     PicturePtr mask_pict,
122		     PicturePtr dst_pict);
123
124
125#endif
126