vmwgfx_saa_priv.h revision 22f7e8e5
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    Bool is_master;
58    Bool known_prime_format;
59    void (*present_flush) (ScreenPtr pScreen);
60    struct _WsbmListHead sync_x_list;
61    struct _WsbmListHead pixmaps;
62    struct vmwgfx_composite *vcomp;
63};
64
65static inline struct vmwgfx_saa *
66to_vmwgfx_saa(struct saa_driver *driver) {
67    return (struct vmwgfx_saa *) driver;
68}
69
70/*
71 * In vmwgfx_saa.c
72 */
73
74Bool
75vmwgfx_hw_kill(struct vmwgfx_saa *vsaa,
76	       struct saa_pixmap *spix);
77Bool
78vmwgfx_create_hw(struct vmwgfx_saa *vsaa,
79		 PixmapPtr pixmap);
80
81
82/*
83 * vmwgfx_xa_surface.c
84 */
85
86enum xa_formats
87vmwgfx_xa_format(enum _PictFormatShort format);
88Bool
89vmwgfx_hw_validate(PixmapPtr pixmap, RegionPtr region);
90
91Bool
92vmwgfx_hw_accel_stage(PixmapPtr pixmap, unsigned int depth,
93		      uint32_t add_flags, uint32_t remove_flags);
94Bool
95vmwgfx_hw_composite_src_stage(PixmapPtr pixmap,
96			      enum _PictFormatShort pict_format);
97Bool
98vmwgfx_hw_composite_dst_stage(PixmapPtr pixmap,
99			      enum _PictFormatShort pict_format);
100Bool
101vmwgfx_hw_commit(PixmapPtr pixmap);
102
103/*
104 * vmwgfx_xa_composite.c
105 */
106
107struct vmwgfx_composite;
108
109void
110vmwgfx_free_composite(struct vmwgfx_composite *vcomp);
111struct vmwgfx_composite *
112vmwgfx_alloc_composite(void);
113
114Bool
115vmwgfx_xa_update_comp(struct xa_composite *comp,
116		      PixmapPtr src_pix,
117		      PixmapPtr mask_pix,
118		      PixmapPtr dst_pix);
119
120struct xa_composite *
121vmwgfx_xa_setup_comp(struct vmwgfx_composite *vcomp,
122		     int op,
123		     PicturePtr src_pict,
124		     PicturePtr mask_pict,
125		     PicturePtr dst_pict);
126
127
128#endif
129