vmwgfx_hosted.c revision 22f7e8e5
122f7e8e5Smrg/*
222f7e8e5Smrg * Copyright 2013 VMWare, Inc.
322f7e8e5Smrg * All Rights Reserved.
422f7e8e5Smrg *
522f7e8e5Smrg * Permission is hereby granted, free of charge, to any person obtaining a
622f7e8e5Smrg * copy of this software and associated documentation files (the
722f7e8e5Smrg * "Software"), to deal in the Software without restriction, including
822f7e8e5Smrg * without limitation the rights to use, copy, modify, merge, publish,
922f7e8e5Smrg * distribute, sub license, and/or sell copies of the Software, and to
1022f7e8e5Smrg * permit persons to whom the Software is furnished to do so, subject to
1122f7e8e5Smrg * the following conditions:
1222f7e8e5Smrg *
1322f7e8e5Smrg * The above copyright notice and this permission notice (including the
1422f7e8e5Smrg * next paragraph) shall be included in all copies or substantial portions
1522f7e8e5Smrg * of the Software.
1622f7e8e5Smrg *
1722f7e8e5Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1822f7e8e5Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1922f7e8e5Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
2022f7e8e5Smrg * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
2122f7e8e5Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2222f7e8e5Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2322f7e8e5Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2422f7e8e5Smrg *
2522f7e8e5Smrg * Author: Thomas Hellstrom <thellstrom@vmware.com>
2622f7e8e5Smrg */
2722f7e8e5Smrg
2822f7e8e5Smrg#ifdef HAVE_CONFIG_H
2922f7e8e5Smrg#include "config.h"
3022f7e8e5Smrg#endif
3122f7e8e5Smrg
3222f7e8e5Smrg#include "vmwgfx_hosted.h"
3322f7e8e5Smrg#include "vmwgfx_hosted_priv.h"
3422f7e8e5Smrg
3522f7e8e5Smrg/*
3622f7e8e5Smrg * Hook up hosted environments here.
3722f7e8e5Smrg */
3822f7e8e5Smrg
3922f7e8e5Smrg/**
4022f7e8e5Smrg * vmwgfx_hosted_detect - Check whether we are hosted
4122f7e8e5Smrg *
4222f7e8e5Smrg * Check whether we are hosted by a compositor and
4322f7e8e5Smrg * in that case return a pointer to a valid struct vmwgfx_hosted_driver.
4422f7e8e5Smrg * If not hosted, return NULL.
4522f7e8e5Smrg */
4622f7e8e5Smrgconst struct vmwgfx_hosted_driver *
4722f7e8e5Smrgvmwgfx_hosted_detect(void)
4822f7e8e5Smrg{
4922f7e8e5Smrg    const struct vmwgfx_hosted_driver *tmp = vmwgfx_xmir_detect();
5022f7e8e5Smrg
5122f7e8e5Smrg    if (!tmp)
5222f7e8e5Smrg	tmp = vmwgfx_xwl_detect();
5322f7e8e5Smrg
5422f7e8e5Smrg    return tmp;
5522f7e8e5Smrg}
5622f7e8e5Smrg
5722f7e8e5Smrg/**
5822f7e8e5Smrg * vmwgfx_hosted_modify_flags - Modify driver flags if hosted.
5922f7e8e5Smrg *
6022f7e8e5Smrg * @flag: Pointer to the flag argument given to the vmware driver's
6122f7e8e5Smrg * DriverFunc function, when operation is GET_REQUIRED_HW_INTERFACES.
6222f7e8e5Smrg *
6322f7e8e5Smrg * Checks whether we are running hosted, and in that case modifies
6422f7e8e5Smrg * the flag according to the hosted environment's requirements.
6522f7e8e5Smrg */
6622f7e8e5Smrgvoid
6722f7e8e5Smrgvmwgfx_hosted_modify_flags(uint32_t *flags)
6822f7e8e5Smrg{
6922f7e8e5Smrg    vmwgfx_xmir_modify_flags(flags);
7022f7e8e5Smrg    vmwgfx_xwl_modify_flags(flags);
7122f7e8e5Smrg}
72