162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR MIT */
262306a36Sopenharmony_ci/**************************************************************************
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright 2021 VMware, Inc., Palo Alto, CA., USA
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
762306a36Sopenharmony_ci * copy of this software and associated documentation files (the
862306a36Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
962306a36Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
1062306a36Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
1162306a36Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
1262306a36Sopenharmony_ci * the following conditions:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * The above copyright notice and this permission notice (including the
1562306a36Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
1662306a36Sopenharmony_ci * of the Software.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1962306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2062306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
2162306a36Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
2262306a36Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2362306a36Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2462306a36Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci **************************************************************************/
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#ifndef _VMWGFX_DEVCAPS_H_
2962306a36Sopenharmony_ci#define _VMWGFX_DEVCAPS_H_
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#include "vmwgfx_drv.h"
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#include "device_include/svga_reg.h"
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciint vmw_devcaps_create(struct vmw_private *vmw);
3662306a36Sopenharmony_civoid vmw_devcaps_destroy(struct vmw_private *vmw);
3762306a36Sopenharmony_ciuint32_t vmw_devcaps_size(const struct vmw_private *vmw, bool gb_aware);
3862306a36Sopenharmony_ciint vmw_devcaps_copy(struct vmw_private *vmw, bool gb_aware,
3962306a36Sopenharmony_ci		     void *dst, uint32_t dst_size);
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_cistatic inline uint32_t vmw_devcap_get(struct vmw_private *vmw,
4262306a36Sopenharmony_ci				      uint32_t devcap)
4362306a36Sopenharmony_ci{
4462306a36Sopenharmony_ci	bool gb_objects = !!(vmw->capabilities & SVGA_CAP_GBOBJECTS);
4562306a36Sopenharmony_ci	if (gb_objects)
4662306a36Sopenharmony_ci		return vmw->devcaps[devcap];
4762306a36Sopenharmony_ci	return 0;
4862306a36Sopenharmony_ci}
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#endif
51