summaryrefslogtreecommitdiff
path: root/vmwgfx/vmwgfx_saa.h
blob: 1a42cac9bcb0ef0ecb2ee36d7d6aca5b9cb43eb9 (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
/*
 * Copyright 2011 VMWare, Inc.
 * All Rights Reserved.
 *
 * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
 *
 * Author: Thomas Hellstrom <thellstrom@vmware.com>
 */

#ifndef _VMWGFX_SAA_H_
#define _VMWGFX_SAA_H_

#include "saa.h"
#include <xa_tracker.h>
#include "vmwgfx_drmi.h"

#define VMWGFX_FLAG_FORCE_GMR     (1 << 0) /* Create with GMR as backing store */
#define VMWGFX_FLAG_FORCE_SURFACE (1 << 1) /* Create with surface as backing store */
#define VMWGFX_FLAG_AVOID_HWACCEL (1 << 2) /* Avoid Hardware acceleration on this pixmap */
#define VMWGFX_FLAG_USE_PRESENT   (1 << 3) /* Use presents when copying to this pixmap */

struct vmwgfx_saa_pixmap {
    struct saa_pixmap base;
    RegionPtr dirty_present;
    RegionPtr present_damage;
    RegionPtr pending_update;
    RegionPtr pending_present;
    uint32_t usage_flags;
    uint32_t backing;
    void *malloc;
    struct vmwgfx_dmabuf *gmr;
    struct xa_surface *hw;
    int scanout_refcnt;
    uint32_t fb_id;
    int hw_is_dri2_fronts;
    struct vmwgfx_saa_pixmap *next_dri2;
    struct vmwgfx_saa_pixmap **prevnext_dri2;
};

static inline struct vmwgfx_saa_pixmap *
to_vmwgfx_saa_pixmap(struct saa_pixmap *spix)
{
    return (struct vmwgfx_saa_pixmap *) spix;
}

extern Bool
vmwgfx_pixmap_validate_hw(PixmapPtr pixmap, RegionPtr region,
			  unsigned int add_flags,
			  unsigned int remove_flags);

static inline struct vmwgfx_saa_pixmap*
vmwgfx_saa_pixmap(PixmapPtr pix)
{
    return to_vmwgfx_saa_pixmap(saa_get_saa_pixmap(pix));
}

extern Bool
vmwgfx_saa_init(ScreenPtr pScreen, int drm_fd, struct xa_tracker *xat,
		void (*present_flush)(ScreenPtr pScreen));

extern uint32_t
vmwgfx_scanout_ref(PixmapPtr pixmap);

extern void
vmwgfx_scanout_unref(PixmapPtr pixmap);

extern void
vmwgfx_scanout_refresh(PixmapPtr pixmap);

extern void
vmwgfx_remove_dri2_list(struct vmwgfx_saa_pixmap *vpix);

extern void
vmwgfx_flush_dri2(ScreenPtr pScreen);

#endif