vmwgfx_hosted.c revision 22f7e8e5
1/*
2 * Copyright 2013 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
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include "vmwgfx_hosted.h"
33#include "vmwgfx_hosted_priv.h"
34
35/*
36 * Hook up hosted environments here.
37 */
38
39/**
40 * vmwgfx_hosted_detect - Check whether we are hosted
41 *
42 * Check whether we are hosted by a compositor and
43 * in that case return a pointer to a valid struct vmwgfx_hosted_driver.
44 * If not hosted, return NULL.
45 */
46const struct vmwgfx_hosted_driver *
47vmwgfx_hosted_detect(void)
48{
49    const struct vmwgfx_hosted_driver *tmp = vmwgfx_xmir_detect();
50
51    if (!tmp)
52	tmp = vmwgfx_xwl_detect();
53
54    return tmp;
55}
56
57/**
58 * vmwgfx_hosted_modify_flags - Modify driver flags if hosted.
59 *
60 * @flag: Pointer to the flag argument given to the vmware driver's
61 * DriverFunc function, when operation is GET_REQUIRED_HW_INTERFACES.
62 *
63 * Checks whether we are running hosted, and in that case modifies
64 * the flag according to the hosted environment's requirements.
65 */
66void
67vmwgfx_hosted_modify_flags(uint32_t *flags)
68{
69    vmwgfx_xmir_modify_flags(flags);
70    vmwgfx_xwl_modify_flags(flags);
71}
72