add linbo Intel media stack runtime

This commit is contained in:
linbo 2026-09-16 16:41:32 +08:00
parent 0f6417c940
commit f44344e4bf
263 changed files with 99993 additions and 0 deletions

View File

@ -0,0 +1,216 @@
#!/bin/sh
# shellcheck shell=sh
###############################################################################
# Copyright (C) Intel Corporation
#
# SPDX-License-Identifier: MIT
###############################################################################
# Configure environment variables
# Get absolute path to this script.
# Uses `readlink` to remove links and `pwd -P` to turn into an absolute path.
# Usage:
# script_dir=$(get_script_path "$script_rel_path")
#
# Inputs:
# script/relative/pathname/scriptname
#
# Outputs:
# /script/absolute/pathname
# executing function in a *subshell* to localize vars and effects on `cd`
get_script_path() (
script="$1"
while [ -L "$script" ] ; do
# combining next two lines fails in zsh shell
script_dir=$(command dirname -- "$script")
script_dir=$(cd "$script_dir" && command pwd -P)
script="$(readlink "$script")"
case $script in
(/*) ;;
(*) script="$script_dir/$script" ;;
esac
done
# combining next two lines fails in zsh shell
script_dir=$(command dirname -- "$script")
script_dir=$(cd "$script_dir" && command pwd -P)
printf "%s" "$script_dir"
)
# ############################################################################
# Determine if we are being executed or sourced. Need to detect being sourced
# within an executed script, which can happen on a CI system. We also must
# detect being sourced at a shell prompt (CLI). The setvars.sh script will
# always source this script, but this script can also be called directly.
# We are assuming we know the name of this script, which is a reasonable
# assumption. This script _must_ be named "vars.sh" or it will not work
# with the top-level setvars.sh script. Making this assumption simplifies
# the process of detecting if the script has been sourced or executed. It
# also simplifies the process of detecting the location of this script.
# Using `readlink` to remove possible symlinks in the name of the script.
# Also, "ps -o comm=" is limited to a 15 character result, but it works
# fine here, because we are only looking for the name of this script or the
# name of the execution shell, both always fit into fifteen characters.
# TODO: Edge cases exist when executed by way of "/bin/sh setvars.sh"
# Most shells detect or fall thru to error message, sometimes ksh does not.
# This is an odd and unusual situation; not a high priority issue.
_vars_get_proc_name() {
if [ -n "${ZSH_VERSION:-}" ] ; then
script="$(ps -p "$$" -o comm=)"
else
script="$1"
while [ -L "$script" ] ; do
script="$(readlink "$script")"
done
fi
basename -- "$script"
}
_vars_this_script_name="vars.sh"
if [ "$_vars_this_script_name" = "$(_vars_get_proc_name "$0")" ] ; then
echo " ERROR: Incorrect usage: this script must be sourced."
echo " Usage: . path/to/${_vars_this_script_name}"
return 255 2>/dev/null || exit 255
fi
# ############################################################################
# Prepend path segment(s) to path-like env vars (PATH, CPATH, etc.).
# prepend_path() avoids dangling ":" that affects some env vars (PATH and CPATH)
# prepend_manpath() includes dangling ":" needed by MANPATH.
# PATH > https://www.gnu.org/software/libc/manual/html_node/Standard-Environment.html
# MANPATH > https://manpages.debian.org/stretch/man-db/manpath.1.en.html
# Usage:
# env_var=$(prepend_path "$prepend_to_var" "$existing_env_var")
# export env_var
#
# env_var=$(prepend_manpath "$prepend_to_var" "$existing_env_var")
# export env_var
#
# Inputs:
# $1 == path segment to be prepended to $2
# $2 == value of existing path-like environment variable
prepend_path() (
path_to_add="$1"
path_is_now="$2"
if [ "" = "${path_is_now}" ] ; then # avoid dangling ":"
printf "%s" "${path_to_add}"
else
printf "%s" "${path_to_add}:${path_is_now}"
fi
)
prepend_manpath() (
path_to_add="$1"
path_is_now="$2"
if [ "" = "${path_is_now}" ] ; then # include dangling ":"
printf "%s" "${path_to_add}:"
else
printf "%s" "${path_to_add}:${path_is_now}"
fi
)
# ############################################################################
# Extract the name and location of this sourced script.
# Generally, "ps -o comm=" is limited to a 15 character result, but it works
# fine for this usage, because we are primarily interested in finding the name
# of the execution shell, not the name of any calling script.
vars_script_name=""
vars_script_shell="$(ps -p "$$" -o comm=)"
# ${var:-} needed to pass "set -eu" checks
# see https://unix.stackexchange.com/a/381465/103967
# see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
if [ -n "${ZSH_VERSION:-}" ] && [ -n "${ZSH_EVAL_CONTEXT:-}" ] ; then # zsh 5.x and later
# shellcheck disable=2249
case $ZSH_EVAL_CONTEXT in (*:file*) vars_script_name="${(%):-%x}" ;; esac ;
elif [ -n "${KSH_VERSION:-}" ] ; then # ksh, mksh or lksh
if [ "$(set | grep -Fq "KSH_VERSION=.sh.version" ; echo $?)" -eq 0 ] ; then # ksh
vars_script_name="${.sh.file}" ;
else # mksh or lksh or [lm]ksh masquerading as ksh or sh
# force [lm]ksh to issue error msg; which contains this script's path/filename, e.g.:
# mksh: path/to/vars.sh[137]: ${.sh.file}: bad substitution
vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
vars_script_name="$(expr "${vars_script_name:-}" : '^.*sh: \(.*\)\[[0-9]*\]:')" ;
fi
elif [ -n "${BASH_VERSION:-}" ] ; then # bash
# shellcheck disable=2128
(return 0 2>/dev/null) && vars_script_name="${BASH_SOURCE}" ;
elif [ "dash" = "$vars_script_shell" ] ; then # dash
# force dash to issue error msg; which contains this script's rel/path/filename, e.g.:
# dash: 146: path/to/vars.sh: Bad substitution
vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
vars_script_name="$(expr "${vars_script_name:-}" : '^.*dash: [0-9]*: \(.*\):')" ;
elif [ "sh" = "$vars_script_shell" ] ; then # could be dash masquerading as /bin/sh
# force a shell error msg; which should contain this script's path/filename
# sample error msg shown; assume this file is named "vars.sh"; as required by setvars.sh
vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
if [ "$(printf "%s" "$vars_script_name" | grep -Eq "sh: [0-9]+: .*vars\.sh: " ; echo $?)" -eq 0 ] ; then # dash as sh
# sh: 155: path/to/vars.sh: Bad substitution
vars_script_name="$(expr "${vars_script_name:-}" : '^.*sh: [0-9]*: \(.*\):')" ;
fi
else # unrecognized shell or dash being sourced from within a user's script
# force a shell error msg; which should contain this script's path/filename
# sample error msg shown; assume this file is named "vars.sh"; as required by setvars.sh
vars_script_name="$( (echo "${.sh.file}") 2>&1 )" || : ;
if [ "$(printf "%s" "$vars_script_name" | grep -Eq "^.+: [0-9]+: .*vars\.sh: " ; echo $?)" -eq 0 ] ; then # dash
# .*: 164: path/to/vars.sh: Bad substitution
vars_script_name="$(expr "${vars_script_name:-}" : '^.*: [0-9]*: \(.*\):')" ;
else
vars_script_name="" ;
fi
fi
if [ "" = "$vars_script_name" ] ; then
>&2 echo " ERROR: Unable to proceed: possible causes listed below."
>&2 echo " This script must be sourced. Did you execute or source this script?" ;
>&2 echo " Unrecognized/unsupported shell (supported: bash, zsh, ksh, m/lksh, dash)." ;
>&2 echo " May fail in dash if you rename this script (assumes \"vars.sh\")." ;
>&2 echo " Can be caused by sourcing from ZSH version 4.x or older." ;
return 255 2>/dev/null || exit 255
fi
# ############################################################################
# Component-specific env var settings.
script_path=$(get_script_path "${vars_script_name:-}")
vpl_prefix="$script_path/../.."
vpl_prefix=$(cd "$vpl_prefix" && pwd)
vpl_include="$vpl_prefix/include"
vpl_lib="$vpl_prefix/lib"
vpl_bin="$vpl_prefix/bin"
vpl_pkgconfig="$vpl_prefix/lib/pkgconfig"
CPATH=$(prepend_path "$vpl_include" "${CPATH:-}")
export CPATH
LIBRARY_PATH=$(prepend_path "$vpl_lib" "${LIBRARY_PATH:-}")
export LIBRARY_PATH
PATH=$(prepend_path "$vpl_bin" "${PATH:-}")
export PATH
LD_LIBRARY_PATH=$(prepend_path "$vpl_lib" "${LD_LIBRARY_PATH:-}")
export LD_LIBRARY_PATH
CMAKE_PREFIX_PATH=$(prepend_path "$vpl_prefix" "${CMAKE_PREFIX_PATH:-}")
export CMAKE_PREFIX_PATH
PKG_CONFIG_PATH=$(prepend_path "$vpl_pkgconfig" "${PKG_CONFIG_PATH:-}")
export PKG_CONFIG_PATH
VPL_EXAMPLES_PATH="$vpl_prefix/share/vpl/examples"
export VPL_EXAMPLES_PATH

View File

@ -0,0 +1,39 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#define ISPRODUCT(X) (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) == IGFX_##X)
#define FROMPRODUCT(X) (GFX_GET_CURRENT_PRODUCT(pGmmLibContext->GetPlatformInfo().Platform) >= IGFX_##X)
#define SKU(FtrXxx) (pGmmLibContext->GetSkuTable().FtrXxx != 0)
#define WA(WaXxx) (pGmmLibContext->GetWaTable().WaXxx != 0)
// Underscored to prevent name collision with the GMM_CACHE_POLICY_ELEMENT fields named L3 and LLC
#define _L3 (pGmmLibContext->GetGtSysInfo()->L3CacheSizeInKb)
#define _LLC (pGmmLibContext->GetGtSysInfo()->LLCCacheSizeInKb)
#define _ELLC (pGmmLibContext->GetGtSysInfo()->EdramSizeInKb)
#define CAM$ (SKU(FtrCameraCaptureCaching))
// Units are already in KB in the system information, so these helper macros need to account for that
#define KB(N) (N)
#define MB(N) (1024 * KB(N))

View File

@ -0,0 +1,361 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
// Generic Usages
// KMD Usages
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BATCH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CURSOR )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DUMMY_PAGE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_GDI_SURFACE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_GFX_RING )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HW_CONTEXT )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MBM_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_NNDI_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OVERLAY_MBM )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PRIMARY_SURFACE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SHADOW_SURFACE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SM_SCRATCH_STATE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STATUS_PAGE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_WA_BATCH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_KMD_OCA_BUFFER)
//
// 3D Usages
//
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BINDING_TABLE_POOL )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CCS )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DEPTH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_GEN9_UNENCRYPTED_DISPLAYABLE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_GATHER_POOL )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HEAP_INSTRUCTION )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HIZ )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_INDEX_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MCS )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_QUERY )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_RENDER_TARGET )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SHADER_RESOURCE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STAGING )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STENCIL_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILE_POOL )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MOCS_62 )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_L3_EVICTION )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CCS_MEDIA_WRITABLE )
//TODO: To substitute with Interface to set SCF once its available for UMDs
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_UNCACHED )
// Tiled Resource
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_CCS )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_HIZ )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_MCS )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_RENDER_TARGET )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILED_UAV )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VERTEX_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER )
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_UAV )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE_PARTIALENCSURFACES )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PTBR_PAGE_POOL )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER )
//
// CM USAGES
//
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_StateHeap)
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_L3_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_LLC_ELLC_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_LLC_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_ELLC_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_LLC_L3_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_ELLC_L3_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_NO_CACHE_SurfaceState )
DEFINE_RESOURCE_USAGE( CM_RESOURCE_USAGE_L1_Enabled_SurfaceState )
//
// MP USAGES
//
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_BEGIN )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_DEFAULT )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_DEFAULT_FF )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_DEFAULT_RCS )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_SurfaceState_FF )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_SurfaceState_RCS )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_AGE3_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_EDRAM_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_EDRAM_AGE3_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_No_L3_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_No_LLC_L3_AGE_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_No_LLC_eLLC_L3_AGE_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_PartialEnc_No_LLC_L3_AGE_SurfaceState )
DEFINE_RESOURCE_USAGE( MP_RESOURCE_USAGE_END )
// MHW - SFC USAGES
DEFINE_RESOURCE_USAGE( MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface ) // SFC Output Surface
DEFINE_RESOURCE_USAGE( MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface_PartialEncSurface ) // SFC Output Surface for partial encrypted surfaces
DEFINE_RESOURCE_USAGE( MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface ) // SFC AVS Line buffer Surface
DEFINE_RESOURCE_USAGE( MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface ) // SFC IEF Line buffer Surface
//
// CODEC USAGES
//
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BEGIN_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC_PARTIALENCSURFACE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_FF)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MAD_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP8_BLOCK_MODE_COST_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP8_MB_MODE_COST_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP8_MBENC_OUTPUT_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP8_HISTOGRAM_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP8_L3_LLC_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MBDISABLE_SKIPMAP_CODEC)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MFX_STANDALONE_DEBLOCKING_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_MD_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_SAO_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_MV_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_STATUS_ERROR_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_LCU_ILDB_STREAMOUT_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP9_PROBABILITY_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP9_SEGMENT_ID_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP9_HVD_ROWSTORE_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VDENC_ROW_STORE_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VDENC_STREAMIN_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MB_QP_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MACROBLOCK_ILDB_STREAM_OUT_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SSE_SRC_PIXEL_ROW_STORE_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SLICE_STATE_STREAM_OUT_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CABAC_SYNTAX_STREAM_OUT_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PRED_COL_STORE_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_PAK_IMAGESTATE_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MBENC_BRC_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MB_BRC_CONST_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_BRC_MB_QP_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_BRC_ROI_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_SLICE_MAP_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_WP_DOWNSAMPLED_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_VDENC_IMAGESTATE_ENCODE)
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_UNCACHED )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ELLC_ONLY )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_ONLY )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_L3 )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_BRC_HISTORY_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_SOFTWARE_SCOREBOARD_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ME_MV_DATA_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_MV_DISTORTION_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_4XME_DISTORTION_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_INTRA_DISTORTION_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_MB_STATS_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_PAK_STATS_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_READ_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_WRITE_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_COMBINED_ENC_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_BRC_CONSTANT_DATA_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_INTERMEDIATE_CU_RECORD_SURFACE_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_SCRATCH_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_LCU_LEVEL_DATA_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_INPUT_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_OUTPUT_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_DEBUG_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_CONSTANT_TABLE_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_CU_RECORD_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_MV_TEMPORAL_BUFFER_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_CU_PACKET_FOR_PAK_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED1_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED2_ENCODE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_FRAME_STATS_STREAMOUT_DATA_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_LINE_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_COLUMN_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_MD_TILE_LINE_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_MD_TILE_COLUMN_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_SAO_TILE_LINE_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HCP_SAO_TILE_COLUMN_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_VP9_PROBABILITY_COUNTER_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_HUC_VIRTUAL_ADDR_REGION_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_SIZE_STREAMOUT_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_COMPRESSED_HEADER_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_PROBABILITY_DELTA_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILE_RECORD_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_TILE_SIZE_STAS_BUFFER_CODEC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_END_CODEC )
// OCL Usages
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_BUFFER_CONST )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_IMAGE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_INLINE_CONST )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_SCRATCH )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_BUFFER_NO_LLC_CACHING )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_OCL_IMAGE_NO_LLC_CACHING )
// Cross Adapter
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE )
// BCS usages
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BLT_SOURCE )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_BLT_DESTINATION )
DEFINE_RESOURCE_USAGE( GMM_RESOURCE_USAGE_CAMERA_CAPTURE )
// Xe_LPG+ Media Usages
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_MEDIA_BATCH_BUFFERS)
// DECODE
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_INPUT_BITSTREAM)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_INPUT_REFERENCE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_INTERNAL_WRITE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_CACHE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_NOCACHE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_OUTPUT_PICTURE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_WRITE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_READ_WRITE)
// ENCODE
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_INPUT_RAW)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_INPUT_RECON)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_WRITE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_CACHE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_NOCACHE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_EXTERNAL_READ)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_PICTURE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_BITSTREAM)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_WRITE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_READ_WRITE)
// VP
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_FF)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_FF)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_FF)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_FF)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_FF)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_FF)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_RENDER)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_RENDER)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_RENDER)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER)
// CP
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_CP_EXTERNAL_READ)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_CP_INTERNAL_WRITE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_GSC_KMD_RESOURCE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_KMD_NULL_CONTEXT_BB)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_COMMAND_STREAMER)
//Uncacheable copies
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_COPY_SOURCE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_COPY_DEST)
// Shader resource uncachable, needed for WA_18013889147
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_SHADER_RESOURCE_L1_NOT_CACHED)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_UMD_OCA_BUFFER)
// Usages for command streamer instructions
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_DEFAULT)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE)
DEFINE_RESOURCE_USAGE(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_VIA_PAT)

View File

@ -0,0 +1,30 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#undef PRODUCT
#undef SKU
#undef WA
#undef _L3
#undef _LLC
#undef _ELLC
#undef KB
#undef MB

View File

@ -0,0 +1,248 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define EDRAM (SKU(FtrEDram))
#define FBLLC (SKU(FtrFrameBufferLLC))
//eDRAM-Only caching, for a usage that might be encrypted, must use ENCRYPTED_PARTIALS_EDRAM
#define ENCRYPTED_PARTIALS_EDRAM (EDRAM && !(pGmmLibContext->GetWaTable().WaEncryptedEdramOnlyPartials))
// Cache Policy Definition
// AOM = Do not allocate on miss (0 = allocate on miss [normal cache behavior], 1 = don't allocate on miss)
// LeCC_SCC = LLC/eLLC skip caching control (disabled if LeCC_SCC = 0)
// L3_SCC = L3 skip caching control (disabled if L3_SCC = 0)
// SSO = Override MIDI self snoop settings (1 = never send to uncore, 3 = always send to uncore, 0 = [default] No override )
// CoS = Class of Service ( allowed values 1, 2, 3 for class IDs 1, 2, 3 respectively, default class 1 => driver overrides 0->1)
// HDCL1 = HDC L1 cache control (1 = cached in HDC L1, 0 = not cached in HDC L1)
// Faster PushWrite(Gen10+) used iff !WT, eLLC-only cacheable - Globally visible surface (eg display surface) should be marked WT
//***************************************************************************************************************/
// USAGE TYPE , LLC , ELLC , L3 , WT , AGE , LeCC_SCC , L3_SCC, SSO, CoS, HDCL1 )
/****************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
//
// 3D Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , FBLLC, ENCRYPTED_PARTIALS_EDRAM, FBLLC, !FBLLC && ENCRYPTED_PARTIALS_EDRAM, 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 0 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 0 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 0 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
// Tiled Resource
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 0 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
//
// CM USAGES
//
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1 , 1 , 1 , 0 ,3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 1 , 1 , 0 , 0 ,3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_ELLC_SurfaceState, 0 , 0 , 1 , 0 ,3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_SurfaceState, 0 , 1 , 1 , 0 ,3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_SurfaceState, 1 , 0 , 1 , 0 ,3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_L3_SurfaceState, 0 , 1 , 0 , 0 ,3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_L3_SurfaceState, 1 , 0 , 0 , 0 ,3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0 , 0 , 0 , 0 ,3, 0, 0, 0, 0, 0);
//
// MP USAGES
//
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , EDRAM, 1 , 0 , 1, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_AGE3_SurfaceState, 1 , EDRAM, 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
// MHW - SFC
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 1 , EDRAM, 1 , 0 , 1, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 1 , EDRAM, 1 , 0 , 1, 0, 0, 0, 0, 0);
//Media GMM Resource USAGES
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC , 0 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_ROW_STORE_BUFFER_CODEC , 1 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_STREAMIN_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MB_QP_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_COUNTER_BUFFER_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HUC_VIRTUAL_ADDR_REGION_BUFFER_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SIZE_STREAMOUT_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMPRESSED_HEADER_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROBABILITY_DELTA_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MV_CODEC , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_STATUS_ERROR_CODEC , 0 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_LCU_ILDB_STREAMOUT_CODEC , 0 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_SEGMENT_ID_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_HVD_ROWSTORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_ILDB_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SSE_SRC_PIXEL_ROW_STORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_UNCACHED , 0 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_ONLY , 0 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_ONLY , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_L3 , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0);
/**********************************************************************************/
//
// OCL Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1 , 0 , 1 , 0 , 3 , 0, 0, 3, 0, 0);
/**********************************************************************************/
// Cross Adapter
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
/**********************************************************************************/
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CAMERA_CAPTURE , CAM$, 0 , 0 , 0 , CAM$ , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
//Usages for command streamer instructions
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0);
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,298 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define EDRAM (SKU(FtrEDram))
#define FBLLC (SKU(FtrFrameBufferLLC))
#define NS (SKU(FtrLLCBypass))
// Cache Policy Definition
// AOM = Do not allocate on miss (0 = allocate on miss [normal cache behavior], 1 = don't allocate on miss)
// LeCC_SCC = LLC/eLLC skip caching control (disabled if LeCC_SCC = 0)
// L3_SCC = L3 skip caching control (disabled if L3_SCC = 0)
// SCF = Snoop Control Field (SCF)- Only for SKL/BXT(as coherent/non-coherent)
// SSO = Override MIDI self snoop settings (1 = never send to uncore, 3 = always send to uncore, 0 = [default] No override )
// CoS = Class of Service ( allowed values 1, 2, 3 for class IDs 1, 2, 3 respectively, default class 1 => driver overrides 0->1)
// Faster PushWrite(Gen10+) used iff !WT, eLLC-only cacheable - Globally visible surface (eg display surface) should be marked WT
//***************************************************************************************************************/
// USAGE TYPE , LLC , ELLC , L3 , WT , AGE , AOM , LeCC_SCC , L3_SCC, SCF, SSO, CoS)
/****************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, NS, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
//
// 3D Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 0 , EDRAM, 0 , EDRAM , 0 , 0, 0, 0, NS, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 0 , 1 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS , 0 , 1 , 1 , 0 , 0 , 0, 0, 0, NS, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MOCS_62 , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNCACHED , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
// Tiled Resource
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_PAGE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER , 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0);
//
// CM USAGES
//
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_ELLC_SurfaceState, 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_SurfaceState, 0 , 1 , 1 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_SurfaceState, 1 , 0 , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_L3_SurfaceState, 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_L3_SurfaceState, 1 , 0 , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
//
// MP USAGES
//
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , EDRAM, 1 , 0 , 1, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_AGE3_SurfaceState, 1 , EDRAM, 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
// MHW - SFC
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 1 , EDRAM, 1 , 0 , 1, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 1 , EDRAM, 1 , 0 , 1, 0, 0, 0, 0, 0, 0);
//Media GMM Resource USAGES
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_ROW_STORE_BUFFER_CODEC , 1 , 0 , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_STREAMIN_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MV_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_STATUS_ERROR_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_LCU_ILDB_STREAMOUT_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_SEGMENT_ID_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_HVD_ROWSTORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_ILDB_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SSE_SRC_PIXEL_ROW_STORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SLICE_STATE_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CABAC_SYNTAX_STREAM_OUT_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRED_COL_STORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_UNCACHED , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_ONLY , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_ONLY , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_L3 , 1 , EDRAM , 1 , 0 , 3, 0 , 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_HISTORY_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SOFTWARE_SCOREBOARD_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_MV_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_4XME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_INTRA_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MB_STATS_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PAK_STATS_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_READ_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_WRITE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_COMBINED_ENC_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_CONSTANT_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_INTERMEDIATE_CU_RECORD_SURFACE_ENCODE , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SCRATCH_ENCODE , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_LCU_LEVEL_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_INPUT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_OUTPUT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_DEBUG_ENCODE , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CONSTANT_TABLE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CU_RECORD_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_MV_TEMPORAL_BUFFER_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CU_PACKET_FOR_PAK_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED1_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED2_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FRAME_STATS_STREAMOUT_DATA_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_LINE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_COLUMN_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_TILE_LINE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_TILE_COLUMN_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_TILE_LINE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_TILE_COLUMN_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_COUNTER_BUFFER_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HUC_VIRTUAL_ADDR_REGION_BUFFER_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SIZE_STREAMOUT_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMPRESSED_HEADER_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROBABILITY_DELTA_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MAD_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PAK_IMAGESTATE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_BRC_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MB_BRC_CONST_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_MB_QP_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ROI_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBDISABLE_SKIPMAP_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SLICE_MAP_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_WP_DOWNSAMPLED_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_VDENC_IMAGESTATE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0);
/**********************************************************************************/
//
// OCL Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1 , 1 , 1, 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 3, 0);
/**********************************************************************************/
// Cross Adapter
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
/**********************************************************************************/
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CAMERA_CAPTURE , CAM$, 0 , 0 , 0 , CAM$ , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
//Usages for command streamer instructions.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0);
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,321 @@
/*==============================================================================
Copyright(c) 2019 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define EDRAM (SKU(FtrEDram))
#define FBLLC (SKU(FtrFrameBufferLLC))
#define NS (SKU(FtrLLCBypass))
//Macros for L3-Eviction Type
#define NA 0x0
#define RO 0x1
#define RW 0x2
#define SP 0x3
// Cache Policy Definition
// AOM = Do not allocate on miss (0 = allocate on miss [normal cache behavior], 1 = don't allocate on miss)
// LeCC_SCC = LLC/eLLC skip caching control (disabled if LeCC_SCC = 0)
// L3_SCC = L3 skip caching control (disabled if L3_SCC = 0)
// SCF = Snoop Control Field (SCF)- Only for SKL/BXT and Gen12+ (as coherent/non-coherent)
// SSO = Override MIDI self snoop settings (1 = never send to uncore, 3 = always send to uncore, 0 = [default] No override )
// CoS = Class of Service ( allowed values 1, 2, 3 for class IDs 1, 2, 3 respectively, default class 0)
// HDCL1 = HDC L1 cache control (1 = cached in HDC L1, 0 = not cached in HDC L1)
// Faster PushWrite(Gen10+) used iff !WT, eLLC-only cacheable - Globally visible surface (eg display surface) should be marked WT
// L3Evict = Type of L3-eviction (0= NA ie not L3 cacheable, 1= RO ie ReadOnly, 2 = RW ie Standard using MOCS#63), 3 = SP ie Special using MOCS#61 for non-LLC access)
//***************************************************************************************************************/
// USAGE TYPE , LLC , ELLC , L3 , WT , AGE , AOM , LeCC_SCC , L3_SCC, SCF, SSO, CoS, HDCL1, L3Evict)
/****************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, NS, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
//
// 3D Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 0 , EDRAM, 1 , EDRAM , 0 , 0, 0, 0, NS, 0, 0, 0, SP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 1, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 0 , 1 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS , 0 , 1 , 1 , 0 , 0 , 0, 0, 0, NS, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MOCS_62 , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RW );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL , 0 , EDRAM, 1 , EDRAM , 0 , 0, 0, 0, NS, 0, 0, 0, SP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
// Tiled Resource
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 1, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 1, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_PAGE_POOL , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER , 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, RO );
//
// CM USAGES
//
// USAGE TYPE , LLC , ELLC , L3 , WT , AGE , AOM , LeCC_SCC , L3_SCC, SCF, SSO, CoS, HDCL1, L3Evict )
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_StateHeap, 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_L1_Enabled_SurfaceState, 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 1, RO );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_ELLC_SurfaceState, 0 , 0 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_SurfaceState, 0 , 1 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_SurfaceState, 1 , 0 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_L3_SurfaceState, 0 , 1 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_L3_SurfaceState, 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
//
// MP USAGES
//
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , 1 , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
// MHW - SFC
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 1 , 1 , 1 , 0 , 1, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 1 , 1 , 1 , 0 , 1, 0, 0, 0, 0, 0, 0, 0, RO );
//Media GMM Resource USAGES
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_ROW_STORE_BUFFER_CODEC , 1 , 0 , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_STREAMIN_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MV_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_STATUS_ERROR_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_LCU_ILDB_STREAMOUT_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_SEGMENT_ID_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_HVD_ROWSTORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_ILDB_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SSE_SRC_PIXEL_ROW_STORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SLICE_STATE_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CABAC_SYNTAX_STREAM_OUT_BUFFER_CODEC , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRED_COL_STORE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_UNCACHED , 0 , 0 , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_ONLY , 0 , EDRAM , 0 , 0 , 0, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_ONLY , 1 , EDRAM , 0 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_L3 , 1 , EDRAM , 1 , 0 , 3, 0 , 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS_MEDIA_WRITABLE , 0 , EDRAM , 1 , EDRAM , 0, 0, 0, 0, NS, 0, 0, 0, SP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_HISTORY_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SOFTWARE_SCOREBOARD_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_MV_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_4XME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_INTRA_DISTORTION_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MB_STATS_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PAK_STATS_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_READ_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_WRITE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_COMBINED_ENC_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_CONSTANT_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_INTERMEDIATE_CU_RECORD_SURFACE_ENCODE , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SCRATCH_ENCODE , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_LCU_LEVEL_DATA_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_INPUT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_OUTPUT_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_DEBUG_ENCODE , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CONSTANT_TABLE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CU_RECORD_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_MV_TEMPORAL_BUFFER_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CU_PACKET_FOR_PAK_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED1_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED2_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FRAME_STATS_STREAMOUT_DATA_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_LINE_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_COLUMN_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_TILE_LINE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_TILE_COLUMN_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_TILE_LINE_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_TILE_COLUMN_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_COUNTER_BUFFER_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HUC_VIRTUAL_ADDR_REGION_BUFFER_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SIZE_STREAMOUT_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMPRESSED_HEADER_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROBABILITY_DELTA_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_RECORD_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_SIZE_STAS_BUFFER_CODEC , 1 , EDRAM , 0 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MAD_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PAK_IMAGESTATE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_BRC_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MB_BRC_CONST_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_MB_QP_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ROI_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBDISABLE_SKIPMAP_CODEC , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SLICE_MAP_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_WP_DOWNSAMPLED_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_VDENC_IMAGESTATE_ENCODE , 1 , EDRAM , 1 , 0 , 3, 0, 0, 0, 0, 0, 0, 0, RO );
/**********************************************************************************/
//
// OCL Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 1, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1 , 1 , 1, 0 , 3 , 0, 0, 0, 0, 0, 0, 1, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 3, 0, 0, RO );
/**********************************************************************************/
// Cross Adapter
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
/**********************************************************************************/
// BCS
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_SOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_DESTINATION , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
/**********************************************************************************/
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CAMERA_CAPTURE , CAM$, 0 , 0 , 0 , CAM$ , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_NULL_CONTEXT_BB , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA );
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 0 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, NA);
// Shader resource uncachable, needed for WA_18013889147
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_L1_NOT_CACHED , 0 , 1 , 1 , 0 , 0 , 0, 0, 0, 0, 0, 0, 0, RO );
//Usages for command streamer instructions.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 1 , 1 , 1 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, RO);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_VIA_PAT , 1 , 0 , 0 , 0 , 3 , 0, 0, 0, 0, 0, 0, 0, NA);
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,311 @@
/*==============================================================================
Copyright(c) 2020 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define EDRAM (SKU(FtrEDram))
#define FBLLC (SKU(FtrFrameBufferLLC))
#define L1 (!WA(Wa_1606955757))
//Macros for segment-preference
#define NoP 0x0
#define SYS 0x1
#define LOC 0x2
#define LoP 0x3
#define SyP 0x4
// Cache Policy Definition
// L3_SCC = L3 skip caching control (disabled if L3_SCC = 0)
// HDCL1 = HDC L1 cache control (1 = cached in HDC L1, 0 = not cached in HDC L1)
// Faster PushWrite(Gen10+) used iff !WT, eLLC-only cacheable - Globally visible surface (eg display surface) should be marked WT
// GO = Global observable point for L3-uncached (0=Default is L3, 1= Memory)// GO = Global observable point for L3-uncached (0=Default is L3, 1= Memory)
// UcLookup = Snoop L3 for uncached (0=Default is no-snoop, 1 =Snoop)
// L1CC: L1 cache control (0: WBP write bypass mode, 1: UC uncached, 2: WB Write back, 3:WT write-through, 4: WS Write-Streaming) : Valid only for DG2
//***********************************************************************************************************************************************************/
// USAGE TYPE , L3 , L3_SCC, HDCL1, GO, UcLookup, L1CC)
/************************************************************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0, 0, 1, 1);
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0, 0, 1, 1);
//
// 3D Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1 , 0 , L1, 0, 1, 2);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MOCS_62 , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 1 , 0 , 0, 0, 1, 1);
// Tiled Resource
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_PAGE_POOL , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER , 1 , 0 , 0, 0, 1, 1);
//
// CM USAGES
//
// USAGE TYPE , L3 , L3_SCC, HDCL1, GO, UcLookup, L1CC)
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_L1_Enabled_SurfaceState, 1 , 0 , 1, 0, 1, 2);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_StateHeap, 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 0 , 0 , 1, 0, 1, 1);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0 , 0 , 0, 1, 0, 1);
//
// MP USAGES
//
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_FF, 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_RCS, 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_FF, 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_RCS, 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , 0 , 0, 1, 0, 1);
// MHW - SFC
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 0 , 0 , 0, 1, 0, 1);
//Media GMM Resource USAGES
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_FF , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_ROW_STORE_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_STREAMIN_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MV_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_STATUS_ERROR_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_LCU_ILDB_STREAMOUT_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_SEGMENT_ID_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_HVD_ROWSTORE_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_ILDB_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SSE_SRC_PIXEL_ROW_STORE_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SLICE_STATE_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CABAC_SYNTAX_STREAM_OUT_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRED_COL_STORE_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_UNCACHED , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_ONLY , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_ONLY , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ELLC_LLC_L3 , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS_MEDIA_WRITABLE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_HISTORY_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SOFTWARE_SCOREBOARD_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_MV_DATA_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DISTORTION_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_4XME_DISTORTION_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_INTRA_DISTORTION_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MB_STATS_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PAK_STATS_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_READ_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PIC_STATE_WRITE_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_COMBINED_ENC_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_CONSTANT_DATA_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_INTERMEDIATE_CU_RECORD_SURFACE_ENCODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SCRATCH_ENCODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_LCU_LEVEL_DATA_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_INPUT_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_HISTORY_OUTPUT_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_DEBUG_ENCODE , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CONSTANT_TABLE_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CU_RECORD_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_MV_TEMPORAL_BUFFER_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_CU_PACKET_FOR_PAK_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED1_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ENC_BCOMBINED2_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FRAME_STATS_STREAMOUT_DATA_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_LINE_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_TILE_COLUMN_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_TILE_LINE_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_TILE_COLUMN_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_TILE_LINE_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_TILE_COLUMN_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_COUNTER_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HUC_VIRTUAL_ADDR_REGION_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SIZE_STREAMOUT_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMPRESSED_HEADER_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROBABILITY_DELTA_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_RECORD_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_SIZE_STAS_BUFFER_CODEC , 0 , 0 , 0, 1, 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MAD_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_PAK_IMAGESTATE_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_BRC_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MB_BRC_CONST_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_MB_QP_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ROI_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBDISABLE_SKIPMAP_CODEC , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_SLICE_MAP_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_WP_DOWNSAMPLED_ENCODE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_VDENC_IMAGESTATE_ENCODE , 0 , 0 , 0, 1, 0, 1);
/**********************************************************************************/
//
// OCL Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0 , 0 , 0, 1, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 0 , 0 , 0, 1, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1 , 0 , 1, 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 0 , 0 , 0, 1, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1 , 0 , 0, 0, 1, 1);
/**********************************************************************************/
// Cross Adapter
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 1 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_NULL_CONTEXT_BB , 0 , 0 , 0, 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0 , 0 , 0, 1, 1, 1);
/**********************************************************************************/
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 0 , 1 , 0, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 0 , 1 , 0, 1);
//Usages for command streamer instructions
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 1 , 0 , 0 , 0 , 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 1 , 0 , 0 , 0 , 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 0 , 0 , 0 , 1 , 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 0 , 0 , 0 , 1 , 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_VIA_PAT , 0 , 0 , 0 , 1 , 0, 0);
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,205 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define ULT (SKU(FtrULT))
#define EDRAM (_ELLC > MB(0))
// [!] On Gen8, according to bpsec TC = 11b means L3, LLC and eLLC cachable.
// In order for resources to be places in L3, LLC/ELLC/L3 should be set to 1.
// ELLC = EDRAM indicate resource needed in EDRAM but ELLC = 1 indicate resource needed in L3
// Cache Policy Definition
//********************************************************************************************************************/
// USAGE TYPE , LLC , ELLC , L3 , WT , AGE )
/*********************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 1 , 1 , 1 , 1 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , !ULT , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0 , 0 , 0 );
//
// 3D Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , !EDRAM, EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 0 , EDRAM , 0 , EDRAM , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , !EDRAM, EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1 , 1 , 1 , 0 , 3 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 0 , EDRAM , 0 , 0 , 1 );
// Tiled Resource
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , !EDRAM, EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 0 , EDRAM , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 0 , 0 , 0 , 0 , 0 );
//
// CM USAGES
//
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1 , 1 , 1 , 0 , 1 );
//
// MP USAGES
//
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 0 , 0 , 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 0 , 0 , 0);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_No_L3_SurfaceState, 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState, 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , 0 , 0 , 0 , 0);
//Media GMM Resource USAGES
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC , 0 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , 1 , 1 , 0 , 1);
#if defined(__linux__) && !defined(ANDROID)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , 1 , 0 , 0 , 1);
#else
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , 1 , 1 , 0 , 1);
#endif
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP8_BLOCK_MODE_COST_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP8_MB_MODE_COST_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP8_MBENC_OUTPUT_ENCODE , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP8_HISTOGRAM_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP8_L3_LLC_ENCODE , 1 , 1 , 1 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MV_CODEC , 1 , 1 , 0 , 0 , 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MB_QP_CODEC , 1 , 1 , 1 , 0 , 1);
/**********************************************************************************/
//OCL Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 1 , 1 , 0 , 1 );
// This case is used for cases where we have kernels compiled for BTI 253 (non-cohrent) and they are cacheline mis-aligned
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 1 , 1 , 0 , 1 );
// This case is used for cases where we have kernels compiled for BTI 253 (non-cohrent) and they are cacheline mis-aligned
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 1 , 1 , 0 , 1 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 1 , 1 , 0 , 1 );
// Sampler overfetch issue is fixed on BDW
/*Project: BDW:B0+
For SURFTYPE_BUFFER, SURFTYPE_1D, and SURFTYPE_2D non-array, non-MSAA, non-mip-mapped surfaces in linear memory,
the only padding requirement is to the next aligned 64-byte boundary beyond the end of the surface.
The rest of the padding requirements documented above do not apply to these surfaces.*/
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 1 , 1 , 0 , 1 );
// Image from buffer when the image and buffer are on the kernel arguments list
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER , 1 , 1 , 0 , 0 , 1 );
/**********************************************************************************/
// Cross Adapter
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 0 , 0 , 0 , 0 , 0);
/**********************************************************************************/
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CAMERA_CAPTURE , CAM$ , 0 , 0 , 0 , CAM$ );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 0 , 0 , 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 0 , 0 , 0);
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,263 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
// true if edram is present
#define EDRAM (_ELLC > MB(0))
// true if edram is present but not 128 MB (GT4e)
#define GT3e (_ELLC > MB(0) && _ELLC < MB(128))
// true if edram is 128 MB
#define GT4e (_ELLC == MB(128))
#define KBL_GT3e (PRODUCT(KABYLAKE) && GT3e)
//eDRAM caching of displayables not supported on certain SKL CPUs
#define DISP_IN_EDRAM (EDRAM && !pGmmLibContext->GetWaTable().WaDisableEdramForDisplayRT)
//eDRAM-Only caching, for a usage that might be encrypted, must use ENCRYPTED_PARTIALS_EDRAM
#define ENCRYPTED_PARTIALS_EDRAM (DISP_IN_EDRAM && !pGmmLibContext->GetWaTable().WaEncryptedEdramOnlyPartials)
//eDRAM-only caching of unencrypted flip chains on SKL GT4
#define UNENCRYPTED_RT_EDRAM (DISP_IN_EDRAM && (!pGmmLibContext->GetWaTable().WaEncryptedEdramOnlyPartials || !GT3e))
// for SKL 3e we generally want EDRAM_ONLY mode (LLC=0,ELLC=1) = (!GT3e, EDRAM)
// for SKL 4e we generally want "both" mode (LLC=1,ELLC=1) = (!GT3e, EDRAM)
// i915 only supports three GEN9 MOCS entires:
// MOCS[0]...LLC=0, ELLC=0, L3=0, AGE=0
// MOCS[1]...<N/A for GmmLib Purposes>
// MOCS[2]...LLC=1, ELLC=1, L3=1, AGE=3
#define UC 0
#define WB 2
//***************************************************************************************************************/
// USAGE TYPE , LLC , ELLC , L3 , AGE , i915)
/****************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0 , 0 , UC );
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , DISP_IN_EDRAM, 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 0 , DISP_IN_EDRAM, 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0 , 0 , UC );
//
// 3D Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0 , 0 , 0 ,0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 0 , EDRAM , 1 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , !GT3e , EDRAM , 0 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 0 , ENCRYPTED_PARTIALS_EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GEN9_UNENCRYPTED_DISPLAYABLE , 0 , UNENCRYPTED_RT_EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0 , 0 , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 1 , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1 , 1 , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 1 , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 1 , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , !GT3e , EDRAM , 0 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , !GT3e , EDRAM , 0 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , !GT3e , EDRAM , 0 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 0 , 0 , 0 ,0 , UC );
// Tiled Resource
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , !GT3e , EDRAM , 0 ,1 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , !GT3e, EDRAM , 0 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , !GT3e , EDRAM , 1 ,3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE_PARTIALENCSURFACES , !GT3e , ENCRYPTED_PARTIALS_EDRAM, 1, 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 0 , EDRAM , 0 ,3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , !GT3e , EDRAM , 1 ,3 , WB );
//
// CM USAGES
//
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState , 1 , 1 , 0 , 3 , WB );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_ELLC_SurfaceState , 0 , 0 , 1 , 3 , UC );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_SurfaceState , 0 , 1 , 1 , 3 , UC );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_SurfaceState , 1 , 0 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_LLC_L3_SurfaceState , 0 , 1 , 0 , 3 , UC );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_ELLC_L3_SurfaceState , 1 , 0 , 0 , 3 , WB );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState , 0 , 0 , 0 , 3 , UC );
//
// MP USAGES
//
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 0 , 0, UC );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 0 , 0, UC );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , EDRAM , 1 , 1, WB);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_AGE3_SurfaceState, 1 , EDRAM , 1 , 3, WB);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_No_L3_SurfaceState, 1 , EDRAM , 0 , 1, WB);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_No_LLC_L3_SurfaceState, 0 , EDRAM , 0 , 1, UC);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_No_LLC_L3_AGE_SurfaceState, 0 , EDRAM , 0 , 0, UC);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_No_LLC_eLLC_L3_AGE_SurfaceState, 0 , 0 , 0 , 0, UC);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_PartialEnc_No_LLC_L3_AGE_SurfaceState, 0 , ENCRYPTED_PARTIALS_EDRAM, 0 , 0, UC);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , EDRAM , 0 , 0, UC );
// MHW - SFC
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0 , EDRAM , 0 , 0, UC );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface_PartialEncSurface, 0 , ENCRYPTED_PARTIALS_EDRAM, 0, 0, UC );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 1 , EDRAM , 1 , 1, WB );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 1 , EDRAM , 1 , 1, WB );
//Media GMM Resource USAGES
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRE_DEBLOCKING_CODEC_PARTIALENCSURFACE , 0 , ENCRYPTED_PARTIALS_EDRAM, 0, 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POST_DEBLOCKING_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_ENCODE , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ORIGINAL_UNCOMPRESSED_PICTURE_DECODE , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAMOUT_DATA_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INTRA_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEBLOCKINGFILTER_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_REFERENCE_PICTURE_CODEC , 1 , EDRAM , 0 , 1, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MACROBLOCK_STATUS_BUFFER_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_BITSTREAM_OBJECT_DECODE , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFX_INDIRECT_MV_OBJECT_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFD_INDIRECT_IT_COEF_OBJECT_DECODE , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MFC_INDIRECT_PAKBASE_OBJECT_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BSDMPC_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MPR_ROWSTORE_SCRATCH_BUFFER_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BITPLANE_READ_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_AACSBIT_VECTOR_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DIRECTMV_BUFFER_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_CURR_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_REF_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MV_DATA_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_HME_DOWNSAMPLED_ENCODE_DST , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_BRC_ME_DISTORTION_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PAK_OBJECT_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_FLATNESS_CHECK_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MBENC_CURBE_ENCODE , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_ROW_STORE_BUFFER_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VDENC_STREAMIN_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SURFACE_MB_QP_CODEC , 1 , EDRAM , 1 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MD_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_SAO_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_MV_CODEC , 1 , EDRAM , 0 , 3, WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_STATUS_ERROR_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HCP_LCU_ILDB_STREAMOUT_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_PROBABILITY_BUFFER_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_SEGMENT_ID_BUFFER_CODEC , 0 , EDRAM , 0 , 3, UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP9_HVD_ROWSTORE_BUFFER_CODEC , 0 , EDRAM , 0 , 3, UC );
/**********************************************************************************/
//
// OCL Usages
//
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0 , 0 , 0 , 3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 1 , 1 , 0 , 3 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 1 , 1 , 3 , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 1 , 1 , 3 , WB );
// Image from buffer when the image and buffer are on the kernel arguments list
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER , 1 , 1 , 0 , 3 , WB );
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_OCL_BUFFER_NO_LLC_CACHING , 0 , 1 , 1 , 3 , UC );
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_OCL_IMAGE_NO_LLC_CACHING , 0 , 1 , 1 , 3 , UC );
/**********************************************************************************/
// Cross Adapter
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 0 , 0 , 0 , 0, UC );
/**********************************************************************************/
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CAMERA_CAPTURE , CAM$, 0 , 0 , CAM$ , WB );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0 , 0 , 0 , 0 , UC );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 0 , 0 , UC);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 0 , 0 , UC);
//Usages for command streamer instructions
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 0 , 0 , 1 , 0 , UC);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 0 , 0 , 1 , 0 , UC);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 0 , 0 , 0 , 0 , UC);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 0 , 0 , 0 , 0 , UC);
#undef UC
#undef WB
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,311 @@
/*==============================================================================
Copyright(c) 2024 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define _SN 0x1
#define _IA_GPU_SN 0x2
#define _WT 0x2
#define _L1_WB 0x2
#define dGPU SKU(FtrDiscrete)
#define IgPAT (SKU(FtrPATCentricCachePolicy) ? 0 : 1)
#define L3_WB SKU(FtrPATCentricCachePolicy) //Unknown/umd_batch_buffer usage promoting to WB in PAT cache policy
#define iGPU (!dGPU)
#define L4_IgPAT (iGPU & (GFX_GET_CURRENT_PRODUCT((pGmmLibContext->GetPlatformInfo()).Platform) < IGFX_PTL)) // L4 Uncached and IgPAT = 0
#if (_DEBUG || _RELEASE_INTERNAL)
#define _WA_WB_Emu (WA(Wa_EmuMufasaSupportOnBmg))
#else
#define _WA_WB_Emu 0
#endif
// GmmLib can apply 2Way WA to GMM_RESOURCE_USAGE_HW_CONTEXT.
#define _WA_2W (WA(Wa_14018976079) || WA(Wa_14018984349)) ? 2 : 0
#define _L3_P ((_WA_2W == 2) ? 1 : 0) // L3 Promotion to WB if 2Way Coh WA is set
#define _L3_WB (SKU(FtrPATCentricCachePolicy) || _WA_WB_Emu) //Promote L3 to WB in PAT cache policy
// clang-format off
//typedef enum GMM_CACHING_POLICY_REC
//{
// GMM_UC = 0x0, //uncached
// GMM_WB = 0x1, // Write back
// GMM_WT = 0x2, // write-through
// GMM_WBTD = 0x3, // WB_T_Display
// GMM_WBTA = 0x4, // WB_T_App
// GMM_WBP = 0x5, // write bypass mode
// GMM_WS = 0x6, // Write-Streaming
//} GMM_CACHING_POLICY;
//
// typedef enum GMM_COHERENCY_TYPE_REC
//{
//GMM_NON_COHERENT_NO_SNOOP = 0x0,
//GMM_COHERENT_ONE_WAY_IA_SNOOP = 0x1,
//GMM_COHERENT_TWO_WAY_IA_GPU_SNOOP = 0x2
//} GMM_COHERENCY_TYPE;
// Cache Policy Definition
// L3_CLOS : L3 class of service (0,1,2,3)
// IgPAT : Ignore PAT 1 = Override by MOCS, 0 = Defer to PAT
//Macros for segment-preference
#define NoP 0x0
//Wa_14018443005
#define COMPRESSED_PAT_WITH_L4WB_L3UC_0 PAT10
#define COMPRESSED_PAT_WITH_L4WB_L3WB_0 PAT14
#define COMPRESSED_PAT_WITH_L4UC_L3UC_0 PAT12
#define COMPRESSED_PAT_WITH_L4UC_L3WB_0 PAT9
#define ISWA_1401844305USAGE(usage) ((Usage == GMM_RESOURCE_USAGE_BLT_SOURCE) || \
(Usage == GMM_RESOURCE_USAGE_BLT_DESTINATION) || \
(Usage == GMM_RESOURCE_USAGE_COPY_SOURCE) || \
(Usage == GMM_RESOURCE_USAGE_COPY_DEST))
//******************************************************************************************************************************************************************/
// USAGE TYPE L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT, SegOv)
/*******************************************************************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , _L3_P, 0, 0, 0 , 0 , _WA_2W, IgPAT, NoP);
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled .
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0, 0, 0, 0 , 0 , 0 , 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0, 0, 0, 0 , 0 , 0 , 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , _L3_P, 0, 0, 0 , 0 , _WA_2W, IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , L3_WB, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
//
// 3D Usages
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency , IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1, 0, 1, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC , 0, 0, 0, 0 , 0 , 0 , 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , _WA_WB_Emu, 0, 0, 0 , 0 , 1 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , _L3_WB, 0, 0, 0 , 0 , 1 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MOCS_62 , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_OCA_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
// Tiled Resource
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC , 0, 0, 0, 0 , 0 , 0 , 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_PAGE_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
//
// CM USAGES
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_L1_Enabled_SurfaceState, 1, 0, 1, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_StateHeap, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 0, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
//
// MP USAGES
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT )
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_FF, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_RCS, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_FF, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_RCS, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
// MHW - SFC
// USAGE TYPE , L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
/**********************************************************************************/
//
// OCL Usages
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency , IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED ,_L3_P, 0, 0, 0 , 0 , _WA_2W , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1, 0, 0, 0 , 0 , 1 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED ,_L3_P, 0, 0, 0 , 0 , _WA_2W , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
/**********************************************************************************/
// Cross Adapter
// USAGE TYPE ,L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency , IgPAT)
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 1, 0, 1, 0 , 0 , 0 , IgPAT, NoP);
/**********************************************************************************/
// BCS
// USAGE TYPE L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_SOURCE , 0, 0, 0, 0, 0, 0, 1, NoP);
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_DESTINATION , 0, 0, 0, 0, 0, 0, 1, NoP);
/**********************************************************************************/
//
// MEDIA USAGES
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT )
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MEDIA_BATCH_BUFFERS , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
// DECODE
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INPUT_BITSTREAM , 1, 0, 0, 0, L4_IgPAT, 0 , L4_IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INPUT_REFERENCE , 1, 0, 0, 1, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_WRITE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_CACHE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_NOCACHE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_PICTURE , 3, 0, 0, 0, 2, 0 , 0 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_WRITE , 0, 0, 0, 0, 0, 1 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_READ_WRITE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
// ENCODE
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INPUT_RAW , 1, 0, 0, 0, L4_IgPAT, 0 , L4_IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INPUT_RECON , 1, 0, 0, 1, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_WRITE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_CACHE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_NOCACHE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_EXTERNAL_READ , 0, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_PICTURE , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_BITSTREAM , 0, 0, 0, 0, 0, 1 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_WRITE , 0, 0, 0, 0, 0, 1 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_READ_WRITE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
// VP
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_FF , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_FF , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_FF , 0, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_FF , 0, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_FF , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_FF , 3, 0, 0, 0, 2, 0 , 0 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER , 1, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_RENDER , 1, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_RENDER , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_RENDER , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER , 1, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER , 3, 0, 0, 0, 0, 0 , 0 , NoP );
// CP
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CP_EXTERNAL_READ , 0, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CP_INTERNAL_WRITE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GSC_KMD_RESOURCE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_NULL_CONTEXT_BB , 0, 0, 0, 0 , 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0, 0, 0, 0 , 0, 0 , 0 , NoP );
// USAGE TYPE , L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT)
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0, 0, 0 , 0, 0, 0, 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0, 0, 0 , 0, 0, 0, 1, NoP);
//Usages for command streamer instructions
// USAGE TYPE , L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 1, 0, 0 , 0, 0, 0, 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 1, 0, 0 , 0, 0, 1, 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 1, 0, 0 , 0, 0, 2, 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 1, 0, 0 , 0, 0, 2, IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_VIA_PAT , 1, 0, 0 , 0, 0, 2, 0 , NoP);
// clang-format on
#undef L3_WB
#undef _WT
#undef iGPU
#undef L4_IgPAT
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,317 @@
/*==============================================================================
Copyright(c) 2025 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define _SN 0x1
#define _IA_GPU_SN 0x2
#define _WT 0x2
#define _L1_WB 0x2
#define dGPU SKU(FtrDiscrete)
#define IgPAT (SKU(FtrPATCentricCachePolicy) ? 0 : 1)
#define L3_WB SKU(FtrPATCentricCachePolicy) //Unknown/umd_batch_buffer usage promoting to WB in PAT cache policy
#if (_DEBUG || _RELEASE_INTERNAL)
#define _WA_WB_Emu (WA(Wa_EmuMufasaSupportOnBmg))
#else
#define _WA_WB_Emu 0
#endif
#define _L3_WB (SKU(FtrPATCentricCachePolicy) || _WA_WB_Emu) //Promote L3 to WB for in PAT cache policy
// clang-format off
//typedef enum GMM_CACHING_POLICY_REC
//{
// GMM_UC = 0x0, //uncached
// GMM_WB = 0x1, // Write back
// GMM_WT = 0x2, // write-through
// GMM_WBTD = 0x3, // WB_T_Display
// GMM_WBTA = 0x4, // WB_T_App
// GMM_WBP = 0x5, // write bypass mode
// GMM_WS = 0x6, // Write-Streaming
//} GMM_CACHING_POLICY;
//
// typedef enum GMM_COHERENCY_TYPE_REC
//{
//GMM_NON_COHERENT_NO_SNOOP = 0x0,
//GMM_COHERENT_ONE_WAY_IA_SNOOP = 0x1,
//GMM_COHERENT_TWO_WAY_IA_GPU_SNOOP = 0x2
//} GMM_COHERENCY_TYPE;
// Cache Policy Definition
// L3_CLOS : L3 class of service (0,1,2,3)
// IgPAT : Ignore PAT 1 = Override by MOCS, 0 = Defer to PAT
//
//Macros for segment-preference
#define NoP 0x0
#define NonLocal_Only 0x1
#define Local_Only 0x2
#define LMemBarOrNonLocal_Only 0x3
#define SystemOverflowToLocal 0x4
#define NonLocalOnlyOnLimitedLmemBar 0x5
#define LMemBar_Preferred 0x6
#define LMemBar_Indifferent 0x7
#define ISWA_1401844305USAGE(usage) ((Usage == GMM_USAGE_COPY_SOURCE) || \
(Usage == GMM_USAGE_COPY_DEST) || \
(Usage == GMM_RESOURCE_USAGE_BLT_SOURCE) || \
(Usage == GMM_RESOURCE_USAGE_BLT_DESTINATION) || \
(Usage == GMM_RESOURCE_USAGE_COPY_SOURCE) || \
(Usage == GMM_RESOURCE_USAGE_COPY_DEST))
// SegOv: Override segment preference : 0= Default ie no override, 1=NonLocal_Only ie NonLocal Only, 2=Local_Only ie Local Only (NonCpuVisible Bar on Small Lmem Configs else CpuVisble Bar)
// SegOv: 3=LMemBarOrNonLocalOnly ie CpuVisible Bar but overflow to System, 4=SystemOverflowToLocal ie System but overflow to Local,
// SegOV: 5=NonLocalOnlyOnLimitedLmemBar ie System Only on Small Lmem Configs,
// SegOV: 6=LMemBarPreferred ie CpuVisible Bar overflow to NonCPUVisible bar overlow to System
// SegOV: 7= LMemBarIndifferent ie NonCPUVisible Bar overflow to System)
//******************************************************************************************************************************************************************/
// USAGE TYPE L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT, SegOv)
/*******************************************************************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled .
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0, 0, 0, 0 , 0 , 0 , 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0, 0, 0, 0 , 0 , 0 , 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , L3_WB, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
//
// 3D Usages
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency , IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 3, 0, 0, 0 , 0 , 0 , 0 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1, 0, 1, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC , 0, 0, 0, 0 , 0 , 0 , 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , _WA_WB_Emu, 0, 0, 0 , 0 , 1 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , _L3_WB, 0, 0, 0 , 0 , 1 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MOCS_62 , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_OCA_BUFFER , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
// Tiled Resource
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC , 0, 0, 0, 0 , 0 , 0 , 1 , NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_PAGE_POOL , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
//
// CM USAGES
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_L1_Enabled_SurfaceState, 1, 0, 1, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_StateHeap, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 0, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
//
// MP USAGES
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT )
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_FF, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_RCS, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_FF, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_RCS, 1, 0, 0, 0 , 1 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
// MHW - SFC
// USAGE TYPE , L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
/**********************************************************************************/
//
// OCL Usages
//
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency , IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1, 0, 5, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1, 0, 0, 0 , 0 , 1 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 0, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1, 0, 0, 0 , 0 , 0 , IgPAT, NoP);
/**********************************************************************************/
// Cross Adapter
// USAGE TYPE ,L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency , IgPAT)
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 1, 0, 1, 0 , 0 , 0 , IgPAT, NoP);
/**********************************************************************************/
// BCS
// USAGE TYPE L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_SOURCE , 0, 0, 0, 0, 0, 0, 1, NoP);
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_DESTINATION , 0, 0, 0, 0, 0, 0, 1, NoP);
/**********************************************************************************/
//
// MEDIA USAGES
// USAGE TYPE L3_CC, L3_CLOS,L1CC, L2CC, L4CC, Coherency, IgPAT )
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MEDIA_BATCH_BUFFERS , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
// DECODE
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INPUT_BITSTREAM , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INPUT_REFERENCE , 1, 0, 0, 1, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_WRITE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_CACHE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_NOCACHE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_PICTURE , 3, 0, 0, 0, 2, 0 , 0 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_WRITE , 0, 0, 0, 0, 0, 1 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_READ_WRITE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
// ENCODE
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INPUT_RAW , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INPUT_RECON , 1, 0, 0, 1, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_WRITE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_CACHE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_NOCACHE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_EXTERNAL_READ , 0, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_PICTURE , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_BITSTREAM , 0, 0, 0, 0, 0, 1 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_WRITE , 0, 0, 0, 0, 0, 1 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_READ_WRITE , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
// VP
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_FF , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_FF , 1, 0, 0, 0, 1, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_FF , 0, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_FF , 0, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_FF , 1, 0, 0, 0, 1, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_FF , 3, 0, 0, 0, 2, 0 , 0 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER , 1, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_RENDER , 1, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_RENDER , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_RENDER , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER , 1, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER , 3, 0, 0, 0, 0, 0 , 0 , NoP );
// CP
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CP_EXTERNAL_READ , 0, 0, 0, 0, 0, 0 , 1 , NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CP_INTERNAL_WRITE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GSC_KMD_RESOURCE , 0, 0, 0, 0, 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_NULL_CONTEXT_BB , 0, 0, 0, 0 , 0, 0 , IgPAT, NoP );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0, 0, 0, 0 , 0, 0 , 0 , NoP );
// USAGE TYPE , L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT)
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0, 0, 0 , 0, 0, 0, 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0, 0, 0 , 0, 0, 0, 1, NoP);
// Usages for command streamer instructions.
// USAGE TYPE , L3_CC, L3_CLOS, L1CC, L2CC, L4CC, Coherency, IgPAT)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 1, 0, 0 , 0, 0, 0, 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 1, 0, 0 , 0, 0, 1, 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 1, 0, 0 , 0, 0, 2, 1, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 1, 0, 0 , 0, 0, 2, IgPAT, NoP);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_VIA_PAT , 1, 0, 0 , 0, 0, 2, 0, NoP);
// clang-format on
#undef L3_WB
#undef _WT
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,263 @@
/*==============================================================================
Copyright(c) 2022 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#include "GmmCachePolicyConditionals.h"
#define _SN 0x1
#define _IA_GPU_SN 0x2
#define _WT 0x2
#define _L1_WB 0x2
// Cache Policy Definition
// L3_SCC : L3 skip caching control (disabled if L3_SCC = 0)
// GO : Global observable point for L3-uncached (0=Default is L3, 1= Memory)
// UcLookup : Snoop L3 for uncached (0=Default is no-snoop, 1 =Snoop)
// L1CC : L1 cache control (0: WBP write bypass mode, 1: 0 uncached, 2: WB Write back, 3:WT write-through, 4: WS Write-Streaming) : Valid only for DG2+
// L2CC : 0 : 0, 1: WB
// L4CC : 0 : UC, 1: wB, 2: WT
// Coherency : 0= NoSnoop (non coherent) 1: 1 way coherent with IA Snoop (GPU snoop of CPU cache) 2: 2 way coherent IA GPU Snoop [Snoop is always to LLC from CPU/GPU internal caches]
//******************************************************************************************************************************************************************/
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency)
/*******************************************************************************************************************************************************************/
// KMD Usages
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BATCH_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMP_FRAME_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SWITCH_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CURSOR , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAY_STATIC_IMG_FOR_SMOOTH_ROTATION_BUFFER , 1 , 0 , 0, 1, 1, 0 , _WT , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DUMMY_PAGE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GDI_SURFACE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GENERIC_KMD_RESOURCE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
// GMM_RESOURCE_USAGE_GFX_RING is only used if WaEnableRingHostMapping is enabled.
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GFX_RING , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GTT_TRANSFER_REGION , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HW_CONTEXT , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATE_MANAGER_KERNEL_STATE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_STAGING_SURFACE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MBM_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_NNDI_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OVERLAY_MBM , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PRIMARY_SURFACE , 1 , 0 , 0, 1, 1, 0 , _WT , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SCREEN_PROTECTION_INTERMEDIATE_SURFACE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADOW_SURFACE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SM_SCRATCH_STATE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STATUS_PAGE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TIMER_PERF_QUEUE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNKNOWN , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UNMAP_PAGING_RESERVED_GTT_DMA_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VSC_BATCH_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WA_BATCH_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_OCA_BUFFER , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
//
// 3D Usages
//
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UMD_BATCH_BUFFER , 0 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_BINDING_TABLE_POOL , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CCS , 0 , 0 , 1, 0, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONSTANT_BUFFER_POOL , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEPTH_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DISPLAYABLE_RENDER_TARGET , 1 , 0 , 0, 1, 1, 0 , _WT , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GATHER_POOL , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_SURFACE_STATE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_DYNAMIC_STATE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_GENERAL_STATE_UC , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_STATELESS_DATA_PORT_L1_CACHED , 1 , 0 , 0, 1, _L1_WB, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INDIRECT_OBJECT , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HEAP_INSTRUCTION , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_HIZ , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_COHERENT_UC , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_INDEX_BUFFER_L3_CACHED , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MCS , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PUSH_CONSTANT_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PULL_CONSTANT_BUFFER , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_QUERY , 0 , 0 , 0, 1, 1, 0 , 1 , _SN );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STAGING , 0 , 0 , 1, 0, 1, 0 , 1 , _SN );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STENCIL_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_STREAM_OUTPUT_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILE_POOL , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_SHADER_RESOURCE_LLC_BYPASS , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MOCS_62 , 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION , 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_L3_EVICTION_SPECIAL , 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PROCEDURAL_TEXTURE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
// Tiled Resource
//
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_DEPTH_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_HIZ , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_MCS , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_CCS , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_SHADER_RESOURCE , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_TILED_UAV , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_UAV , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_COHERENT_UC , 0 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VERTEX_BUFFER_L3_CACHED , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OGL_WSTN_VERTEX_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_POSH_VERTEX_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_RENDER_TARGET_AND_SHADER_RESOURCE , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_WDDM_HISTORY_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CONTEXT_SAVE_RESTORE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_PAGE_POOL , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_PTBR_BATCH_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
//
// CM USAGES
//
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_SurfaceState, 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_L1_Enabled_SurfaceState, 1 , 0 , 0, 1, 2, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_StateHeap, 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_L3_SurfaceState, 0 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(CM_RESOURCE_USAGE_NO_CACHE_SurfaceState, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
//
// MP USAGES
//
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_BEGIN, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_FF, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_DEFAULT_RCS, 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState, 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_FF, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_SurfaceState_RCS, 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(MP_RESOURCE_USAGE_END, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
// MHW - SFC
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_CurrentOutputSurface, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_AvsLineBufferSurface, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(MHW_RESOURCE_USAGE_Sfc_IefLineBufferSurface, 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
/**********************************************************************************/
//
// OCL Usages
//
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC , 0 , 0 , 1, 1, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED , 0 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_IMAGE , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC , 1 , 0 , 0, 1, 0, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SCRATCH , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRIVATE_MEM , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_PRINTF_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED , 0 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_ISH_HEAP_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TAG_MEMORY_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_TEXTURE_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_OCL_SELF_SNOOP_BUFFER , 1 , 0 , 0, 1, 1, 0 , 1 , 0 );
/**********************************************************************************/
// Cross Adapter
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_XADAPTER_SHARED_RESOURCE , 0 , 0 , 0, 1, 1, 0 , 0 , 0 );
/**********************************************************************************/
// BCS
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_SOURCE , 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
DEFINE_CACHE_ELEMENT( GMM_RESOURCE_USAGE_BLT_DESTINATION , 0 , 0 , 1, 0, 1, 0 , 0 , 0 );
/**********************************************************************************/
//
// MEDIA USAGES
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency )
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_MEDIA_BATCH_BUFFERS , 0 , 0 , 1, 0, 1, 0, 0, 0 );
// DECODE
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INPUT_BITSTREAM , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INPUT_REFERENCE , 0 , 0 , 1, 0, 1, 1, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_WRITE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_CACHE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_INTERNAL_READ_WRITE_NOCACHE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_PICTURE , 0 , 0 , 0, 1, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_WRITE , 0 , 0 , 1, 0, 1, 0, 0, _SN );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DECODE_OUTPUT_STATISTICS_READ_WRITE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
// ENCODE
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INPUT_RAW , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INPUT_RECON , 0 , 0 , 1, 0, 1, 1, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_WRITE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_CACHE , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_INTERNAL_READ_WRITE_NOCACHE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_EXTERNAL_READ , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_PICTURE , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_BITSTREAM , 0 , 0 , 1, 0, 1, 0, 1, _SN );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_WRITE , 0 , 0 , 1, 0, 1, 0, 0, _SN );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_ENCODE_OUTPUT_STATISTICS_READ_WRITE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
// VP
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_FF , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_FF , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_FF , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_FF , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_FF , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_FF , 1 , 0 , 0, 1, 1, 0, _WT, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER , 1 , 0 , 0, 1, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INPUT_REFERENCE_RENDER , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_RENDER , 0 , 0 , 1, 0, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_WRITE_RENDER , 1 , 0 , 0, 1, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER , 1 , 0 , 0, 1, 1, 0, 1, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_VP_OUTPUT_PICTURE_RENDER , 1 , 0 , 0, 1, 1, 0, _WT, 0 );
// CP
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CP_EXTERNAL_READ , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_CP_INTERNAL_WRITE , 0 , 0 , 1, 0, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_GSC_KMD_RESOURCE , 0 , 0 , 0, 1, 1, 0, 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_KMD_NULL_CONTEXT_BB , 0 , 0 , 0, 1, 1, 0 , 0, 0 );
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COMMAND_STREAMER , 0 , 0 , 1, 1, 1, 0 , 0, 0 );
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency)
// Uncacheable copies
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_SOURCE , 0 , 0 , 1 , 0 , 1 , 0, 0, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COPY_DEST , 0 , 0 , 1 , 0 , 1 , 0, 0, 0);
//Usages for command streamer instructions
// USAGE TYPE , L3, L3_SCC, GO, UcLookup, L1CC, L2CC, L4CC, Coherency)
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_DEFAULT , 1 , 0 , 0 , 1 , 0 , 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_COARSE_GRAINED_COHERENT , 1 , 0 , 0 , 1 , 0 , 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT , 0 , 0 , 1 , 1 , 0 , 0, 1, 1);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_MULTI_WRITE , 0 , 0 , 1 , 1 , 0 , 0, 1, 0);
DEFINE_CACHE_ELEMENT(GMM_RESOURCE_USAGE_FINE_GRAINED_COHERENT_VIA_PAT , 0 , 0 , 1 , 1 , 0 , 0, 1, 1);
#include "GmmCachePolicyUndefineConditionals.h"

View File

@ -0,0 +1,122 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../inc/External/Common/GmmMemAllocator.hpp"
#include "../inc/External/Common/GmmTextureExt.h"
namespace GmmLib {
class Context;
class NON_PAGED_SECTION PlatformInfo : public GmmMemAllocator
{
public:
static int32_t RefCount;
static int32_t OverrideRefCount;
protected:
GMM_PLATFORM_INFO Data;
Context * pGmmLibContext;
public:
PlatformInfo(PLATFORM &Platform, Context* pGmmLibContext);
virtual ~PlatformInfo()
{
}
const GMM_PLATFORM_INFO& GetData()
{
return Data;
}
virtual void ApplyExtendedTexAlign(uint32_t CCSMode, ALIGNMENT& UnitAlign)
{
GMM_UNREFERENCED_PARAMETER(CCSMode);
GMM_UNREFERENCED_PARAMETER(UnitAlign);
}
virtual uint8_t OverrideCompressionFormat(GMM_RESOURCE_FORMAT Format, uint8_t IsMC)
{
GMM_UNREFERENCED_PARAMETER(Format);
GMM_UNREFERENCED_PARAMETER(IsMC);
return 0;
}
void SetDataSurfaceMaxSize(uint64_t Size)
{
Data.SurfaceMaxSize = Size;
}
void SetDataFBCRequiredStolenMemorySize(uint32_t Size)
{
Data.FBCRequiredStolenMemorySize = Size;
}
void SetDataNumberFenceRegisters(uint32_t Number)
{
Data.NumberFenceRegisters = Number;
}
virtual void SetCCSFlag(GMM_RESOURCE_FLAG &Flags);
virtual uint8_t ValidateMMC(GMM_TEXTURE_INFO &Surf);
virtual uint8_t ValidateCCS(GMM_TEXTURE_INFO &Surf);
virtual uint8_t ValidateUnifiedAuxSurface(GMM_TEXTURE_INFO &Surf);
virtual uint8_t CheckFmtDisplayDecompressible(GMM_TEXTURE_INFO &Surf,
bool IsSupportedRGB64_16_16_16_16,
bool IsSupportedRGB32_8_8_8_8,
bool IsSupportedRGB32_2_10_10_10,
bool IsSupportedMediaFormats);
};
}
#define GMM_PLATFORM_INFO_CLASS GmmLib::PlatformInfo
#else
typedef struct PlatformInfo PlatformInfo;
#define GMM_PLATFORM_INFO_CLASS PlatformInfo
#endif
//***************************************************************************
//
// GMM_PLATFORM_INFO Internl API
//
//***************************************************************************
#define SET_TILE_MODE_INFO(Mode, _Width, _Height, _Depth, _MtsWidth, _MtsHeight, _MtsDepth) \
{ \
Data.TileInfo[Mode].LogicalTileWidth = GMM_BYTES(_Width); \
Data.TileInfo[Mode].LogicalTileHeight = GMM_SCANLINES(_Height); \
Data.TileInfo[Mode].LogicalTileDepth = (_Depth); \
Data.TileInfo[Mode].LogicalSize = (_Width) * (_Height) * (_Depth); \
Data.TileInfo[Mode].MaxPitch = GMM_KBYTE(256); \
Data.TileInfo[Mode].MaxMipTailStartWidth = (_MtsWidth); \
Data.TileInfo[Mode].MaxMipTailStartHeight = (_MtsHeight); \
Data.TileInfo[Mode].MaxMipTailStartDepth = (_MtsDepth); \
}
#if __cplusplus
extern "C" {
#endif
const GMM_PLATFORM_INFO *GMM_STDCALL __GmmGetPlatformInfo(void *pLibContext);
void GMM_STDCALL __SetNumberFenceRegisters(void *pLibContext, uint32_t Number);
#if __cplusplus
}
#endif

View File

@ -0,0 +1,662 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#include "External/Common/GmmInternal.h" // UMD or KMD Windows header
#include "External/Common/GmmTextureExt.h"
#include "External/Common/GmmUtil.h"
#include "External/Common/GmmInfoExt.h"
#include "External/Common/GmmInfo.h"
#include "External/Common/GmmProto.h"
#ifdef __cplusplus
#include "Internal/Common/Texture/GmmTextureCalc.h"
//---------------------------------------------------------------------------
// ExpandWidth/Height Wrappers
//
// Gen7+ MSAA (non-Depth/Stencil) render targets use array expansion instead of
// Width/Height expansion--So they pass NumSamples=1 to __GmmExpandXxx functions.
//
//---------------------------------------------------------------------------
#define __GMM_EXPAND_Xxx(ptr, Xxx, Dimension, UnitAlignment, pTexInfo) \
(ptr)->Expand##Xxx( \
(Dimension), (UnitAlignment), \
((pTexInfo)->Flags.Gpu.Depth || (pTexInfo)->Flags.Gpu.SeparateStencil) ? \
(pTexInfo)->MSAA.NumSamples : 1)
#define __GMM_EXPAND_WIDTH(ptr, __Width, UnitAlignment, pTexInfo) \
__GMM_EXPAND_Xxx(ptr, Width, __Width, UnitAlignment, pTexInfo)
#define __GMM_EXPAND_HEIGHT(ptr, __Height, UnitAlignment, pTexInfo) \
__GMM_EXPAND_Xxx(ptr, Height, __Height, UnitAlignment, pTexInfo)
//=============================================================================
//Function:
// __GmmTexFillHAlignVAlign
//
//Description:
// Stores in pTexInfo the appropriate unit aligment sizes.
//
//-----------------------------------------------------------------------------
// Gmmlib 2.0 TODO[Low] Move to Class and Inline function handling.
GMM_INLINE GMM_STATUS __GmmTexFillHAlignVAlign(GMM_TEXTURE_INFO *pTexInfo,GMM_LIB_CONTEXT* pGmmLibContext)
{
uint32_t UnitAlignWidth = 0;
uint32_t UnitAlignHeight = 0;
uint32_t UnitAlignDepth = 0;
const GMM_PLATFORM_INFO *pPlatform;
GMM_TEXTURE_CALC *pTextureCalc;
GMM_DPF_ENTER;
__GMM_ASSERTPTR(pGmmLibContext,GMM_ERROR);
__GMM_ASSERTPTR(pTexInfo, GMM_ERROR);
#define SET_ALIGN_FACTOR(Xxx, Bytes) \
if(!pGmmLibContext->GetSkuTable().FtrTileY) \
{ \
UnitAlign##Xxx = \
(pTexInfo->BitsPerPixel == 128) ? Bytes/16 : \
(pTexInfo->BitsPerPixel == 64) ? Bytes/8 : \
(pTexInfo->BitsPerPixel == 32) ? Bytes/4 : \
(pTexInfo->BitsPerPixel == 16) ? Bytes/2 : Bytes ; \
\
if(!pTexInfo->Flags.Info.Linear && \
(pTexInfo->BitsPerPixel == 24 || pTexInfo->BitsPerPixel == 48 || pTexInfo->BitsPerPixel == 96)) \
{ \
UnitAlign##Xxx = 16; \
} \
else if (pTexInfo->Flags.Info.Linear && \
(pTexInfo->BitsPerPixel == 24 || pTexInfo->BitsPerPixel == 48 || pTexInfo->BitsPerPixel == 96))\
{ \
UnitAlign##Xxx = 128; \
} \
}
if (!((pTexInfo->Format > GMM_FORMAT_INVALID) &&
(pTexInfo->Format < GMM_RESOURCE_FORMATS)))
{
GMM_DPF_CRITICAL("Invalid Resource Format");
return GMM_ERROR;
}
if( !pTexInfo->Alignment.HAlign &&
!pTexInfo->Alignment.VAlign)
{
pPlatform = GMM_OVERRIDE_PLATFORM_INFO(pTexInfo,pGmmLibContext);
pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(pTexInfo,pGmmLibContext);
/// SKL TiledYf/Ys Surfaces //////////////////////////////////////////
if( ((GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE) &&
(pTexInfo->Flags.Info.TiledYf || GMM_IS_64KB_TILE(pTexInfo->Flags))))
{
#define SET_ALIGN_INFO(Xxx, A1, A2, A3, A4, A5) \
UnitAlign##Xxx = \
(pTexInfo->BitsPerPixel == 128) ? A1 : \
(pTexInfo->BitsPerPixel == 64) ? A2 : \
(pTexInfo->BitsPerPixel == 32) ? A3 : \
(pTexInfo->BitsPerPixel == 16) ? A4 : A5; \
if(pTexInfo->Type == RESOURCE_1D)
{
if(pTexInfo->Flags.Info.TiledYf)
{
SET_ALIGN_INFO(Width, 256, 512, 1024, 2048, 4096);
}
else // if(pTexInfo->Flags.Info.TiledYs)
{
SET_ALIGN_INFO(Width, 4096, 8192, 16384, 32768, 65536);
}
}
else if((pTexInfo->Type == RESOURCE_2D) || (pTexInfo->Type == RESOURCE_CUBE) ||
(pTexInfo->Type == RESOURCE_PRIMARY))
{
if(pTexInfo->Flags.Info.TiledYf)
{
SET_ALIGN_INFO(Width, 16, 32, 32, 64, 64);
SET_ALIGN_INFO(Height, 16, 16, 32, 32, 64);
}
else // if(pTexInfo->Flags.Info.TiledYs)
{
SET_ALIGN_INFO(Width, 64, 128, 128, 256, 256);
SET_ALIGN_INFO(Height, 64, 64, 128, 128, 256);
}
// Only color buffer MSAA
if(pTexInfo->MSAA.NumSamples > 1 &&
!pTexInfo->Flags.Gpu.Depth &&
!pTexInfo->Flags.Gpu.SeparateStencil)
{
if(pGmmLibContext->GetSkuTable().FtrTileY)
{
switch(pTexInfo->MSAA.NumSamples)
{
case 16:
UnitAlignWidth /= 4;
UnitAlignHeight /= 4;
break;
case 8:
UnitAlignWidth /= 4;
UnitAlignHeight /= 2;
break;
case 4:
UnitAlignWidth /= 2;
UnitAlignHeight /= 2;
break;
case 2:
UnitAlignWidth /= 2;
break;
default:
__GMM_ASSERT(0);
}
}
else
{
if (pGmmLibContext->GetSkuTable().FtrXe2PlusTiling)
{
switch (pTexInfo->MSAA.NumSamples)
{
case 16:
if (pTexInfo->BitsPerPixel == 64)
{
UnitAlignWidth /= 8;
UnitAlignHeight /= 2;
}
else
{
UnitAlignWidth /= 4;
UnitAlignHeight /= 4;
}
break;
case 8:
if ((pTexInfo->BitsPerPixel == 8) || (pTexInfo->BitsPerPixel == 32))
{
UnitAlignWidth /= 2;
UnitAlignHeight /= 4;
}
else
{
UnitAlignWidth /= 4;
UnitAlignHeight /= 2;
}
break;
case 4:
UnitAlignWidth /= 2;
UnitAlignHeight /= 2;
break;
case 2:
if (pTexInfo->BitsPerPixel == 128)
{
UnitAlignHeight /= 2;
}
else
{
UnitAlignWidth /= 2;
}
break;
default:
__GMM_ASSERT(0);
}
}
else
{
switch (pTexInfo->MSAA.NumSamples)
{
case 4:
case 8:
case 16:
UnitAlignWidth /= 2;
UnitAlignHeight /= 2;
break;
case 2:
UnitAlignWidth /= 2;
break;
default:
__GMM_ASSERT(0);
}
}
}
}
}
else if(pTexInfo->Type == RESOURCE_3D)
{
if(pTexInfo->Flags.Info.TiledYf)
{
SET_ALIGN_INFO(Width, 4, 8, 8, 8, 16);
SET_ALIGN_INFO(Height, 8, 8, 16, 16, 16);
SET_ALIGN_INFO(Depth, 8, 8, 8, 16, 16);
}
else // if(pTexInfo->Flags.Info.TiledYs)
{
SET_ALIGN_INFO(Width, 16, 32, 32, 32, 64);
SET_ALIGN_INFO(Height, 16, 16, 32, 32, 32);
SET_ALIGN_INFO(Depth, 16, 16, 16, 32, 32);
}
}
#undef SET_ALIGN_INFO
if(GmmIsCompressed(pGmmLibContext, pTexInfo->Format))
{
uint32_t ElementWidth, ElementHeight, ElementDepth;
pTextureCalc->GetCompressionBlockDimensions(pTexInfo->Format, &ElementWidth, &ElementHeight, &ElementDepth);
UnitAlignWidth *= ElementWidth;
UnitAlignHeight *= ElementHeight;
UnitAlignDepth *= ElementDepth;
}
}
/// SKL 1D Surfaces ///////////////////////////////////////////////
else if((GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE) &&
(pTexInfo->Type == RESOURCE_1D))
{
UnitAlignWidth = 64;
// 1D resources are always linear.
if (pTexInfo->Flags.Info.Linear)
{
SET_ALIGN_FACTOR(Width, 128);
}
}
/// CCS ///////////////////////////////////////////////////////////
else if (pTexInfo->Flags.Gpu.CCS &&
(pTexInfo->Flags.Gpu.__NonMsaaTileYCcs || pTexInfo->Flags.Gpu.__NonMsaaTileXCcs))
{
UnitAlignWidth = pPlatform->TexAlign.CCS.Align.Width;
UnitAlignHeight = pPlatform->TexAlign.CCS.Align.Height;
ALIGNMENT UnitAlign = { UnitAlignWidth , UnitAlignHeight, UnitAlignDepth };
pGmmLibContext->GetPlatformInfoObj()->ApplyExtendedTexAlign(pTexInfo->CCSModeAlign, UnitAlign);
if (UnitAlign.Width != UnitAlignWidth ||
UnitAlign.Height != UnitAlignHeight ||
UnitAlign.Depth != UnitAlignDepth)
{
UnitAlignWidth = UnitAlign.Width;
UnitAlignHeight = UnitAlign.Height;
UnitAlignDepth = UnitAlign.Depth;
}
}
else if (GmmIsYUVPacked(pTexInfo->Format)) /////////////////////////
{
UnitAlignWidth = pPlatform->TexAlign.YUV422.Width;
UnitAlignHeight = pPlatform->TexAlign.YUV422.Height;
// For packed 8/16-bit formats alignment factor of 4 will give us < 16B so expand to 32B
if (pTexInfo->Flags.Info.Linear)
{
SET_ALIGN_FACTOR(Width, 128);
}
else
{
SET_ALIGN_FACTOR(Width, 32);
}
}
else if(GmmIsCompressed(pGmmLibContext, pTexInfo->Format)) /////////////////////////////
{
uint32_t ElementWidth, ElementHeight, ElementDepth;
pTextureCalc->GetCompressionBlockDimensions(pTexInfo->Format, &ElementWidth, &ElementHeight, &ElementDepth);
UnitAlignWidth = ElementWidth * pPlatform->TexAlign.Compressed.Width;
UnitAlignHeight = ElementHeight * pPlatform->TexAlign.Compressed.Height;
UnitAlignDepth = (pTexInfo->Type == RESOURCE_3D) ? ElementDepth * pPlatform->TexAlign.Compressed.Depth : pPlatform->TexAlign.Compressed.Depth;
}
/// Depth Buffer //////////////////////////////////////////////////
else if(pTexInfo->Flags.Gpu.HiZ)
{
if( (GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN7_CORE) &&
(pTexInfo->BitsPerPixel == 16))
{
UnitAlignWidth = 8; // Gen7 Special Case: HALIGN_8 for 16bpp Depth Buffers
}
else
{
UnitAlignWidth = pPlatform->TexAlign.Depth.Width;
}
UnitAlignHeight = pPlatform->TexAlign.Depth.Height;
}
else if (pTexInfo->Flags.Gpu.Depth)
{
if (pTexInfo->BitsPerPixel == 16)
{
if (pTexInfo->MSAA.NumSamples == 0x2 || pTexInfo->MSAA.NumSamples == 0x8)
{
UnitAlignWidth = pPlatform->TexAlign.Depth_D16_UNORM_2x_8x.Width;
UnitAlignHeight = pPlatform->TexAlign.Depth_D16_UNORM_2x_8x.Height;
}
else
{
UnitAlignWidth = pPlatform->TexAlign.Depth_D16_UNORM_1x_4x_16x.Width;
UnitAlignHeight = pPlatform->TexAlign.Depth_D16_UNORM_1x_4x_16x.Height;
}
SET_ALIGN_FACTOR(Width, 16);
}
else
{
UnitAlignWidth = pPlatform->TexAlign.Depth.Width;
UnitAlignHeight = pPlatform->TexAlign.Depth.Height;
SET_ALIGN_FACTOR(Width, 32);
}
}
/// Separate Stencil //////////////////////////////////////////////
else if(pTexInfo->Flags.Gpu.SeparateStencil)
{
UnitAlignWidth = pPlatform->TexAlign.SeparateStencil.Width;
UnitAlignHeight = pPlatform->TexAlign.SeparateStencil.Height;
SET_ALIGN_FACTOR(Width, 16);
}
/// Cross Adapter //////////////////////////////////////////////
else if(pTexInfo->Flags.Info.XAdapter)
{
//Add cross adapter height restriction.
UnitAlignHeight = pPlatform->TexAlign.XAdapter.Height;
UnitAlignWidth = pPlatform->TexAlign.XAdapter.Width;
SET_ALIGN_FACTOR(Width, 128);
__GMM_ASSERT(pTexInfo->MaxLod == 0);
}
else if(((pTexInfo->Flags.Gpu.MCS &&
GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN12_CORE) ||
(pTexInfo->Flags.Gpu.CCS && GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE)) &&
(pTexInfo->MSAA.NumSamples > 1))
{
UnitAlignWidth = 16;
UnitAlignHeight = 4;
}
else if(pTexInfo->Flags.Wa.__ForceOtherHVALIGN4)
{
UnitAlignWidth = 4;
UnitAlignHeight = 4;
}
else /// All Other ////////////////////////////////////////////////
{
UnitAlignWidth = pPlatform->TexAlign.AllOther.Width;
if(GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN8_CORE)
{
UnitAlignHeight = pPlatform->TexAlign.AllOther.Height;
// Let VAlign = 16, when bpp == 8 or 16 for both TileX and TileY on BDW
if ((GmmGetWaTable(pGmmLibContext)->WaUseVAlign16OnTileXYBpp816) &&
(pTexInfo->BitsPerPixel == 8 || pTexInfo->BitsPerPixel == 16) &&
(pTexInfo->Flags.Info.TiledX || pTexInfo->Flags.Info.TiledY))
{
UnitAlignHeight = 16;
}
if((GmmGetWaTable(pGmmLibContext)->Wa32bppTileY2DColorNoHAlign4) &&
(pTexInfo->BitsPerPixel == 32 && pTexInfo->Flags.Info.TiledY &&
pTexInfo->MSAA.NumSamples == 1 && pTexInfo->MaxLod > 1) &&
UnitAlignWidth <= 4)
{
UnitAlignWidth = 8;
}
// Linear surfaces, or any surface with 24/48/96 bpp, require HALIGN=128
if (pTexInfo->Flags.Info.Linear || (pTexInfo->BitsPerPixel == 24 || pTexInfo->BitsPerPixel == 48 || pTexInfo->BitsPerPixel == 96))
{
SET_ALIGN_FACTOR(Width, 128);
}
// Non linear surfaces with 64/128 bpp, require HALIGN=64
if (!pTexInfo->Flags.Info.Linear && (pTexInfo->BitsPerPixel == 64 || pTexInfo->BitsPerPixel == 128))
{
SET_ALIGN_FACTOR(Width, 64);
}
}
else if(pTexInfo->MSAA.NumSamples <= 1)
{
if ((GmmGetWaTable(pGmmLibContext)->WaValign2For96bppFormats) &&
( pTexInfo->BitsPerPixel == 96 ) )
{
UnitAlignHeight = 2;
}
else if ((GmmGetWaTable(pGmmLibContext)->WaValign2ForR8G8B8UINTFormat) &&
( pTexInfo->Format == GMM_FORMAT_R8G8B8_UINT ) )
{
UnitAlignHeight = 2;
}
else
{
UnitAlignHeight = pPlatform->TexAlign.AllOther.Height;
}
}
else
{
UnitAlignHeight = 4; // Gen6+ Special Case: VALIGN_4 for >= MSAA_4X Render Targets
}
}
//ExistingSysMem override
if(pTexInfo->Flags.Info.ExistingSysMem &&
!pTexInfo->ExistingSysMem.IsGmmAllocated &&
!pTexInfo->ExistingSysMem.IsPageAligned)
{
if(pTexInfo->Flags.Gpu.Texture)
{
UnitAlignWidth = pPlatform->SamplerFetchGranularityWidth;
UnitAlignHeight = pPlatform->SamplerFetchGranularityHeight;
}
else if(pTexInfo->Flags.Gpu.RenderTarget)
{
UnitAlignWidth = (GmmIsYUVPlanar(pTexInfo->Format)) ? 2 : 1;
UnitAlignHeight = 1;
}
}
pTexInfo->Alignment.HAlign = UnitAlignWidth;
pTexInfo->Alignment.VAlign = UnitAlignHeight;
pTexInfo->Alignment.DAlign = UnitAlignDepth;
}
else
{
// Don't reinitialize b/c special-case ResCreates (e.g. MCS) need the
// values from their first pass through here to stick (but they'll come
// through here more than once, with different parameters).
}
GMM_DPF_EXIT;
return GMM_SUCCESS;
} // __GmmTexFillHAlignVAlign
#endif //__cpluscplus
//===========================================================================
// typedef:
// GMM_MIPTAIL_SLOT_OFFSET_REC
//
// Description:
// This structure used to describe the offset between miptail slot and
// miptail starting address
//---------------------------------------------------------------------------
typedef struct GMM_MIPTAIL_SLOT_OFFSET_REC
{
uint32_t X;
uint32_t Y;
uint32_t Z;
}GMM_MIPTAIL_SLOT_OFFSET;
#define GEN9_MIPTAIL_SLOT_OFFSET_1D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 }, { 32768, 0, 0 } }, \
{ { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 } }, \
{ { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 } }, \
{ { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 } }, \
{ { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 } }, \
{ { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 } }, \
{ { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 } }, \
{ { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 } }, \
{ { 28, 0, 0 }, { 56, 0, 0 }, { 112, 0, 0 }, { 224, 0, 0 }, { 448, 0, 0 } }, \
{ { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 } }, \
{ { 20, 0, 0 }, { 40, 0, 0 }, { 80, 0, 0 }, { 160, 0, 0 }, { 320, 0, 0 } }, \
{ { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 } }, \
{ { 12, 0, 0 }, { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 } }, \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
}
#define GEN9_MIPTAIL_SLOT_OFFSET_2D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */\
{ { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 128, 0, 0 } }, \
{ { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 }, { 0, 64, 0 }, { 0, 128, 0 } }, \
{ { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 } }, \
{ { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 } }, \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 } }, \
{ { 4, 8, 0 }, { 8, 8, 0 }, { 8, 16, 0 }, { 16, 16, 0 }, { 16, 32, 0 } }, \
{ { 0, 12, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 24, 0 }, { 0, 48, 0 } }, \
{ { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 } }, \
{ { 4, 4, 0 }, { 8, 4, 0 }, { 8, 8, 0 }, { 16, 8, 0 }, { 16, 16, 0 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 } }, \
{ { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 } }, \
{ { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 8, 4, 0 }, { 0, 12, 0 } }, \
{ { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 8, 0, 0 }, { 0, 8, 0 } }, \
{ { 1, 0, 0 }, { 2, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
}
#define GEN9_MIPTAIL_SLOT_OFFSET_3D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 } }, \
{ { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 16, 0 } }, \
{ { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 16 }, { 0, 0, 16 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 } }, \
{ { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 8, 0 } }, \
{ { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 8 }, { 0, 0, 8 } }, \
{ { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 0, 4, 4 }, { 0, 4, 4 } }, \
{ { 2, 0, 0 }, { 4, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
{ { 1, 0, 3 }, { 2, 0, 3 }, { 4, 0, 3 }, { 0, 0, 7 }, { 0, 0, 7 } }, \
{ { 1, 0, 2 }, { 2, 0, 2 }, { 4, 0, 2 }, { 0, 0, 6 }, { 0, 0, 6 } }, \
{ { 1, 0, 1 }, { 2, 0, 1 }, { 4, 0, 1 }, { 0, 0, 5 }, { 0, 0, 5 } }, \
{ { 1, 0, 0 }, { 2, 0, 0 }, { 4, 0, 0 }, { 0, 0, 4 }, { 0, 0, 4 } }, \
{ { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 } }, \
{ { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 } }, \
{ { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
}
#define GEN10_MIPTAIL_SLOT_OFFSET_1D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 }, { 32768, 0, 0 } }, \
{ { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 } }, \
{ { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 } }, \
{ { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 } }, \
{ { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 } }, \
{ { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 }, { 1536, 0, 0 } }, \
{ { 80, 0, 0 }, { 160, 0, 0 }, { 320, 0, 0 }, { 640, 0, 0 }, { 1280, 0, 0 } }, \
{ { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 } }, \
{ { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 } }, \
{ { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 } }, \
{ { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 } }, \
{ { 12, 0, 0 }, { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 } }, \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
}
#define GEN10_MIPTAIL_SLOT_OFFSET_2D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 128, 0, 0 } }, \
{ { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 }, { 0, 64, 0 }, { 0, 128, 0 } }, \
{ { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 } }, \
{ { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 } }, \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 } }, \
{ { 4, 8, 0 }, { 8, 8, 0 }, { 8, 16, 0 }, { 16, 16, 0 }, { 16, 32, 0 } }, \
{ { 0, 12, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 24, 0 }, { 0, 48, 0 } }, \
{ { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 } }, \
{ { 4, 4, 0 }, { 8, 4, 0 }, { 8, 8, 0 }, { 16, 8, 0 }, { 16, 16, 0 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 } }, \
{ { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
{ { 1, 0, 0 }, { 2, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
{ { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 8, 0, 0 }, { 0, 8, 0 } }, \
{ { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 8, 4, 0 }, { 0, 12, 0 } }, \
}
#define GEN10_MIPTAIL_SLOT_OFFSET_3D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 } }, \
{ { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 16, 0 } }, \
{ { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 16 }, { 0, 0, 16 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 } }, \
{ { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 8, 0 } }, \
{ { 2, 0, 4 }, { 4, 0, 4 }, { 4, 0, 4 }, { 4, 0, 8 }, { 8, 0, 8 } }, \
{ { 0, 2, 4 }, { 0, 2, 4 }, { 0, 4, 4 }, { 0, 4, 8 }, { 0, 4, 8 } }, \
{ { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 8 }, { 0, 0, 8 } }, \
{ { 2, 2, 0 }, { 4, 2, 0 }, { 4, 4, 0 }, { 4, 4, 0 }, { 8, 4, 0 } }, \
{ { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 8, 0, 0 } }, \
{ { 0, 2, 0 }, { 0, 2, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
{ { 1, 0, 2 }, { 2, 0, 2 }, { 2, 0, 2 }, { 2, 0, 4 }, { 4, 0, 4 } }, \
{ { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 4 }, { 0, 0, 4 } }, \
{ { 1, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 }, { 4, 0, 0 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
}
#define GEN11_MIPTAIL_SLOT_OFFSET_1D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 }, { 32768, 0, 0 } }, \
{ { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 } }, \
{ { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 } }, \
{ { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 } }, \
{ { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 } }, \
{ { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 }, { 1536, 0, 0 } }, \
{ { 80, 0, 0 }, { 160, 0, 0 }, { 320, 0, 0 }, { 640, 0, 0 }, { 1280, 0, 0 } }, \
{ { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 } }, \
{ { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 } }, \
{ { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 } }, \
{ { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 } }, \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 } }, \
{ { 12, 0, 0 }, { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 } }, \
}
#define GEN11_MIPTAIL_SLOT_OFFSET_2D_SURFACE GEN10_MIPTAIL_SLOT_OFFSET_2D_SURFACE
#define GEN11_MIPTAIL_SLOT_OFFSET_3D_SURFACE { \
/* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
{ { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 } }, \
{ { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 16, 0 } }, \
{ { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 16 }, { 0, 0, 16 } }, \
{ { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 } }, \
{ { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 8, 0 } }, \
{ { 2, 0, 4 }, { 4, 0, 4 }, { 4, 0, 4 }, { 0, 4, 8 }, { 0, 4, 8 } }, \
{ { 1, 0, 4 }, { 2, 0, 4 }, { 0, 4, 4 }, { 0, 0, 12 }, { 0, 0, 12 } }, \
{ { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 8 }, { 0, 0, 8 } }, \
{ { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 0, 4, 4 }, { 0, 4, 4 } }, \
{ { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
{ { 1, 0, 0 }, { 2, 0, 0 }, { 0, 4, 0 }, { 0, 0, 4 }, { 0, 0, 4 } }, \
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
{ { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 } }, \
{ { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 } }, \
{ { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 } }, \
}

View File

@ -0,0 +1,558 @@
/*==============================================================================
Copyright(c) 2019 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
Description: This file contains the class definitions for GmmPageTablePool
PageTable, and low-level Tables for user-mode PageTable management,
that is common for both Linux and Windows.
======================= end_copyright_notice ==================================*/
#pragma once
#include "External/Common/GmmPageTableMgr.h"
#ifdef __linux__
#include <pthread.h>
#include <string.h>
// Internal Linux version of MSDK APIs.
static inline void InitializeCriticalSection(pthread_mutex_t *mutex)
{
pthread_mutexattr_t Attr;
pthread_mutexattr_init(&Attr);
pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(mutex, &Attr);
}
static inline void DeleteCriticalSection(pthread_mutex_t *mutex)
{
pthread_mutex_destroy(mutex);
}
static inline void EnterCriticalSection(pthread_mutex_t *mutex)
{
pthread_mutex_lock(mutex);
}
static inline void LeaveCriticalSection(pthread_mutex_t *mutex)
{
pthread_mutex_unlock(mutex);
}
#ifndef _BitScanForwardDefined
static inline int _BitScanForward(uint32_t *index, uint32_t mask)
{
int i;
#ifdef __ANDROID__
i = ffs(mask);
#else
i = ffsl(mask);
#endif
if(i > 0)
{
*index = (uint32_t)(i - 1);
return i;
}
return 0;
}
#endif
#endif
#define GMM_L1_USABLESIZE(TTType, pGmmLibContext) (GMM_AUX_L1_USABLESIZE(pGmmLibContext))
#define GMM_L1_SIZE(TTType, pGmmLibContext) (GMM_AUX_L1_SIZE(pGmmLibContext))
#define GMM_L1_SIZE_DWORD(TTType, pGmmLibContext) (GMM_AUX_L1_SIZE_DWORD(pGmmLibContext))
#define GMM_L2_SIZE(TTType) (GMM_AUX_L2_SIZE)
#define GMM_L2_SIZE_DWORD(TTType) (GMM_AUX_L2_SIZE_DWORD)
#define GMM_L3_SIZE(TTType) (GMM_AUX_L3_SIZE)
#define GMM_L1_ENTRY_IDX(TTType, GfxAddress, pGmmLibContext) (GMM_AUX_L1_ENTRY_IDX((GfxAddress), (pGmmLibContext)))
#define GMM_L2_ENTRY_IDX(TTType, GfxAddress) (GMM_AUX_L2_ENTRY_IDX(GfxAddress))
#define GMM_L3_ENTRY_IDX(TTType, GfxAddress) (GMM_AUX_L3_ENTRY_IDX(GfxAddress))
#ifdef GMM_ULT
#define GMM_L1_ENTRY_IDX_EXPORTED(TTType, GfxAddress, WA64KEx) GMM_AUX_L1_ENTRY_IDX_EXPORTED((GfxAddress), WA64KEx)
#define GMM_L1_ENTRY_IDX_EXPORTED_2(TTType, GfxAddress, WA64KEx, WA16KEx) (GMM_AUX_L1_ENTRY_IDX_EXPORTED_2((GfxAddress), WA64KEx, WA16KEx))
#endif
#ifdef __cplusplus
#include "External/Common/GmmMemAllocator.hpp"
//HW provides single-set of TR/Aux-TT registers for non-privileged programming
//Engine-specific offsets are HW-updated with programmed values.
#define GET_L3ADROFFSET(TRTT, L3AdrOffset, pGmmLibContext) \
L3AdrOffset = 0x4200;
#define ASSIGN_POOLNODE(Pool, NodeIdx, PerTableNodes) { \
(Pool)->GetNodeUsageAtIndex((NodeIdx) / (32 *(PerTableNodes))) |= __BIT(((NodeIdx) / (PerTableNodes)) % 32); \
(Pool)->GetNodeBBInfoAtIndex(NodeIdx) = SyncInfo(); \
(Pool)->GetNumFreeNode() -= (PerTableNodes); \
}
#define DEASSIGN_POOLNODE(PageTableMgr, UmdContext, Pool, NodeIdx, PerTableNodes) { \
(Pool)->GetNodeUsageAtIndex((NodeIdx) / (32 * (PerTableNodes))) &= ~__BIT(((NodeIdx) / (PerTableNodes)) % 32 ); \
(Pool)->GetNumFreeNode() += (PerTableNodes); \
if((Pool)->GetNumFreeNode() == PAGETABLE_POOL_MAX_NODES) { \
PageTableMgr->__ReleaseUnusedPool((UmdContext)); \
} \
}
namespace GmmLib
{
#define PAGETABLE_POOL_MAX_NODES 512 //Max. number of L2/L1 tables pool contains
#define PAGETABLE_POOL_SIZE_IN_DWORD PAGETABLE_POOL_MAX_NODES / 32
#define PAGETABLE_POOL_SIZE PAGETABLE_POOL_MAX_NODES * PAGE_SIZE //Pool for L2/L1 table allocation
#define AUX_L2TABLE_SIZE_IN_POOLNODES 8 //Aux L2 is 32KB
#define AUX_L1TABLE_SIZE_IN_POOLNODES 2 //Aux L1 is 8KB
#define AUX_L1TABLE_SIZE_IN_POOLNODES_2(pGmmLibContext) (pGmmLibContext ? ((WA64K(pGmmLibContext) || WA16K(pGmmLibContext)) ? 2 : 1) : 2) //Aux L1 is 8KB / 4K (MTL)
#define PAGETABLE_POOL_MAX_UNUSED_SIZE GMM_MBYTE(16) //Max. size of unused pool, driver keeps resident
//////////////////////////////////////////////////////////////////////////////////////////////
/// Contains functions and members for GmmPageTablePool.
/// PageTablePool is a Linked-list, provides common location for both Aux TT and TR-TT pages
/// Separate NodePool (linked-list element) kept for each PoolType, for cleaner management in
/// per-table size
/////////////////////////////////////////////////////////////////////////////////////////////
class GmmPageTablePool
{
private:
//PageTablePool allocation descriptor
GMM_RESOURCE_INFO* pGmmResInfo;
HANDLE PoolHandle;
GMM_GFX_ADDRESS PoolGfxAddress;
GMM_GFX_ADDRESS CPUAddress; //LMEM-cpuvisible adr
POOL_TYPE PoolType; //Separate Node-pools for TR-L2, TR-L1, Aux-L2, Aux-L1 usages-
//PageTablePool usage descriptors
int NumFreeNodes; //has value {0 to Pool_Max_nodes}
uint32_t* NodeUsage; //destined node state (updated during node assignment and removed based on destined state of L1/L2 Table
//that used the pool node)
//Aux-Pool node-usage tracked at every eighth/second node(for L2 vs L1)
//ie 1b per node for TR-table, 1b per 8-nodes for Aux-L2table, 1b per 2-nodes for AuxL1-table
//array size= POOL_SIZE_IN_DWORD for TR, =POOL_SIZE_IN_DWORD/8 for AuxL2, POOL_SIZE_IN_DWORD/2 for AuxL1
SyncInfo* NodeBBInfo; //BB info for pending Gpu usage of each pool node
//array of size MaxPoolNodes for TR, =MaxPoolNodes / 8 for Aux, MaxPoolNodes / 2 for AuxL1
SyncInfo PoolBBInfo; //BB info for Gpu usage of the Pool (most recent of pool node BB info)
GmmPageTablePool* NextPool; //Next node-Pool in the LinkedList
GmmClientContext *pClientContext; ///< ClientContext of the client creating this Object
public:
GmmPageTablePool() :
pGmmResInfo(NULL),
PoolHandle(),
PoolGfxAddress(0x0),
CPUAddress(0x0),
PoolType(POOL_TYPE_TRTTL1),
NumFreeNodes(PAGETABLE_POOL_MAX_NODES),
NodeUsage(NULL),
NodeBBInfo(NULL),
PoolBBInfo(),
NextPool(NULL),
pClientContext(NULL)
{
}
GmmPageTablePool(HANDLE hAlloc, GMM_RESOURCE_INFO* pGmmRes, GMM_GFX_ADDRESS SysMem, POOL_TYPE Type) :
GmmPageTablePool()
{
int DwordPoolSize;
GMM_LIB_CONTEXT *pGmmLibContext;
PoolHandle = hAlloc;
pGmmResInfo = pGmmRes;
PoolGfxAddress = SysMem;
CPUAddress = PoolGfxAddress;
NextPool = NULL;
NumFreeNodes = PAGETABLE_POOL_MAX_NODES;
PoolType = Type;
if(pGmmResInfo)
{
pClientContext = pGmmResInfo->GetGmmClientContext();
}
pGmmLibContext = pClientContext ? pClientContext->GetLibContext() : NULL;
DwordPoolSize = (Type == POOL_TYPE_AUXTTL1) ? PAGETABLE_POOL_SIZE_IN_DWORD / AUX_L1TABLE_SIZE_IN_POOLNODES_2(pGmmLibContext) : (Type == POOL_TYPE_AUXTTL2) ? PAGETABLE_POOL_SIZE_IN_DWORD / AUX_L2TABLE_SIZE_IN_POOLNODES : PAGETABLE_POOL_SIZE_IN_DWORD;
NodeUsage = new uint32_t[DwordPoolSize]();
NodeBBInfo = new SyncInfo[DwordPoolSize * 32]();
}
GmmPageTablePool(HANDLE hAlloc, GMM_RESOURCE_INFO* pGmmRes, GMM_GFX_ADDRESS GfxAdr, GMM_GFX_ADDRESS CPUAdr, POOL_TYPE Type) :
GmmPageTablePool(hAlloc, pGmmRes, GfxAdr, Type)
{
CPUAddress = (CPUAdr != GfxAdr) ? CPUAdr : GfxAdr;
}
~GmmPageTablePool()
{
delete[] NodeUsage;
delete[] NodeBBInfo;
}
GmmPageTablePool* InsertInList(GmmPageTablePool* NewNode)
{
GmmPageTablePool *Node = this;
while (Node->NextPool)
{
Node = Node->NextPool;
}
Node->NextPool = NewNode;
return Node->NextPool;
}
GmmPageTablePool* InsertInListAtBegin(GmmPageTablePool* NewNode)
{
GmmPageTablePool *Node = this;
NewNode->NextPool = Node;
return NewNode;
}
GmmPageTablePool* &GetNextPool() { return NextPool; }
HANDLE& GetPoolHandle() { return PoolHandle; }
POOL_TYPE& GetPoolType() { return PoolType; }
int& GetNumFreeNode() { return NumFreeNodes; }
SyncInfo& GetPoolBBInfo() { return PoolBBInfo; }
uint32_t& GetNodeUsageAtIndex(int j) { return NodeUsage[j]; }
SyncInfo& GetNodeBBInfoAtIndex(int j)
{
GMM_LIB_CONTEXT *pGmmLibContext = pClientContext ? pClientContext->GetLibContext() : NULL;
int BBInfoNodeIdx = (PoolType == POOL_TYPE_AUXTTL1) ? j / AUX_L1TABLE_SIZE_IN_POOLNODES_2(pGmmLibContext) : (PoolType == POOL_TYPE_AUXTTL2) ? j / AUX_L2TABLE_SIZE_IN_POOLNODES : j;
return NodeBBInfo[BBInfoNodeIdx];
}
GMM_GFX_ADDRESS GetGfxAddress() { return PoolGfxAddress; }
GMM_GFX_ADDRESS GetCPUAddress() { return CPUAddress; }
GMM_RESOURCE_INFO* &GetGmmResInfo() { return pGmmResInfo; }
bool IsPoolInUse(SyncInfo BBInfo) {
if (NumFreeNodes < PAGETABLE_POOL_MAX_NODES ||
(PoolBBInfo.BBQueueHandle == BBInfo.BBQueueHandle &&
PoolBBInfo.BBFence == BBInfo.BBFence + 1)) //Pool will be used by next BB submission, freeing it will cause page fault
{
return true;
}
return false;
}
bool __IsUnusedTRTTPoolOverLimit(GMM_GFX_SIZE_T * OverLimitSize);
void ClearBBReference(void * BBQHandle);
GMM_STATUS __DestroyPageTablePool(void * DeviceCallbacks,HANDLE hCsr);
};
//////////////////////////////////////////////////////////////////////////////////////////////
/// Contains functions and members for Table.
/// Table defines basic building block for tables at different page-table levels
/////////////////////////////////////////////////////////////////////////////////////////////
class Table
{
protected:
GMM_PAGETABLEPool *PoolElem; //L2 Pool ptr different for L2Tables when Pool_nodes <512
int PoolNodeIdx; //pool node idx used for L2 Table
SyncInfo BBInfo; //BB Handle/fence using Table
uint32_t * UsedEntries; //Tracks which L1/L2 entries are being used
//array size GMM_L1_SIZE_DWORD(TT-type) for LastLevelTable, MidLeveltable(??)
//array of 1024/32=32 DWs for TR-table, 4096/32 =512 for Aux-Table
public:
Table() :
PoolElem(NULL),
PoolNodeIdx(),
BBInfo(),
UsedEntries(NULL)
{
}
int& GetNodeIdx() { return PoolNodeIdx; }
GmmPageTablePool* &GetPool() { return PoolElem; }
GMM_GFX_ADDRESS GetCPUAddress() { return (PoolElem->GetCPUAddress() + (PoolNodeIdx * PAGE_SIZE)); }
SyncInfo& GetBBInfo() { return BBInfo; }
uint32_t* &GetUsedEntries() { return UsedEntries; }
bool TrackTableUsage(TT_TYPE Type, bool IsL1, GMM_GFX_ADDRESS TileAdr, bool NullMapped,GMM_LIB_CONTEXT* pGmmLibContext);
bool IsTableNullMapped(TT_TYPE Type, bool IsL1, GMM_GFX_ADDRESS TileAdr,GMM_LIB_CONTEXT *pGmmLibContext);
void UpdatePoolFence(GMM_UMD_SYNCCONTEXT * UmdContext, bool ClearNode);
};
//////////////////////////////////////////////////////////////////////////////////////////////
/// Contains functions and members for LastLevelTable.
/// LastLevelTable defines leaf level tables in multi-level pageTable structure
/////////////////////////////////////////////////////////////////////////////////////////////
class LastLevelTable : public Table
{
private:
uint32_t L2eIdx;
LastLevelTable *pNext;
public:
LastLevelTable() : Table(),
L2eIdx() //Pass in Aux vs TR table's GMM_L2_SIZE and initialize L2eIdx?
{
pNext = NULL;
}
LastLevelTable(GMM_PAGETABLEPool *Elem, int NodeIdx, int DwordL1e, int L2eIndex)
: LastLevelTable()
{
PoolElem = Elem;
PoolNodeIdx = NodeIdx;
BBInfo = Elem->GetNodeBBInfoAtIndex(NodeIdx);
L2eIdx = L2eIndex;
pNext = NULL;
UsedEntries = new uint32_t[DwordL1e]();
}
~LastLevelTable()
{
delete[] UsedEntries;
}
int GetL2eIdx() {
return L2eIdx;
}
LastLevelTable* &Next() {
return pNext;
}
};
//////////////////////////////////////////////////////////////////////////////////////////////
/// Contains functions and members for MidLevelTable.
/// MidLevelTable defines secondary level tables in multi-level pageTable structure
/////////////////////////////////////////////////////////////////////////////////////////////
class MidLevelTable : public Table
{
private:
LastLevelTable *pTTL1; //linked list of L1 tables
public:
MidLevelTable() :Table()
{
pTTL1 = NULL;
}
MidLevelTable(GMM_PAGETABLEPool *Pool, int NodeIdx, SyncInfo Info) : MidLevelTable()
{
PoolElem = Pool;
BBInfo = Info;
PoolNodeIdx = NodeIdx;
}
~MidLevelTable()
{
if (pTTL1)
{
LastLevelTable* item = pTTL1;
while (item)
{
LastLevelTable* nextItem = item->Next();
delete item;
item = nextItem;
}
pTTL1 = NULL;
}
}
LastLevelTable* GetL1Table(GMM_GFX_SIZE_T L2eIdx, LastLevelTable** Prev = NULL)
{
LastLevelTable* pL1Tbl = pTTL1;
LastLevelTable* PrevL1Tbl = NULL;
while (pL1Tbl)
{
if (pL1Tbl->GetL2eIdx() == L2eIdx)
{
break;
}
PrevL1Tbl = pL1Tbl;
pL1Tbl = pL1Tbl->Next();
}
//if requested, save previous node in linked-list
if (Prev)
{
*Prev = PrevL1Tbl;
}
return pL1Tbl;
}
void InsertInList(LastLevelTable* pL1Tbl)
{
LastLevelTable* Prev = pTTL1;
//Insert at end
while (Prev && Prev->Next())
{
Prev = Prev->Next();
}
if (Prev)
{
Prev->Next() = pL1Tbl;
}
else
{
pTTL1 = pL1Tbl;
}
}
void DeleteFromList(LastLevelTable* pL1Tbl, LastLevelTable* PrevL1Tbl)
{
//Save next L1Table in list, before deleting current one
if (pL1Tbl)
{
if (PrevL1Tbl)
{
PrevL1Tbl->Next() = pL1Tbl->Next();
}
else
{
pTTL1 = pL1Tbl->Next();
}
delete pL1Tbl;
}
}
};
/////////////////////////////////////////////////////
/// Contains functions and members for PageTable.
/// PageTable defines multi-level pageTable
/////////////////////////////////////////////////////
class PageTable :
public GmmMemAllocator
{
protected:
const TT_TYPE TTType; //PageTable is AuxTT
const int NodesPerTable; //Aux L2/L3 has 32KB size, Aux L1 has 4KB -can't use as selector for PageTable is AuxTT
// 1 node for TR-table, 8 nodes for Aux-Table L2, 2 nodes for Aux-table L1
//Root Table structure
struct RootTable
{
GMM_RESOURCE_INFO* pGmmResInfo;
HANDLE L3Handle;
GMM_GFX_ADDRESS GfxAddress; //L3 Table Adr CPU equivalent GPU addr
GMM_GFX_ADDRESS CPUAddress; //LMEM-cpuvisible adr
bool NeedRegisterUpdate; //True @ L3 allocation, False when L3AdrRegWrite done
SyncInfo BBInfo;
RootTable() : pGmmResInfo(NULL), L3Handle(NULL), GfxAddress(0), CPUAddress(0), NeedRegisterUpdate(false), BBInfo() {}
} TTL3;
MidLevelTable* pTTL2; //array of L2-Tables
public:
#ifdef _WIN32
CRITICAL_SECTION TTLock; //synchronized access of PageTable obj
#elif defined __linux__
pthread_mutex_t TTLock;
#endif
GmmPageTableMgr* PageTableMgr;
GmmClientContext *pClientContext;
PageTable(int Size, int NumL3e, TT_TYPE flag) :
TTType(flag),
NodesPerTable(Size / PAGE_SIZE)
{
PageTableMgr = NULL;
pClientContext = NULL;
InitializeCriticalSection(&TTLock);
pTTL2 = new MidLevelTable[NumL3e];
}
~PageTable()
{
delete[] pTTL2;
DeleteCriticalSection(&TTLock);
}
inline GMM_LIB_CONTEXT* GetGmmLibContext()
{
return pClientContext->GetLibContext();
}
GMM_GFX_ADDRESS GetL3Address() { return TTL3.GfxAddress; }
bool &GetRegisterStatus() { return TTL3.NeedRegisterUpdate; }
GMM_STATUS AllocateL3Table(uint32_t L3TableSize, uint32_t L3AddrAlignment);
GMM_STATUS DestroyL3Table();
void AllocateL1L2Table(GMM_GFX_ADDRESS TileAddr, GMM_GFX_ADDRESS * L1TableAdr, GMM_GFX_ADDRESS * L2TableAdr);
void AllocateDummyTables(GmmLib::Table **L2Table, GmmLib::Table **L1Table);
void GetL1L2TableAddr(GMM_GFX_ADDRESS TileAddr, GMM_GFX_ADDRESS * L1TableAdr, GMM_GFX_ADDRESS* L2TableAdr);
uint8_t GetMappingType(GMM_GFX_ADDRESS GfxVA, GMM_GFX_SIZE_T Size, GMM_GFX_ADDRESS& LastAddr);
HANDLE GetL3Handle() { return TTL3.L3Handle; }
};
//////////////////////////////////////////////////////////////////////////////////////////////
/// Contains functions and members for AuxTable.
/// AuxTable defines PageTable for translating VA->AuxVA, ie defines page-walk to get address
/// of CCS-cacheline containing auxiliary data (compression tag, etc) for some resource
/////////////////////////////////////////////////////////////////////////////////////////////
class AuxTable : public PageTable
{
public:
const int L1Size;
Table* NullL2Table;
Table* NullL1Table;
GMM_GFX_ADDRESS NullCCSTile;
AuxTable(GmmClientContext *pClientContextIn)
: PageTable(8 * PAGE_SIZE, GMM_AUX_L3_SIZE, TT_TYPE::AUXTT), L1Size((WA16K(pClientContextIn->GetLibContext()) || WA64K(pClientContextIn->GetLibContext())) ? (2 * PAGE_SIZE) : PAGE_SIZE)
{
NullL2Table = nullptr;
NullL1Table = nullptr;
NullCCSTile = 0;
}
AuxTable()
: PageTable(8 * PAGE_SIZE, GMM_AUX_L3_SIZE, TT_TYPE::AUXTT), L1Size(2 * PAGE_SIZE)
{
NullL2Table = nullptr;
NullL1Table = nullptr;
NullCCSTile = 0;
}
GMM_STATUS InvalidateTable(GMM_UMD_SYNCCONTEXT * UmdContext, GMM_GFX_ADDRESS BaseAdr, GMM_GFX_SIZE_T Size, uint8_t DoNotWait);
GMM_STATUS MapValidEntry(GMM_UMD_SYNCCONTEXT *UmdContext, GMM_GFX_ADDRESS BaseAdr, GMM_GFX_SIZE_T BaseSize,
GMM_RESOURCE_INFO* BaseResInfo, GMM_GFX_ADDRESS AuxVA, GMM_RESOURCE_INFO* AuxResInfo, uint64_t PartialData, uint8_t DoNotWait);
GMM_STATUS MapNullCCS(GMM_UMD_SYNCCONTEXT *UmdContext, GMM_GFX_ADDRESS BaseAdr, GMM_GFX_SIZE_T Size, uint64_t PartialL1e, uint8_t DoNotWait);
GMM_AUXTTL1e CreateAuxL1Data(GMM_RESOURCE_INFO* BaseResInfo);
GMM_GFX_ADDRESS GMM_INLINE __GetCCSCacheline(GMM_RESOURCE_INFO* BaseResInfo, GMM_GFX_ADDRESS BaseAdr, GMM_RESOURCE_INFO* AuxResInfo,
GMM_GFX_ADDRESS AuxVA, GMM_GFX_SIZE_T AdrOffset);
};
typedef struct _GMM_DEVICE_ALLOC {
uint32_t Size;
uint32_t Alignment;
HANDLE Handle;
GMM_GFX_ADDRESS GfxVA;
GMM_GFX_ADDRESS CPUVA;
void * Priv;
HANDLE hCsr;
} GMM_DEVICE_ALLOC;
typedef struct _GMM_DEVICE_DEALLOC {
HANDLE Handle;
GMM_GFX_ADDRESS GfxVA;
void * Priv;
HANDLE hCsr;
} GMM_DEVICE_DEALLOC;
GMM_STATUS __GmmDeviceAlloc(GmmClientContext *pClientContext,
GMM_DEVICE_CALLBACKS_INT *pDeviceCbInt,
GMM_DEVICE_ALLOC *pAlloc);
GMM_STATUS __GmmDeviceDealloc(GMM_CLIENT ClientType,
GMM_DEVICE_CALLBACKS_INT *DeviceCb,
GMM_DEVICE_DEALLOC *pDealloc,
GmmClientContext *pClientContext);
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,33 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
// File intended for same-folder-inclusion by CpuSwizzleBlt.c to reroute
// standard asserts when compiled in GMM.
#pragma once
#ifdef __GMM
#include "External/Common/GmmInternal.h"
#define assert __GMM_ASSERT
#else
#include <assert.h>
#endif

View File

@ -0,0 +1,158 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#if (_DEBUG || _RELEASE_INTERNAL) && !__GMM_KMD__
// Not doing #if__cplusplus >= 201103L check because partial C++11 support may
// work for this. We also want to catch C++11 unavailability due to not setting
// compiler options.
#if (_MSC_VER >= 1800) // VS 2013+
#define GMM_LOG_AVAILABLE 1
#elif((__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ >= 5))) // clang 3.5+
#define GMM_LOG_AVAILABLE 1
#elif((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))) // g++ 4.8+
#define GMM_LOG_AVAILABLE 1
#else
#define GMM_LOG_AVAILABLE 0
// Print out messages if GmmLog was disabled due to compiler issues
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#if (defined __GNUC__)
#pragma message "Detected g++ " STRING(__GNUC__) "." STRING(__GNUC_MINOR__) ". Minimum compiler version required for GmmLog is GCC 4.8.1. Disabling GmmLog."
#elif (defined __clang__)
#pragma message "Detected clang " STRING(__clang_major__) "." STRING(__clang_minor__) ". Minimum compiler version required for GmmLog is clang 3.5. Disabling GmmLog."
#elif (defined _MSC_VER)
#pragma message("Detected MSVC++ version " STRING(_MSC_VER) ". Minimum compiler version required for GmmLog is MSVC++ 1800. Disabling GmmLog")
#else
#pragma message "Unknown compiler. Disabling GmmLog."
#endif
#undef STRING2
#undef STRING
#endif
#elif (_DEBUG || _RELEASE_INTERNAL) && __GMM_KMD__ && _WIN32
#define GMM_KMD_LOG_AVAILABLE 1
/////////////////////////////////////////////////////////////////////////////////////
/// GMM_KMD_LOG
/// Gmm logging macro to log a message in KMD mode. Exmaple:
/// GMM_KMD_LOG("Math Addition: %d + %d = %d \r\n", 1, 1, 2);
/////////////////////////////////////////////////////////////////////////////////////
#define GMM_KMD_LOG(message, ...) \
{ \
DWORD CurrentProcessId = (DWORD) (ULONG_PTR)PsGetCurrentProcessId(); \
const WCHAR *format = L"%s%d.txt"; \
WCHAR FileName[] = L"C:\\Intel\\IGfx\\GmmKmd_Proc_"; \
WCHAR FullFileName[KM_FILENAME_LENGTH]; \
\
KmGenerateLogFileName(&FullFileName[0], format, FileName, CurrentProcessId); \
\
KM_FILE_IO_OBJ *pGmmKmdLog = KmFileOpen(pHwDevExt, FullFileName, false, false, true); \
if (pGmmKmdLog != NULL) \
{ \
KmFilePrintf(pGmmKmdLog, message, __VA_ARGS__); \
KmFileClose(pGmmKmdLog, false); \
} \
} \
#else // else if Release driver || KMD
#define GMM_LOG_AVAILABLE 0
#endif
#if GMM_LOG_AVAILABLE
typedef enum GmmLogLevel
{
Off = 0,
Trace,
Info,
Error, // default
Critical,
}GmmLogLevel;
#ifdef __cplusplus
#include <iostream>
#define GMM_LOG_FILE_SIZE 1024 * 1024 * 5 // Once log reaches this size, it will start in new file
#define GMM_ROTATE_FILE_NUMBER 3 // Once log is full, it'll save old log with .1/.2/.3 in name, and then start with .1
#define GMM_LOG_MASSAGE_MAX_SIZE 1024
#define GMM_LOGGER_NAME "gmm_logger"
#define GMM_LOG_FILENAME "gmm_log"
#define GMM_LOG_TAG "GmmLib"
#define GMM_UNKNOWN_PROCESS "Unknown_Proc"
#define GMM_PREFIX_STR "INTC GMM SPD: "
#if _WIN32
#define GMM_LOG_REG_KEY_SUB_PATH "SOFTWARE\\Intel\\IGFX\\GMMLOG\\"
#define GMM_LOG_TO_FILE "LogToFile"
#define GMM_LOG_LEVEL_REGKEY "LogLevel" // GmmLogLevel
#endif //#if _WIN32
extern "C" void GmmLibLogging(GmmLogLevel Level, const char* str, ...);
#define GMM_LOG_TRACE(message, ...) GmmLibLogging(Trace, message, ##__VA_ARGS__)
#define GMM_LOG_TRACE_IF(expression, message, ...) if(expression) { GmmLibLogging(Trace, message, ##__VA_ARGS__);}
#define GMM_LOG_INFO(message, ...) GmmLibLogging(Info, message, ##__VA_ARGS__)
#define GMM_LOG_INFO_IF(expression, message, ...) if(expression) { GmmLibLogging(Info, message, ##__VA_ARGS__);}
#define GMM_LOG_ERROR(message, ...) GmmLibLogging(Error, message, ##__VA_ARGS__)
#define GMM_LOG_ERROR_IF(expression, message, ...) if(expression) { GmmLibLogging(Error, message, ##__VA_ARGS__);}
#else // else C
// Fwd Declarations of C-wrapper functions used for Logging
void GmmLibLogging(GmmLogLevel Level, const char* str, ...);
#define GMM_LOG_TRACE(message, ...) GmmLibLogging(Trace, message, ##__VA_ARGS__)
#define GMM_LOG_TRACE_IF(expression, message, ...) if(expression) { GmmLibLogging(Trace, message, ##__VA_ARGS__);}
#define GMM_LOG_INFO(message, ...) GmmLibLogging(Info, message, ##__VA_ARGS__)
#define GMM_LOG_INFO_IF(expression, message, ...) if(expression) { GmmLibLogging(Info, message, ##__VA_ARGS__);}
#define GMM_LOG_ERROR(message, ...) GmmLibLogging(Error, message, ##__VA_ARGS__)
#define GMM_LOG_ERROR_IF(expression, message, ...) if(expression) { GmmLibLogging(Error, message, ##__VA_ARGS__);}
#endif //#ifdef __cplusplus
#else // else Gmm Log not available
#define GMM_LOG_TRACE(message, ...)
#define GMM_LOG_TRACE_IF(expression, message, ...)
#define GMM_LOG_INFO(message, ...)
#define GMM_LOG_INFO_IF(expression, message, ...)
#define GMM_LOG_ERROR(message, ...)
#define GMM_LOG_ERROR_IF(expression, message, ...)
#endif //#if _WIN32
#if GMM_KMD_LOG_AVAILABLE
#else
#define GMM_KMD_LOG(message, ...)
#endif

View File

@ -0,0 +1,57 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#if __cplusplus
namespace GmmLib
{
namespace Utility
{
uint32_t GMM_STDCALL GmmGetNumPlanes(GMM_RESOURCE_FORMAT Format);
GMM_RESOURCE_FORMAT GMM_STDCALL GmmGetFormatForASTC(uint8_t HDR,
uint8_t Float,
uint32_t BlockWidth,
uint32_t BlockHeight,
uint32_t BlockDepth);
}
}
#endif
#ifndef __GMM_KMD__
#define GMM_MALLOC(size) malloc(size)
#define GMM_FREE(p) free(p)
#define GMM_COMPR_FORMAT_INVALID(pGmmLibContext) \
((pGmmLibContext->GetSkuTable().FtrXe2Compression != 0) ? static_cast<uint8_t>(GMM_XE2_UNIFIED_COMP_FORMAT_INVALID) : \
(pGmmLibContext->GetSkuTable().FtrFlatPhysCCS != 0) ? static_cast<uint8_t>(GMM_FLATCCS_FORMAT_INVALID) : \
static_cast<uint8_t>(GMM_E2ECOMP_FORMAT_INVALID))
#else
#define GMM_COMPR_FORMAT_INVALID GMM_E2ECOMP_FORMAT_INVALID
#endif
void GMM_STDCALL GmmGetCacheSizes(GMM_CACHE_SIZES* pCacheSizes);
/* Internal functions */
uint32_t __GmmLog2(uint32_t Value);

View File

@ -0,0 +1,52 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
namespace GmmLib
{
class NON_PAGED_SECTION GmmGen10CachePolicy :
public GmmGen9CachePolicy
{
protected:
/* Function prototypes */
uint32_t BestMatchingPATIdx(GMM_CACHE_POLICY_ELEMENT CachePolicy);
public:
/* Constructors */
GmmGen10CachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicy, Context *pGmmLibContext)
: GmmGen9CachePolicy(pCachePolicy, pGmmLibContext)
{
}
virtual ~GmmGen10CachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
GMM_STATUS SetPATInitWA();
GMM_STATUS SetupPAT();
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,57 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
namespace GmmLib
{
class NON_PAGED_SECTION GmmGen11CachePolicy :
public GmmGen10CachePolicy
{
public:
uint32_t CurrentMaxSpecialMocsIndex;
/* Constructors */
GmmGen11CachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicy, Context *pGmmLibContext)
: GmmGen10CachePolicy(pCachePolicy, pGmmLibContext)
{
CurrentMaxSpecialMocsIndex = 0;
}
virtual ~GmmGen11CachePolicy()
{
}
virtual uint32_t GetMaxSpecialMocsIndex()
{
return CurrentMaxSpecialMocsIndex;
}
int32_t IsSpecialMOCSUsage(GMM_RESOURCE_USAGE_TYPE Usage, bool &UpdateMOCS);
/* Function prototypes */
GMM_STATUS InitCachePolicy();
void SetUpMOCSTable();
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,69 @@
/*==============================================================================
Copyright(c) 2019 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
#define GMM_GEN12_MAX_NUMBER_MOCS_INDEXES (60) // On TGL last four (#60-#63) are reserved by h/w, few? are sw configurable though (#60)
namespace GmmLib
{
class NON_PAGED_SECTION GmmGen12CachePolicy :
public GmmGen11CachePolicy
{
public:
/* Constructors */
GmmGen12CachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicyContext, Context *pGmmLibContext)
: GmmGen11CachePolicy(pCachePolicyContext, pGmmLibContext)
{
#if(defined(__GMM_KMD__))
{
// Set the WA's needed for Private PAT initialization
SetPATInitWA();
SetupPAT();
}
#endif
}
virtual ~GmmGen12CachePolicy()
{
}
virtual uint32_t GetMaxSpecialMocsIndex()
{
return CurrentMaxSpecialMocsIndex;
}
int32_t IsSpecialMOCSUsage(GMM_RESOURCE_USAGE_TYPE Usage, bool& UpdateMOCS);
/* Function prototypes */
GMM_STATUS InitCachePolicy();
uint8_t SelectNewPATIdx(GMM_GFX_MEMORY_TYPE WantedMT, GMM_GFX_MEMORY_TYPE MT1, GMM_GFX_MEMORY_TYPE MT2);
uint32_t BestMatchingPATIdx(GMM_CACHE_POLICY_ELEMENT CachePolicy);
GMM_STATUS SetPATInitWA();
GMM_STATUS SetupPAT();
void SetUpMOCSTable();
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,56 @@
/*==============================================================================
Copyright(c) 2020 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
#define GMM_NUM_PAT_ENTRIES_Xe_HPC (8)
namespace GmmLib
{
class NON_PAGED_SECTION GmmGen12dGPUCachePolicy :
public GmmGen12CachePolicy
{
protected:
uint32_t CurrentMaxPATIndex;
public:
/* Constructors */
GmmGen12dGPUCachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicy, Context *pGmmLibContext)
: GmmGen12CachePolicy(pCachePolicy, pGmmLibContext)
{
NumPATRegisters = GMM_NUM_PAT_ENTRIES_Xe_HPC;
CurrentMaxPATIndex = 0;
}
virtual ~GmmGen12dGPUCachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
void SetUpMOCSTable();
int32_t IsSpecialMOCSUsage(GMM_RESOURCE_USAGE_TYPE Usage, bool& UpdateMOCS);
GMM_STATUS SetupPAT();
uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,72 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
namespace GmmLib
{
class NON_PAGED_SECTION GmmGen8CachePolicy :
public GmmCachePolicyCommon
{
protected:
/* Function prototypes */
GMM_PRIVATE_PAT GetPrivatePATEntry(uint32_t PATIdx);
bool SetPrivatePATEntry(uint32_t PATIdx, GMM_PRIVATE_PAT Entry);
bool SelectNewPATIdx(GMM_GFX_MEMORY_TYPE WantedMT, GMM_GFX_TARGET_CACHE WantedTC,
GMM_GFX_MEMORY_TYPE MT1, GMM_GFX_TARGET_CACHE TC1,
GMM_GFX_MEMORY_TYPE MT2, GMM_GFX_TARGET_CACHE TC2);
bool GetUsagePTEValue(GMM_CACHE_POLICY_ELEMENT CachePolicy,
uint32_t Usage,
uint64_t *pPTEDwordValue);
/* Virtual function prototypes */
virtual uint32_t BestMatchingPATIdx(GMM_CACHE_POLICY_ELEMENT CachePolicy);
public:
/* Constructors */
GmmGen8CachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicyContext, Context *pGmmLibContext)
: GmmCachePolicyCommon(pCachePolicyContext, pGmmLibContext)
{
#if(defined(__GMM_KMD__))
//if (GFX_IS_SKU(pGmmLibContext, FtrIA32eGfxPTEs))
{
// Set the WA's needed for Private PAT initialization
SetPATInitWA();
SetupPAT();
}
#endif
}
virtual ~GmmGen8CachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
GMM_STATUS SetPATInitWA();
GMM_STATUS SetupPAT();
uint8_t GMM_STDCALL CachePolicyIsUsagePTECached(GMM_RESOURCE_USAGE_TYPE Usage);
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,52 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
namespace GmmLib
{
class NON_PAGED_SECTION GmmGen9CachePolicy :
public GmmGen8CachePolicy
{
public:
uint32_t CurrentMaxMocsIndex;
uint32_t CurrentMaxL1HdcMocsIndex;
/* Constructors */
GmmGen9CachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicy, Context *pGmmLibContext)
: GmmGen8CachePolicy(pCachePolicy, pGmmLibContext)
{
CurrentMaxMocsIndex = 0;
CurrentMaxL1HdcMocsIndex = 0;
}
virtual ~GmmGen9CachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
GMM_STATUS SetupPAT();
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,106 @@
/*==============================================================================
Copyright(c) 2024 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
#define GMM_XE2_NUM_MOCS_ENTRIES (16)
#define GMM_XE2_DEFAULT_PAT_INDEX (PAT3)
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef enum GMM_GFX_PHY_L4_MEMORY_TYPE_REC
{
GMM_GFX_PHY_L4_MT_WB = 0x0,
GMM_GFX_PHY_L4_MT_WT = 0x1,
GMM_GFX_PHY_L4_MT_UC = 0x3,
} GMM_GFX_PHY_L4_MEMORY_TYPE;
typedef enum GMM_GFX_PHY_L3_MEMORY_TYPE_REC
{
GMM_GFX_PHY_L3_MT_WB = 0x0,
GMM_GFX_PHY_L3_MT_WB_XD = 0x1, // Transient Flush Display
GMM_GFX_PHY_L3_MT_UC = 0x3,
} GMM_GFX_PHY_L3_MEMORY_TYPE;
typedef enum GMM_GFX_PHY_CACHE_COHERENCY_TYPE_REC
{
GMM_GFX_PHY_NON_COHERENT_NO_SNOOP = 0x0,
GMM_GFX_PHY_NON_COHERENT = 0x1,
GMM_GFX_PHY_COHERENT_ONE_WAY_IA_SNOOP = 0x2,
GMM_GFX_PHY_COHERENT_TWO_WAY_IA_GPU_SNOOP = 0x3
} GMM_GFX_PHY_CACHE_COHERENCY_TYPE;
typedef union GMM_XE2_PRIVATE_PAT_REC
{
struct
{
uint32_t Coherency : 2;
uint32_t L4CC : 2;
uint32_t L3CC : 2;
uint32_t L3CLOS : 2;
uint32_t Reserved1 : 1;
uint32_t LosslessCompressionEn: 1;
uint32_t Reserved2 : 22;
} Xe2;
uint32_t Value;
} GMM_XE2_PRIVATE_PAT;
namespace GmmLib
{
class NON_PAGED_SECTION GmmXe2_LPGCachePolicy : public GmmXe_LPGCachePolicy
{
protected:
public:
/* Constructors */
GmmXe2_LPGCachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicyContext, Context *pGmmLibContext)
: GmmXe_LPGCachePolicy(pCachePolicyContext, pGmmLibContext)
{
NumPATRegisters = GMM_NUM_PAT_ENTRIES;
NumMOCSRegisters = GMM_XE2_NUM_MOCS_ENTRIES;
CurrentMaxPATIndex = 0;
CurrentMaxMocsIndex = 0;
}
virtual ~GmmXe2_LPGCachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
GMM_STATUS SetupPAT();
void SetUpMOCSTable();
void GetL3L4(GMM_CACHE_POLICY_TBL_ELEMENT *pUsageEle, GMM_XE2_PRIVATE_PAT *pUsagePATElement, uint32_t Usage);
uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage);
};
} // namespace GmmLib
#endif // #ifdef __cplusplus
#ifdef __cplusplus
}
#endif /* end__cplusplus*/

View File

@ -0,0 +1,82 @@
/*==============================================================================
Copyright(c) 2025 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
#define GMM_XE3P_NUM_MOCS_ENTRIES (16)
#define GMM_XE3P_DEFAULT_PAT_INDEX (PAT3)
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef union GMM_XE3P_PRIVATE_PAT_REC
{
struct
{
uint32_t Coherency : 2;
uint32_t L4CC : 2;
uint32_t L3CC : 2;
uint32_t L3CLOS : 2;
uint32_t Reserved1 : 1;
uint32_t LosslessCompressionEn: 1;
uint32_t Reserved2 : 22;
} Xe3P;
uint32_t Value;
} GMM_XE3P_PRIVATE_PAT;
namespace GmmLib
{
class NON_PAGED_SECTION GmmXe3P_XPCCachePolicy : public GmmXe2_LPGCachePolicy
{
protected:
public:
/* Constructors */
GmmXe3P_XPCCachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicyContext, Context *pGmmLibContext)
: GmmXe2_LPGCachePolicy(pCachePolicyContext, pGmmLibContext)
{
NumPATRegisters = GMM_NUM_PAT_ENTRIES;
NumMOCSRegisters = GMM_XE3P_NUM_MOCS_ENTRIES;
CurrentMaxPATIndex = 0;
CurrentMaxMocsIndex = 0;
}
virtual ~GmmXe3P_XPCCachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
GMM_STATUS SetupPAT();
void SetUpMOCSTable();
void GetL3L4(GMM_CACHE_POLICY_TBL_ELEMENT *pUsageEle, GMM_XE3P_PRIVATE_PAT *pUsagePATElement, uint32_t Usage);
uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
};
} // namespace GmmLib
#endif // #ifdef __cplusplus
#ifdef __cplusplus
}
#endif /* end__cplusplus*/

View File

@ -0,0 +1,62 @@
/*==============================================================================
Copyright(c) 2022 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../GmmCachePolicyCommon.h"
#define GMM_NUM_PAT_ENTRIES_Xe_LPG (16)
namespace GmmLib
{
class NON_PAGED_SECTION GmmXe_LPGCachePolicy :
public GmmGen12CachePolicy
{
protected:
uint32_t CurrentMaxPATIndex;
public:
/* Constructors */
GmmXe_LPGCachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicyContext, Context *pGmmLibContext)
: GmmGen12CachePolicy(pCachePolicyContext, pGmmLibContext)
{
NumPATRegisters = GMM_NUM_PAT_ENTRIES_Xe_LPG;
CurrentMaxPATIndex = 0;
}
virtual ~GmmXe_LPGCachePolicy()
{
}
/* Function prototypes */
GMM_STATUS InitCachePolicy();
uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
GMM_STATUS SetupPAT();
void SetUpMOCSTable();
void GMM_STDCALL SetL1CachePolicy(uint32_t Usage);
virtual uint32_t GMM_STDCALL GetSurfaceStateL1CachePolicy(GMM_RESOURCE_USAGE_TYPE Usage);
virtual MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage);
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,510 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "GmmCachePolicyExt.h"
#define ALWAYS_OVERRIDE 0xffffffff
#define NEVER_OVERRIDE 0x0
// IA PAT MSR Register
#define GMM_IA32e_PAT_MSR 0x277
#define GMM_PAT_ERROR ((uint32_t)-1)
typedef struct GMM_CACHE_POLICY_ELEMENT_REC
{
uint32_t IDCode;
union {
struct{
uint64_t LLC : 1;
uint64_t ELLC : 1;
uint64_t L3 : 1;
uint64_t WT : 1;
uint64_t AGE : 2;
uint64_t AOM : 1;
uint64_t LeCC_SCC : 3;
uint64_t L3_SCC : 3;
uint64_t SCF : 1; // Snoop Control Field for BXT
uint64_t CoS : 2; // Class of Service, driver default to Class 0
uint64_t SSO : 2; // Self Snoop Override control and value
uint64_t HDCL1 : 1; // HDC L1 caching enable/disable
uint64_t L3Eviction : 2; // Specify L3-eviction type (NA, ReadOnly, Standard, Special)
uint64_t SegOv : 3; // Override seg-pref (none, local-only, sys-only, etc)
uint64_t GlbGo : 1; // Global GO point - L3 or Memory
uint64_t UcLookup : 1; // Snoop L3 for uncached
uint64_t L1CC : 3; // L1 Cache Control
uint64_t Initialized : 1;
uint64_t L2CC : 2; // media internal cache 0:UC, 1:WB
uint64_t L4CC : 2; // L4 memory cache 0: UC, 1:WB, 2: WT
uint64_t Coherency : 2; // 0 non-coh, 1: 1 way coh IA snoop 2: 2 way coh IA GPU snopp
uint64_t CoherentPATIndex : 5;
uint64_t CoherentPATIndexHigherBit : 1; // From Xe2 onwards it requires 6 bit to represent PATIndex. Hence using this single bit (MSB) as extension of the above field CoherentPATIndex:5
uint64_t PATIndexCompressed : 6;
uint64_t L3CC : 2; // 0:UC, 1:WB 2:WB_T_Display, 3:WB_T_App
uint64_t L3CLOS : 2; // Class of service
uint64_t IgnorePAT : 1; // Ignore PAT 1 = Override by MOCS, 0 = Defer to PAT
uint64_t Reserved : 11;
};
uint64_t Value;
};
MEMORY_OBJECT_CONTROL_STATE MemoryObjectOverride;
union
{
MEMORY_OBJECT_CONTROL_STATE MemoryObjectNoOverride;
uint32_t PATIndex;
};
GMM_PTE_CACHE_CONTROL_BITS PTE;
uint32_t Override;
uint32_t IsOverridenByRegkey; // Flag to indicate If usage settings are overridden by regkey
}GMM_CACHE_POLICY_ELEMENT;
// One entry in the SKL/CNL cache lookup table
typedef struct GMM_CACHE_POLICY_TBL_ELEMENT_REC {
union {
struct
{
uint32_t Cacheability : 2; // LLC/eDRAM Cacheability Control (LeCC).
uint32_t TargetCache : 2; // Target Cache (TC).
uint32_t LRUM : 2; // LRU (Cache Replacement) Management (LRUM).
uint32_t AOM : 1; // Do Not Allocate on Miss (AOM) - Not used
uint32_t ESC : 1; // Enable Skip Caching (ESC) on LLC
uint32_t SCC : 3; // Skip Caching Control (SCC).
uint32_t PFM : 3; // Page Fault Mode (PFM)
uint32_t SCF : 1; // Snoop Control Field (SCF)
uint32_t CoS : 2; // Class of Service (COS)- CNL+
uint32_t SelfSnoop : 2; // Self Snoop override or not MIDI settings - CNL+
uint32_t Reserved : 13;
} ;
uint32_t DwordValue;
union {
struct
{
uint32_t Reserved0 : 2;
uint32_t L4CC : 2;
uint32_t Reserved1 : 2;
uint32_t Reserved2 : 2;
uint32_t igPAT : 1; // selection between MOCS and PAT
uint32_t Reserved3 : 23;
};
uint32_t DwordValue;
} Xe_LPG;
} LeCC;
union {
struct
{
uint16_t ESC : 1; // Enable Skip Caching (ESC) for L3.
uint16_t SCC : 3; // Skip Caching Control (SCC) for L3.
uint16_t Cacheability : 2; // L3 Cacheability Control (L3CC).
uint16_t GlobalGo : 1; // Global Go (GLBGO).
uint16_t UCLookup : 1; // UC L3 Lookup (UcL3Lookup).
uint16_t Reserved : 8;
} ;
uint16_t UshortValue;
union
{
struct
{
uint16_t Reserved : 2;
uint16_t L4CC : 2;
uint16_t L3CC : 2;
uint16_t L3CLOS : 2;
uint16_t igPAT : 1; // selection between MOCS and PAT
uint16_t Reserved0: 7;
};
} PhysicalL3;
} L3;
uint8_t HDCL1;
} GMM_CACHE_POLICY_TBL_ELEMENT;
typedef enum GMM_IA32e_MEMORY_TYPE_REC
{
GMM_IA32e_UC = 0x0,
GMM_IA32e_WC = 0x1,
GMM_IA32e_WT = 0x4,
GMM_IA32e_WP = 0x5,
GMM_IA32e_WB = 0x6,
GMM_IA32e_UCMINUS = 0x7
} GMM_IA32e_MEMORY_TYPE;
typedef enum GMM_GFX_MEMORY_TYPE_REC
{
GMM_GFX_UC_WITH_FENCE = 0x0,
GMM_GFX_WC = 0x1,
GMM_GFX_WT = 0x2,
GMM_GFX_WB = 0x3
} GMM_GFX_MEMORY_TYPE;
typedef enum GMM_L4_CACHING_POLICY_REC
{
GMM_CP_COHERENT_WB = 0x0,
GMM_CP_NON_COHERENT_WB = 0x0,
GMM_CP_NON_COHERENT_WT = 0x1,
GMM_CP_NON_COHERENT_UC = 0x3,
} GMM_L4_CACHING_POLICY;
// This Enums represent the GMM indicative values for L1/L3/L4 cache attributes.
typedef enum GMM_CACHING_POLICY_REC
{
GMM_UC = 0x0, //uncached
GMM_WB = 0x1, // Write back
GMM_WT = 0x2, // write-through
GMM_WBTD = 0x3, // WB_T_Display
GMM_WBTA = 0x4, // WB_T_App
GMM_WBP = 0x5, // write bypass mode
GMM_WS = 0x6, // Write-Streaming
} GMM_CACHING_POLICY;
typedef enum GMM_COHERENCY_TYPE_REC
{
GMM_NON_COHERENT_NO_SNOOP = 0x0,
GMM_COHERENT_ONE_WAY_IA_SNOOP = 0x1,
GMM_COHERENT_TWO_WAY_IA_GPU_SNOOP = 0x2
} GMM_COHERENCY_TYPE;
typedef enum GMM_GFX_COHERENCY_TYPE_REC
{
GMM_GFX_NON_COHERENT_NO_SNOOP = 0x0,
GMM_GFX_NON_COHERENT = 0x1,
GMM_GFX_COHERENT_ONE_WAY_IA_SNOOP = 0x2,
GMM_GFX_COHERENT_TWO_WAY_IA_GPU_SNOOP = 0x3
} GMM_GFX_COHERENCY_TYPE;
typedef enum GMM_GFX_PAT_TYPE_REC
{
GMM_GFX_PAT_WB_COHERENT = 0x0, // WB + Snoop : Atom
GMM_GFX_PAT_WC = 0x1,
GMM_GFX_PAT_WB_MOCSLESS = 0x2, // WB + eLLC/LLC : MOCSLess Resource (PageTables)
GMM_GFX_PAT_WB = 0x3,
GMM_GFX_PAT_WT = 0x4,
GMM_GFX_PAT_UC = 0x5
} GMM_GFX_PAT_TYPE;
typedef enum GMM_GFX_PAT_IDX_REC
{
PAT0 = 0x0, // Will be tied to GMM_GFX_PAT_WB_COHERENT or GMM_GFX_PAT_UC depending on WaGttPat0WB
PAT1, // Will be tied to GMM_GFX_PAT_UC or GMM_GFX_PAT_WB_COHERENT depending on WaGttPat0WB
PAT2, // Will be tied to GMM_GFX_PAT_WB_MOCSLESS
PAT3, // Will be tied to GMM_GFX_PAT_WB
PAT4, // Will be tied to GMM_GFX_PAT_WT
PAT5, // Will be tied to GMM_GFX_PAT_WC
PAT6, // Will be tied to GMM_GFX_PAT_WC
PAT7, // Will be tied to GMM_GFX_PAT_WC
// Additional registers
PAT8,
PAT9,
PAT10,
PAT11,
PAT12,
PAT13,
PAT14,
PAT15,
PAT16,
PAT17,
PAT18,
PAT19,
PAT20,
PAT21,
PAT22,
PAT23,
PAT24,
PAT25,
PAT26,
PAT27,
PAT28,
PAT29,
PAT30,
PAT31
} GMM_GFX_PAT_IDX;
#define GFX_IS_ATOM_PLATFORM(pGmmLibContext) (GmmGetSkuTable(pGmmLibContext)->FtrLCIA)
typedef enum GMM_GFX_TARGET_CACHE_REC
{
GMM_GFX_TC_ELLC_ONLY = 0x0,
GMM_GFX_TC_LLC_ONLY = 0x1,
GMM_GFX_TC_ELLC_LLC = 0x3
} GMM_GFX_TARGET_CACHE;
typedef union GMM_PRIVATE_PAT_REC {
struct
{
uint32_t MemoryType : 2;
uint32_t TargetCache : 2;
uint32_t Age : 2;
uint32_t Snoop : 1;
uint32_t Reserved : 1;
}PreGen10;
#if (IGFX_GEN >= IGFX_GEN10)
struct
{
uint32_t MemoryType : 2;
uint32_t TargetCache : 2;
uint32_t Age : 2;
uint32_t Reserved1 : 2;
uint32_t CoS : 2;
uint32_t Reserved2 : 22;
}Gen10;
#endif
struct
{
uint32_t MemoryType : 2;
uint32_t Reserved : 30;
}Gen12;
struct
{
uint32_t MemoryType : 2; //L3
uint32_t L3CLOS : 2;
uint32_t Reserved : 28;
} Xe_HPC;
struct
{
uint32_t Coherency : 2;
uint32_t L4CC : 2;
uint32_t Reserved : 28;
}Xe_LPG;
struct
{
uint32_t Coherency : 2;
uint32_t L4CC : 2;
uint32_t L3CC : 2;
uint32_t L3CLOS : 2;
uint32_t Reserved1 : 1;
uint32_t LosslessCompressionEn: 1;
uint32_t NoCachingPromote : 1;
uint32_t Reserved2 : 21;
} Xe2;
uint32_t Value;
} GMM_PRIVATE_PAT;
#ifdef _WIN32
#define GMM_CACHE_POLICY_OVERRIDE_REGISTY_PATH_REGISTRY_UMD "SOFTWARE\\Intel\\IGFX\\CachePolicy\\"
#define GMM_CACHE_POLICY_OVERRIDE_REGISTY_PATH_REGISTRY_KMD "\\REGISTRY\\MACHINE\\" GMM_CACHE_POLICY_OVERRIDE_REGISTY_PATH_REGISTRY_UMD
// No local variables or ternary (?:) operators should be defined in the
// REG_OVERRIDE macro block. This block will generate hundreds of instances
// of itself in the OverrideCachePolicy, each of which will geneate a
// copy of these local variables on the stack. The ternary operator will
// also generate local temparoary stack variables, and all these add up and
// can cause a stack overflow.
#define READOVERRIDES(Usage) \
if (!REGISTRY_OVERRIDE_READ(Usage,LLC)) LLC = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,ELLC)) ELLC = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,L3)) L3 = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,Age)) Age = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,WT)) WT = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,AOM)) AOM = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,LeCC_SCC)) LeCC_SCC = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,L3_SCC)) L3_SCC = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,SCF)) SCF = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,SSO)) SSO = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,CoS)) CoS = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,HDCL1)) HDCL1 = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,L3Eviction)) L3Eviction = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,GlbGo)) GlbGo = -1; \
if (!REGISTRY_OVERRIDE_READ(Usage,UcLookup)) UcLookup = -1; \
#define SETOVERRIDES(Usage) \
if (LLC != -1) \
{ \
pCachePolicy[Usage].LLC = LLC; \
} \
if (ELLC != -1) \
{ \
pCachePolicy[Usage].ELLC = ELLC; \
} \
if (L3 != -1) \
{ \
pCachePolicy[Usage].L3 = L3; \
} \
if (WT != -1) \
{ \
pCachePolicy[Usage].WT = WT; \
} \
if (Age != -1) \
{ \
pCachePolicy[Usage].AGE = Age; \
} \
if (AOM != -1) \
{ \
pCachePolicy[Usage].AOM = AOM; \
} \
if (LeCC_SCC != -1) \
{ \
pCachePolicy[Usage].LeCC_SCC = LeCC_SCC; \
} \
if (L3_SCC != -1) \
{ \
pCachePolicy[Usage].L3_SCC = L3_SCC; \
} \
if (SCF != -1) \
{ \
pCachePolicy[Usage].SCF = SCF; \
} \
if (SSO != -1) \
{ \
pCachePolicy[Usage].SSO = SSO; \
} \
if (CoS != -1) \
{ \
pCachePolicy[Usage].CoS = CoS; \
} \
if (HDCL1 != -1) \
{ \
pCachePolicy[Usage].HDCL1 = HDCL1; \
} \
if (L3Eviction != -1) \
{ \
pCachePolicy[Usage].L3Eviction = L3Eviction; \
} \
if (GlbGo != -1) \
{ \
pCachePolicy[Usage].GlbGo = GlbGo; \
} \
if (UcLookup != -1) \
{ \
pCachePolicy[Usage].UcLookup = UcLookup; \
} \
{ \
pCachePolicy[Usage].IsOverridenByRegkey = 1; \
}
#ifdef __GMM_KMD__
#define REG_OVERRIDE(Usage) \
{ \
enum {IGNORED = 0, CURRENT, DEFAULT, UNCACHED}; \
\
REGISTRY_OVERRIDE_READ(Usage,Enable); \
\
if (Enable && (GenerateKeys != UNCACHED)) \
{ \
READOVERRIDES(Usage) \
} \
\
if (GenerateKeys == DEFAULT || (GenerateKeys == CURRENT && !Enable)) \
{ \
REGISTRY_OVERRIDE_WRITE(Usage,LLC, pCachePolicy[Usage].LLC); \
REGISTRY_OVERRIDE_WRITE(Usage,ELLC,pCachePolicy[Usage].ELLC); \
REGISTRY_OVERRIDE_WRITE(Usage,L3, pCachePolicy[Usage].L3); \
REGISTRY_OVERRIDE_WRITE(Usage,WT, pCachePolicy[Usage].WT); \
REGISTRY_OVERRIDE_WRITE(Usage,Age, pCachePolicy[Usage].AGE); \
REGISTRY_OVERRIDE_WRITE(Usage,AOM, pCachePolicy[Usage].AOM); \
REGISTRY_OVERRIDE_WRITE(Usage,LeCC_SCC, pCachePolicy[Usage].LeCC_SCC); \
REGISTRY_OVERRIDE_WRITE(Usage,L3_SCC, pCachePolicy[Usage].L3_SCC); \
REGISTRY_OVERRIDE_WRITE(Usage,SCF, pCachePolicy[Usage].SCF); \
REGISTRY_OVERRIDE_WRITE(Usage,SSO, pCachePolicy[Usage].SSO); \
REGISTRY_OVERRIDE_WRITE(Usage,CoS, pCachePolicy[Usage].CoS); \
REGISTRY_OVERRIDE_WRITE(Usage,HDCL1, pCachePolicy[Usage].HDCL1); \
REGISTRY_OVERRIDE_WRITE(Usage,L3Eviction, pCachePolicy[Usage].L3Eviction); \
REGISTRY_OVERRIDE_WRITE(Usage,Enable,0); \
REGISTRY_OVERRIDE_WRITE(Usage,GlbGo, pCachePolicy[Usage].GlbGo); \
REGISTRY_OVERRIDE_WRITE(Usage,UcLookup, pCachePolicy[Usage].UcLookup); \
} \
else if (GenerateKeys == UNCACHED || GenerateKeys == CURRENT) \
{ \
if (GenerateKeys == UNCACHED) \
{ \
Enable = 1; \
} \
REGISTRY_OVERRIDE_WRITE(Usage,LLC, LLC); \
REGISTRY_OVERRIDE_WRITE(Usage,ELLC,ELLC); \
REGISTRY_OVERRIDE_WRITE(Usage,L3, L3); \
REGISTRY_OVERRIDE_WRITE(Usage,WT, WT); \
REGISTRY_OVERRIDE_WRITE(Usage,Age, Age); \
REGISTRY_OVERRIDE_WRITE(Usage,AOM, AOM); \
REGISTRY_OVERRIDE_WRITE(Usage,LeCC_SCC, LeCC_SCC); \
REGISTRY_OVERRIDE_WRITE(Usage,L3_SCC, L3_SCC); \
REGISTRY_OVERRIDE_WRITE(Usage,SCF, SCF); \
REGISTRY_OVERRIDE_WRITE(Usage,SSO, SSO); \
REGISTRY_OVERRIDE_WRITE(Usage,CoS, CoS); \
REGISTRY_OVERRIDE_WRITE(Usage,HDCL1, HDCL1); \
REGISTRY_OVERRIDE_WRITE(Usage,L3Eviction, L3Eviction); \
REGISTRY_OVERRIDE_WRITE(Usage,Enable,Enable); \
REGISTRY_OVERRIDE_WRITE(Usage,GlbGo, GlbGo); \
REGISTRY_OVERRIDE_WRITE(Usage,UcLookup, UcLookup); \
} \
\
if (Enable) \
{ \
SETOVERRIDES(Usage) \
} \
\
UsageCount++; \
}
#else
#define REG_OVERRIDE(Usage) \
{ \
REGISTRY_OVERRIDE_READ(Usage,Enable); \
if (Enable) \
{ \
READOVERRIDES(Usage) \
SETOVERRIDES(Usage) \
} \
UsageCount++; \
}
#endif
#endif // #if _WIN32
#if __cplusplus
#include "GmmCachePolicyCommon.h"
#include "CachePolicy/GmmCachePolicyGen8.h"
#include "CachePolicy/GmmCachePolicyGen9.h"
#endif
// Function Prototypes
GMM_STATUS GmmInitializeCachePolicy();
GMM_GFX_MEMORY_TYPE GmmGetWantedMemoryType(void *pLibContext, GMM_CACHE_POLICY_ELEMENT CachePolicy);
// Used for GMM ULT testing.
#ifdef __GMM_ULT
extern void __GmmULTCachePolicy(GMM_CACHE_POLICY_ELEMENT *pCachePolicy);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,111 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "GmmMemAllocator.hpp"
#include "GmmResourceInfoExt.h"
#if LHDM
// Applicable upto Gen9, Gen11+ gmmlib provides Cross-OS Fixed MOCS table as default support.
#define GMM_DYNAMIC_MOCS_TABLE
#define GMM_FIXED_MOCS_TABLE // Use for Gen11+
#endif
/////////////////////////////////////////////////////////////////////////////////////
/// @file GmmCachePolicyCommon.h
/// @brief This file contains Gmm Cache Policy functions
/////////////////////////////////////////////////////////////////////////////////////
namespace GmmLib
{
/////////////////////////////////////////////////////////////////////////
/// Contains the Gmm Cache Policy functions common for Linux and Windows
/// implementation. This class is inherited by gen specific class so
/// so clients shouldn't have to ever interact with this class directly.
/////////////////////////////////////////////////////////////////////////
class Context;
class NON_PAGED_SECTION GmmCachePolicyCommon :
public GmmMemAllocator
{
protected:
Context * pGmmLibContext;
uint32_t NumPATRegisters;
uint32_t NumMOCSRegisters;
public:
GMM_CACHE_POLICY_ELEMENT *pCachePolicy;
/* Constructor */
GmmCachePolicyCommon(GMM_CACHE_POLICY_ELEMENT *pCachePolicy, Context *pGmmLibContext);
/* Function prototypes */
GMM_GFX_MEMORY_TYPE GetWantedMemoryType(GMM_CACHE_POLICY_ELEMENT CachePolicy);
#define DEFINE_CP_ELEMENT(Usage, llc, ellc, l3, wt, age, aom, lecc_scc, l3_scc, scf, sso, cos, hdcl1, l3evict, segov, glbgo, uclookup, l1cc, l2cc, l4cc, coherency, l3cc, l3clos, igPAT)\
do { \
pCachePolicy[Usage].LLC = (llc); \
pCachePolicy[Usage].ELLC = (ellc); \
pCachePolicy[Usage].L3 = (l3); \
pCachePolicy[Usage].WT = (wt); \
pCachePolicy[Usage].AGE = (age); \
pCachePolicy[Usage].AOM = (aom); \
pCachePolicy[Usage].LeCC_SCC = (lecc_scc); \
pCachePolicy[Usage].L3_SCC = (l3_scc); \
pCachePolicy[Usage].SCF = (scf); \
pCachePolicy[Usage].SSO = (sso); \
pCachePolicy[Usage].CoS = (cos); \
pCachePolicy[Usage].HDCL1 = (hdcl1); \
pCachePolicy[Usage].L3Eviction = (l3evict); \
pCachePolicy[Usage].SegOv = (segov); \
pCachePolicy[Usage].GlbGo = (glbgo); \
pCachePolicy[Usage].UcLookup = (uclookup); \
pCachePolicy[Usage].L1CC = (l1cc); \
pCachePolicy[Usage].Initialized = 1; \
pCachePolicy[Usage].L2CC = (l2cc); \
pCachePolicy[Usage].L4CC = (l4cc); \
pCachePolicy[Usage].Coherency = (coherency); \
pCachePolicy[Usage].L3CC = (l3cc); \
pCachePolicy[Usage].L3CLOS = (l3clos); \
pCachePolicy[Usage].IgnorePAT = (igPAT); \
} while (0)
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetOriginalMemoryObject(GMM_RESOURCE_INFO *pResInfo);
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage);
GMM_PTE_CACHE_CONTROL_BITS GMM_STDCALL CachePolicyGetPteType(GMM_RESOURCE_USAGE_TYPE Usage);
/* Virtual functions prototype*/
virtual uint8_t GMM_STDCALL CachePolicyIsUsagePTECached(GMM_RESOURCE_USAGE_TYPE Usage) = 0;
virtual GMM_STATUS InitCachePolicy() = 0;
virtual uint32_t GetMaxSpecialMocsIndex()
{
return 0;
}
virtual ~GmmCachePolicyCommon()
{
}
virtual uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
uint32_t GMM_STDCALL CachePolicyGetNumPATRegisters();
virtual uint32_t GMM_STDCALL GetSurfaceStateL1CachePolicy(GMM_RESOURCE_USAGE_TYPE Usage);
};
}
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,153 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
//===========================================================================
// typedef:
// GMM_RESOURCE_USAGE
//
// Description:
// Defines Usage types for different Resources
//----------------------------------------------------------------------------
typedef enum GMM_RESOURCE_USAGE_TYPE_ENUM
{
//Generic Usage
GMM_RESOURCE_USAGE_UNKNOWN = 0, // <== MUST EQUAL 0
#define DEFINE_RESOURCE_USAGE(Usage) Usage,
#include "../../../CachePolicy/GmmCachePolicyResourceUsageDefinitions.h"
#undef DEFINE_RESOURCE_USAGE
GMM_RESOURCE_USAGE_MAX // <== MUST BE LAST ELEMENT
}GMM_RESOURCE_USAGE_TYPE;
typedef union GMM_PTE_CACHE_CONTROL_BITS_REC
{
struct
{
uint64_t Valid : 1;
uint64_t CacheControl : 2;
uint64_t GFDT : 1;
uint64_t : 28;
uint64_t : 32;
} Gen6;
struct
{
uint64_t Valid : 1;
uint64_t CacheControlLo : 3;
uint64_t : 7;
uint64_t CacheControlHi : 1;
uint64_t : 20;
uint64_t : 32;
} Gen7_5;
struct
{
uint64_t Valid : 1;
uint64_t : 2;
uint64_t PWT : 1;
uint64_t PCD : 1;
uint64_t : 2;
uint64_t PAT : 1;
uint64_t : 24;
uint64_t : 32;
} Gen8;
struct
{
uint64_t Valid : 1;
uint64_t : 2;
uint64_t PAT0 : 1;
uint64_t PAT1 : 1;
uint64_t : 2;
uint64_t PAT2 : 1;
uint64_t : 24;
uint64_t : 30;
uint64_t PAT3 : 1;
uint64_t : 1;
} XE_LPG;
struct
{
uint32_t DwordValue;
uint32_t HighDwordValue;
};
} GMM_PTE_CACHE_CONTROL_BITS;
typedef union MEMORY_OBJECT_CONTROL_STATE_REC {
struct
{
uint32_t CacheControl : 2;
uint32_t GFDT : 1;
uint32_t : 1;
uint32_t : 28;
} Gen6;
struct
{
uint32_t L3 : 1;
uint32_t CacheControl : 1;
uint32_t GFDT : 1;
uint32_t EncryptedData : 1;
uint32_t : 28;
} Gen7;
struct
{
uint32_t L3 : 1;
uint32_t CacheControl : 2;
uint32_t EncryptedData : 1;
uint32_t : 28;
} Gen7_5;
struct
{
uint32_t Age : 2;
uint32_t EncryptedData : 1;
uint32_t TargetCache : 2;
uint32_t CacheControl : 2;
uint32_t : 25;
} Gen8;
struct
{
uint32_t EncryptedData : 1;
uint32_t Index : 6;
uint32_t : 25;
} Gen9, Gen10, Gen11, Gen12, XE_HP, XE_LPG, XE2;
uint32_t DwordValue;
} MEMORY_OBJECT_CONTROL_STATE;
// typedef:
// GMM_CACHE_POLICY
//
// Description:
// This struct is used for accessing Cache Policy functions.
// Forward Declaration: Defined in GmmCachePolicy.h
//---------------------------------------------------------------------------
#ifdef __cplusplus
namespace GmmLib
{
class GmmCachePolicyCommon;
}
typedef GmmLib::GmmCachePolicyCommon GMM_CACHE_POLICY;
#else
struct GmmCachePolicyCommon;
typedef struct GmmCachePolicyCommon GMM_CACHE_POLICY;
#endif

View File

@ -0,0 +1,234 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#include "GmmCommonExt.h"
#include "GmmInfo.h"
//////////////////////////////////////////////////////////////////
// Memory Allocators and DeAllocators for Gmm Create Objects
// This is needed for Clients who want to construct using their
// own memory allocators
//////////////////////////////////////////////////////////////////
typedef void* (GMM_STDCALL *PFN_ClientAllocationFunction)(
void* pUserData,
uint32_t size,
uint32_t alignment);
typedef void (GMM_STDCALL *PFN_ClientFreeFunction)(
void* pUserData,
void* pMemory);
typedef struct _GmmClientAllocationCallbacks_
{
void* pUserData;
uint32_t size;
uint32_t alignment;
PFN_ClientAllocationFunction pfnAllocation;
PFN_ClientFreeFunction pfnFree;
} GmmClientAllocationCallbacks;
//===========================================================================
// typedef:
// GMM_DEVICE_OPERATION
//
// Description:
// Decribes compoents required for device operations.
//---------------------------------------------- ------------------------------
typedef struct _GMM_DEVICE_INFO_REC
{
GMM_DEVICE_CALLBACKS_INT *pDeviceCb;
}GMM_DEVICE_INFO;
#ifdef __cplusplus
#include "GmmMemAllocator.hpp"
/////////////////////////////////////////////////////////////////////////////////////
/// @file GmmClientContext.h
/// @brief This file contains the functions and members of GmmClientContext that is
/// common for both Linux and Windows.
///
/////////////////////////////////////////////////////////////////////////////////////
namespace GmmLib
{
/////////////////////////////////////////////////////////////////////////
/// Contains functions and members that are common between Linux and
/// Windows implementation. This class members will hold data that
/// are specific to each client.
/////////////////////////////////////////////////////////////////////////
class Context;
class GMM_LIB_API NON_PAGED_SECTION GmmClientContext : public GmmMemAllocator
{
protected:
GMM_CLIENT ClientType;
///< Placeholders for storing UMD context. Actual UMD context that needs to be stored here is
union
{
void *pUmdAdapter;
GMM_AIL_STRUCT *pClientContextAilFlags; //To store the UMD AIL flags. This is applicable for each client. Used to populate the corresponding LibContextAilFlags
};
GMM_UMD_CONTEXT *pGmmUmdContext;
GMM_DEVICE_CALLBACKS_INT DeviceCB; //OS-specific defn: Will be used by Clients to send as input arguments.
// Flag to indicate Device_callbacks received.
uint8_t IsDeviceCbReceived;
Context *pGmmLibContext;
public:
/* Constructor */
GmmClientContext(GMM_CLIENT ClientType);
GmmClientContext(GMM_CLIENT ClientType, Context* pLibContext);
/* Virtual destructor */
virtual ~GmmClientContext();
/* Inline functions */
/////////////////////////////////////////////////////////////////////////////////////
/// Returns the GMM_CLIENT Type that has created this ClientContext.
/// @return GMM_CLIENT
/////////////////////////////////////////////////////////////////////////////////////
GMM_INLINE_VIRTUAL GMM_INLINE_EXPORTED GMM_CLIENT GMM_STDCALL GetClientType()
{
return (ClientType);
}
GMM_INLINE_VIRTUAL GMM_LIB_CONTEXT *GetLibContext()
{
return pGmmLibContext;
}
/* Function prototypes */
/* CachePolicy Related Exported Functions from GMM Lib */
GMM_VIRTUAL MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage);
GMM_VIRTUAL GMM_PTE_CACHE_CONTROL_BITS GMM_STDCALL CachePolicyGetPteType(GMM_RESOURCE_USAGE_TYPE Usage);
GMM_VIRTUAL MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL CachePolicyGetOriginalMemoryObject(GMM_RESOURCE_INFO *pResInfo);
GMM_VIRTUAL uint8_t GMM_STDCALL CachePolicyIsUsagePTECached(GMM_RESOURCE_USAGE_TYPE Usage);
GMM_VIRTUAL uint8_t GMM_STDCALL GetSurfaceStateL1CachePolicy(GMM_RESOURCE_USAGE_TYPE Usage);
GMM_VIRTUAL uint32_t GMM_STDCALL CachePolicyGetMaxMocsIndex();
GMM_VIRTUAL uint32_t GMM_STDCALL CachePolicyGetMaxL1HdcMocsIndex();
GMM_VIRTUAL uint32_t GMM_STDCALL CachePolicyGetMaxSpecialMocsIndex();
GMM_VIRTUAL GMM_CACHE_POLICY_ELEMENT* GMM_STDCALL GetCachePolicyUsage();
GMM_VIRTUAL void GMM_STDCALL GetCacheSizes(GMM_CACHE_SIZES *pCacheSizes);
GMM_VIRTUAL GMM_CACHE_POLICY_ELEMENT GMM_STDCALL GetCachePolicyElement(GMM_RESOURCE_USAGE_TYPE Usage);
GMM_VIRTUAL GMM_CACHE_POLICY_TBL_ELEMENT GMM_STDCALL GetCachePolicyTlbElement(uint32_t MocsIdx);
GMM_VIRTUAL GMM_PLATFORM_INFO& GMM_STDCALL GetPlatformInfo();
GMM_VIRTUAL const SKU_FEATURE_TABLE& GMM_STDCALL GetSkuTable();
GMM_VIRTUAL void GMM_STDCALL GetExtendedTextureAlign(uint32_t Mode, ALIGNMENT &UnitAlign);
GMM_VIRTUAL uint8_t GMM_STDCALL IsPlanar(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint8_t GMM_STDCALL IsP0xx(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint8_t GMM_STDCALL IsUVPacked(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint8_t GMM_STDCALL IsCompressed(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint8_t GMM_STDCALL IsYUVPacked(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL GMM_SURFACESTATE_FORMAT GMM_STDCALL GetSurfaceStateFormat(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint8_t GMM_STDCALL GetSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint8_t GMM_STDCALL GetMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL GMM_E2ECOMP_FORMAT GMM_STDCALL GetLosslessCompressionType(GMM_RESOURCE_FORMAT Format);
GMM_VIRTUAL uint64_t GMM_STDCALL GetInternalGpuVaRangeLimit();
/* ResourceInfo Creation and Destroy API's */
GMM_VIRTUAL GMM_RESOURCE_INFO* GMM_STDCALL CreateResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams);
GMM_VIRTUAL GMM_RESOURCE_INFO* GMM_STDCALL CopyResInfoObject(GMM_RESOURCE_INFO *pSrcRes);
GMM_VIRTUAL void GMM_STDCALL ResMemcpy(void *pDst, void *pSrc);
GMM_VIRTUAL void GMM_STDCALL DestroyResInfoObject(GMM_RESOURCE_INFO *pResInfo);
/* PageTableMgr Creation and Destroy API's */
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(GMM_DEVICE_CALLBACKS_INT* pDevCb, uint32_t TTFlags);
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(uint32_t TTFlags);
/* PageTableMgr Creation and Destroy API's */
GMM_VIRTUAL void GMM_STDCALL DestroyPageTblMgrObject(GMM_PAGETABLE_MGR* pPageTableMgr);
#ifdef GMM_LIB_DLL
/* ResourceInfo and PageTableMgr Create and Destroy APIs with Client provided Memory Allocators */
GMM_VIRTUAL GMM_RESOURCE_INFO* GMM_STDCALL CreateResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams,
GmmClientAllocationCallbacks *pAllocCbs);
GMM_VIRTUAL void GMM_STDCALL DestroyResInfoObject(GMM_RESOURCE_INFO *pResInfo,
GmmClientAllocationCallbacks *pAllocCbs);
#endif
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(
GMM_DEVICE_CALLBACKS_INT* pDevCb,
uint32_t TTFlags,
GmmClientAllocationCallbacks* pAllocCbs);
GMM_VIRTUAL GMM_PAGETABLE_MGR* GMM_STDCALL CreatePageTblMgrObject(
uint32_t TTFlags,
GmmClientAllocationCallbacks* pAllocCbs);
GMM_VIRTUAL void GMM_STDCALL DestroyPageTblMgrObject(GMM_PAGETABLE_MGR* pPageTableMgr,
GmmClientAllocationCallbacks* pAllocCbs);
GMM_VIRTUAL GMM_STATUS GMM_STDCALL GmmSetDeviceInfo(GMM_DEVICE_INFO* DeviceInfo);
GMM_VIRTUAL GMM_RESOURCE_INFO* GMM_STDCALL CreateCustomResInfoObject(GMM_RESCREATE_CUSTOM_PARAMS* pCreateParams);
#ifndef __GMM_KMD__
GMM_VIRTUAL GMM_RESOURCE_INFO *GMM_STDCALL CreateCustomResInfoObject_2(GMM_RESCREATE_CUSTOM_PARAMS_2 *pCreateParams);
#endif
GMM_VIRTUAL uint32_t GMM_STDCALL CachePolicyGetPATIndex(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
GMM_VIRTUAL const SWIZZLE_DESCRIPTOR *GMM_STDCALL GetSwizzleDesc(EXTERNAL_SWIZZLE_NAME ExternalSwizzleName, EXTERNAL_RES_TYPE ResType, uint8_t bpe, bool isStdSwizzle = false);
GMM_VIRTUAL void GMM_STDCALL GmmSetAIL(GMM_AIL_STRUCT *pAilFlags);
GMM_VIRTUAL const uint64_t *GMM_STDCALL GmmGetAIL();
};
}
typedef GmmLib::GmmClientContext GMM_CLIENT_CONTEXT;
#else
struct GmmClientContext;
typedef struct GmmClientContext GMM_CLIENT_CONTEXT;
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* ClientContext will be unique to each client */
GMM_CLIENT_CONTEXT *GMM_STDCALL GmmCreateClientContextForAdapter(GMM_CLIENT ClientType,
ADAPTER_BDF sBdf, const void *_pSkuTable);
void GMM_STDCALL GmmDeleteClientContext(GMM_CLIENT_CONTEXT *pGmmClientContext);
#if GMM_LIB_DLL
#ifdef _WIN32
GMM_STATUS GMM_STDCALL GmmCreateLibContext(const PLATFORM Platform,
const SKU_FEATURE_TABLE *pSkuTable,
const WA_TABLE * pWaTable,
const GT_SYSTEM_INFO * pGtSysInfo,
ADAPTER_BDF sBdf);
#else
GMM_STATUS GMM_STDCALL GmmCreateLibContext(const PLATFORM Platform,
const void * pSkuTable,
const void * pWaTable,
const void * pGtSysInfo,
ADAPTER_BDF sBdf,
const GMM_CLIENT ClientType);
#endif
void GMM_STDCALL GmmLibContextFree(ADAPTER_BDF sBdf);
GMM_LIB_API_CONSTRUCTOR void GmmCreateMultiAdapterContext();
GMM_LIB_API_DESTRUCTOR void GmmDestroyMultiAdapterContext();
#endif //GMM_LIB_DLL
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,697 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
//===========================================================================
// Macros to be defined for GMM Lib DLL
//===========================================================================
#ifdef GMM_LIB_DLL /* To be defined by Clients if GMMlib needs to be in DLL/so */
#define GMM_INLINE_VIRTUAL virtual
#define GMM_VIRTUAL virtual
#define GMM_INLINE_EXPORTED /* Macro To avoid inlining of exported member functions in Client’s code in DLL mode*/
#define GMM_LIB_DLL_MA 1 // Macro to indicate whether GMM Lib DLL is Multi-Adapter capable. Todo: Make this a build macro
#ifdef _WIN32
#ifdef GMM_LIB_DLL_EXPORTS
#define GMM_LIB_API __declspec(dllexport) /* Macro to define GMM Lib DLL exports */
#else
#define GMM_LIB_API __declspec(dllimport) /* Macro to define GMM Lib DLL imports */
#endif /* GMM_LIB_DLL_EXPORTS */
#define GMM_LIB_API_CONSTRUCTOR
#define GMM_LIB_API_DESTRUCTOR
#else // Linux
#ifdef GMM_LIB_DLL_EXPORTS
#define GMM_LIB_API __attribute__ ((visibility ("default")))
#else
#define GMM_LIB_API
#endif
#define GMM_LIB_API_CONSTRUCTOR __attribute__((constructor))
#define GMM_LIB_API_DESTRUCTOR __attribute__((destructor))
#endif
#else // !GMM_LIB_DLL
#define GMM_INLINE_VIRTUAL
#define GMM_VIRTUAL
#define GMM_LIB_API
#define GMM_INLINE_EXPORTED __inline
#endif /* GMM_LIB_DLL */
#define INCLUDE_CpuSwizzleBlt_c_AS_HEADER
#include "../../../Utility/CpuSwizzleBlt/CpuSwizzleBlt.c"
extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_8bpp;
extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_16_32bpp;
extern const SWIZZLE_DESCRIPTOR INTEL_64KB_UNDEFINED_64_128bpp;
// Set packing alignment
#pragma pack(push, 8)
#if defined(__ARM_ARCH)
#define GMM_STDCALL // GMM function calling convention
#else
#define GMM_STDCALL __stdcall // GMM function calling convention
#endif
#define GMM_NO_FENCE_REG 0xDEADBEEF
#define GMM_MAX_DISPLAYS 3
#if defined __linux__
typedef void* HANDLE;
#endif
//===========================================================================
// typedef:
// GMM_GFX_ADDRESS/etc.
//
// Description:
// The GMM GfxAddr/Size and related types and casting functions.
//----------------------------------------------------------------------------
// Always use x64 (D3D11.2 Tiled Resources needs >32 bit gfx address space)
typedef uint64_t GMM_GFX_ADDRESS, GMM_GFX_SIZE_T, GMM_VOIDPTR64;
#define GMM_GFX_ADDRESS_MAX ((GMM_GFX_ADDRESS) 0xffffffffffffffff)
typedef uint32_t GMM_GLOBAL_GFX_ADDRESS, GMM_GLOBAL_GFX_SIZE_T;
#define GMM_GLOBAL_GFX_ADDRESS_MAX ((GMM_GLOBAL_GFX_ADDRESS) 0xffffffff)
#ifdef _DEBUG
#define GMM_GFX_ADDRESS_CAST(x) \
( \
((x) <= GMM_GFX_ADDRESS_MAX) ? \
1 : __debugbreak(), \
(GMM_GFX_ADDRESS)(x) \
)
#define GMM_GFX_SIZE_T_CAST GMM_GFX_ADDRESS_CAST
#define GMM_GLOBAL_GFX_ADDRESS_CAST(x) \
( \
((x) <= GMM_GLOBAL_GFX_ADDRESS_MAX) ? \
1 : __debugbreak(), \
(GMM_GLOBAL_GFX_ADDRESS)(x) \
)
#define GMM_GLOBAL_GFX_SIZE_T_CAST GMM_GLOBAL_GFX_ADDRESS_CAST
#else
#define GMM_GFX_ADDRESS_CAST(x) ((GMM_GFX_ADDRESS)(x))
#define GMM_GFX_SIZE_T_CAST(x) ((GMM_GFX_SIZE_T)(x))
#define GMM_GLOBAL_GFX_ADDRESS_CAST(x) ((GMM_GLOBAL_GFX_ADDRESS)(x))
#define GMM_GLOBAL_GFX_SIZE_T_CAST(x) ((GMM_GLOBAL_GFX_SIZE_T)(x))
#endif
#define GMM_GFX_ADDRESS_CANONIZE(a) (((int64_t)(a) << (64 - 48)) >> (64 - 48)) // TODO(Minor): When GMM adds platform-dependent VA size caps, change from 48.
#define GMM_GFX_ADDRESS_DECANONIZE(a) ((uint64_t)(a) & (((uint64_t) 1 << 48) - 1)) // "
#define GMM_GFX_PLATFORM_VA_SIZE(pClientContext) (((pClientContext)->GetLibContext()->GetSkuTable().Ftr57bGPUAddressing) ? 57 : 48)
#define VASize(pCC) GMM_GFX_PLATFORM_VA_SIZE(pCC)
#define GMM_BIT_RANGE(endbit, startbit) ((endbit) - (startbit) + 1)
#define GMM_BIT(bit) (1)
#define GMM_GET_PTE_BITS_FROM_PAT_IDX(idx) ((((idx)&__BIT(4)) ? __BIT64(61) : 0) | \
(((idx)&__BIT(3)) ? __BIT64(62) : 0) | \
(((idx)&__BIT(2)) ? __BIT64(7) : 0) | \
(((idx)&__BIT(1)) ? __BIT64(4) : 0) | \
(((idx)&__BIT(0)) ? __BIT64(3) : 0) )
#define GMM_GET_PAT_IDX_FROM_PTE_BITS(Entry) ((((Entry) & __BIT64(61)) ? __BIT(4) : 0) | \
(((Entry) & __BIT64(62)) ? __BIT(3) : 0) | \
(((Entry) & __BIT64(7)) ? __BIT(2) : 0) | \
(((Entry) & __BIT64(4)) ? __BIT(1) : 0) | \
(((Entry) & __BIT64(3)) ? __BIT(0) : 0) )
#define GMM_GET_PAT_IDX_FROM_PTE_BITS_GGTT(Entry) ((((Entry) & __BIT64(53)) ? __BIT(1) : 0) | \
(((Entry) & __BIT64(52)) ? __BIT(0) : 0) )
#define GMM_GET_PTE_BITS_FROM_PAT_IDX(idx) ((((idx)&__BIT(4)) ? __BIT64(61) : 0) | \
(((idx)&__BIT(3)) ? __BIT64(62) : 0) | \
(((idx)&__BIT(2)) ? __BIT64(7) : 0) | \
(((idx)&__BIT(1)) ? __BIT64(4) : 0) | \
(((idx)&__BIT(0)) ? __BIT64(3) : 0) )
#define GMM_GET_PTE_BITS_FROM_PAT_IDX_LEAF_PD(idx) ((((idx)&__BIT(4)) ? __BIT64(61) : 0) | \
(((idx)&__BIT(3)) ? __BIT64(62) : 0) | \
(((idx)&__BIT(2)) ? __BIT64(12) : 0) | \
(((idx)&__BIT(1)) ? __BIT64(4) : 0) | \
(((idx)&__BIT(0)) ? __BIT64(3) : 0) )
#define GMM_GET_PTE_BITS_FROM_PAT_IDX_GGTT(idx) ((((idx)&__BIT(1)) ? __BIT64(53) : 0) | \
(((idx)&__BIT(0)) ? __BIT64(52) : 0) )
//===========================================================================
// typedef:
// GMM_STATUS_ENUM
//
// Description:
// Decribes GMM lib function return values
//----------------------------------------------------------------------------
typedef enum GMM_STATUS_ENUM
{
GMM_SUCCESS,
GMM_ERROR,
GMM_INVALIDPARAM,
GMM_OUT_OF_MEMORY,
} GMM_STATUS;
//===========================================================================
// typedef:
// GMM_CLIENT
//
// Description:
// Decribes who is linking GMM lib. Allow Kernel mode driver to detect
// origin of resource allocations.
//----------------------------------------------------------------------------
typedef enum GMM_CLIENT_ENUM
{
GMM_KMD_VISTA = 0,
GMM_OGL_VISTA = 1,
GMM_D3D9_VISTA = 2,
GMM_D3D10_VISTA = 3,
GMM_XP = 4,
GMM_D3D12_VISTA = 5,
GMM_OCL_VISTA = 6,
GMM_VK_VISTA = 7,
GMM_EXCITE_VISTA = 8,
GMM_UNDEFINED_CLIENT = 9,
}GMM_CLIENT;
// Macros related to GMM_CLIENT Enum
#define USE_KMT_API(ClientType) ((ClientType == GMM_OGL_VISTA) || (ClientType == GMM_OCL_VISTA) || (ClientType == GMM_VK_VISTA) || (ClientType == GMM_EXCITE_VISTA))
#define USE_DX12_API(ClientType) (ClientType == GMM_D3D12_VISTA)
#define USE_DX10_API(ClientType) (ClientType == GMM_D3D10_VISTA)
#define USE_DX_API(ClientType) ((ClientType == GMM_D3D12_VISTA) || (ClientType == GMM_D3D10_VISTA) || (ClientType == GMM_D3D9_VISTA))
#define GET_GMM_CLIENT_TYPE(pContext, ClientType) \
if(pContext) \
{ \
ClientType = ((GmmClientContext*)pContext)->GetClientType(); \
} \
else \
{ \
ClientType = GMM_UNDEFINED_CLIENT; \
} \
#define GET_RES_CLIENT_TYPE(pResourceInfo, ClientType) \
if(pResourceInfo) \
{ \
ClientType = (pResourceInfo)->GetClientType(); \
} \
else \
{ \
ClientType = GMM_UNDEFINED_CLIENT; \
} \
//===========================================================================
// typedef:
// GMM_TEXTURE_LAYOUT
//
// Description:
// This enum details HW tile walk (i.e. X or Y walk)
//---------------------------------------------------------------------------
typedef enum GMM_TEXTURE_LAYOUT_REC
{
GMM_2D_LAYOUT_BELOW = 0, // <- This should stay zero to be the default for all surfaces (including 3D, etc), since texture layout can be queried for 3D/etc surfaces. TODO: Is that querying proper behavior?!
GMM_2D_LAYOUT_RIGHT = 1,
}GMM_TEXTURE_LAYOUT;
//===========================================================================
// typedef:
// GMM_TILE_TYPE_ENUM
//
// Description:
// This enum details tile walk (i.e. X or Y walk, or not tiled)
//---------------------------------------------------------------------------
typedef enum GMM_TILE_TYPE_ENUM
{
GMM_TILED_X,
GMM_TILED_Y,
GMM_TILED_W,
GMM_NOT_TILED,
GMM_TILED_4,
GMM_TILED_64
}GMM_TILE_TYPE;
//===========================================================================
// typedef:
// GMM_E2E_COMPRESSION_TYPE_ENUM
//
// Description:
// This enum details compression type (i.e. render or media compressed, or uncompressed )
//---------------------------------------------------------------------------
typedef enum GMM_E2E_COMPRESSION_TYPE_ENUM
{
GMM_UNCOMPRESSED,
GMM_RENDER_COMPRESSED,
GMM_MEDIA_COMPRESSED
}GMM_E2E_COMPRESSION_TYPE;
//===========================================================================
// typedef:
// GMM_CPU_CACHE_TYPE_ENUM
//
// Description:
// This enum details the type of cacheable attributes for the memory
//---------------------------------------------------------------------------
typedef enum GMM_CPU_CACHE_TYPE_ENUM
{
GMM_NOTCACHEABLE,
GMM_CACHEABLE
}GMM_CPU_CACHE_TYPE;
//===========================================================================
// typedef:
// GMM_GPU_CACHE_SETTINGS
//
// Description:
// This struct details the type of cacheable attributes for the memory
//---------------------------------------------------------------------------
typedef struct GMM_GPU_CACHE_SETTINGS_REC
{
uint32_t ELLC : 1; // Gen7.5+
uint32_t Age : 2; // Gen7.5+
uint32_t WriteThrough : 1; // Gen7.5+
uint32_t GFDT : 1; // Gen6,7 (Graphics Flush Data Type)
uint32_t L3 : 1; // Gen7+
uint32_t LLC : 1; // Gen6+
uint32_t UsePteSettings : 1; // Gen6+
}GMM_GPU_CACHE_SETTINGS;
//===========================================================================
// typedef:
// GMM_CACHE_SIZE
//
// Description:
// This struct details the size of the L3 and EDram caches
//---------------------------------------------------------------------------
typedef struct GMM_CACHE_SIZES_REC
{
GMM_GFX_SIZE_T TotalL3Cache; // L3 Cache Size in Bytes
GMM_GFX_SIZE_T TotalLLCCache; // LLC Cache Size in Bytes
GMM_GFX_SIZE_T TotalEDRAM; // eDRAM Size in Bytes
} GMM_CACHE_SIZES;
//------------------------------------------------------------------------
// GMM Legacy Flags
//------------------------------------------------------------------------
// GMM_TILE_W & GMM_TILE_X & GMM_TILE_Y are for internal use. Clients should use GMM_TILE_TYPE_ENUM
#define GMM_TILE_W (__BIT(1)) // Tile W type
#define GMM_TILE_X (__BIT(2)) // Tile X type
#define GMM_TILE_Y (__BIT(3)) // Tile Y type
#if !defined(GHAL3D_ULT)
#define GMM_LINEAR (__BIT(4)) // Linear type
#define GMM_TILED (GMM_TILE_W | GMM_TILE_X | GMM_TILE_Y) // Tiled bit
#endif
#define GMM_HEAP_EXTERNAL_SYNC (__BIT(7)) // Indicates GMM_HEAP should not use its internal sync protection.
#define GMM_UTILIZEFENCE (__BIT(8))
#define GMM_NOT_OS_ADDR 0xA1B3C5D7
//===========================================================================
// typedef:
// GMM_TILE_INFO
//
// Description:
// This structure represents a tile type
//--------------------------------------------------------------------------
typedef struct GMM_TILE_INFO_REC
{
uint32_t LogicalTileWidth; // width of tile in bytes
uint32_t LogicalTileHeight; // Height of tile in rows [texels]
uint32_t LogicalTileDepth; // Depth of tile
uint32_t LogicalSize; // Size of the tile in bytes
uint32_t MaxPitch; // Maximum pitch in bytes
uint32_t MaxMipTailStartWidth; // Max mip tail start width in pixels
uint32_t MaxMipTailStartHeight; // Max mip tail start height in rows
uint32_t MaxMipTailStartDepth; // Max mip tail start depth in slices
} GMM_TILE_INFO;
//===========================================================================
// typedef:
// GMM_CUBE_FACE_REC
//
// Description:
// ENUM detailing cube map faces
//---------------------------------------------------------------------------
typedef enum GMM_CUBE_FACE_ENUM
{
__GMM_CUBE_FACE_POS_X,
__GMM_CUBE_FACE_NEG_X,
__GMM_CUBE_FACE_POS_Y,
__GMM_CUBE_FACE_NEG_Y,
__GMM_CUBE_FACE_POS_Z,
__GMM_CUBE_FACE_NEG_Z,
__GMM_MAX_CUBE_FACE,
__GMM_NO_CUBE_MAP,
} GMM_CUBE_FACE_ENUM;
//===========================================================================
// typedef:
// GMM_YUV_PLANE_REC
//
// Description:
//
//--------------------------------------------------------------------------
typedef enum GMM_YUV_PLANE_ENUM
{
GMM_NO_PLANE = 0,
GMM_PLANE_Y = 1,
GMM_PLANE_U = 2,
GMM_PLANE_V = 3,
GMM_MAX_PLANE = 4,
// GmmLib internal use only
GMM_PLANE_3D_Y0 = 0,
GMM_PLANE_3D_Y1 = 1,
GMM_PLANE_3D_UV0 = 2,
GMM_PLANE_3D_UV1 = 3
// No internal use >= GMM_MAX_PLANE!
}GMM_YUV_PLANE;
// GMM_RESOURCE_FORMAT
//
// Description:
// Enumeration of GMM supported resource formats.
//---------------------------------------------------------------------------
typedef enum GMM_RESOURCE_FORMAT_ENUM
{
GMM_FORMAT_INVALID = 0, // <-- This stays zero! (For boolean and valid range checks.)
#define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, SSCompressionFmt, Availability) \
GMM_FORMAT_##Name, \
GMM_FORMAT_##Name##_TYPE = GMM_FORMAT_##Name, // TODO(Minor): Remove _TYPE suffix from every GMM_FORMAT_ reference throughout driver and delete this aliasing. (And remove the \ from the line above.)
#include "GmmFormatTable.h"
GMM_RESOURCE_FORMATS
} GMM_RESOURCE_FORMAT;
C_ASSERT(GMM_FORMAT_INVALID == 0); // GMM_FORMAT_INVALID needs to stay zero--How did it end-up not...?
// Legacy GMM Aliases...
#define GMM_FORMAT_UYVY GMM_FORMAT_YCRCB_SWAPY
#define GMM_FORMAT_VYUY GMM_FORMAT_YCRCB_SWAPUVY
#define GMM_FORMAT_YUY2 GMM_FORMAT_YCRCB_NORMAL
#define GMM_FORMAT_YVYU GMM_FORMAT_YCRCB_SWAPUV
#define GMM_UNIFIED_CMF_INVALID 0xD
//===========================================================================
// typedef:
// GMM_SURFACESTATE_FORMAT
//
// Description:
// Enumeration of RCS SURFACE_STATE.Formats.
//---------------------------------------------------------------------------
typedef enum GMM_SURFACESTATE_FORMAT_ENUM
{
GMM_SURFACESTATE_FORMAT_INVALID = -1, // Can't use zero since that's an actual enum value.
#define GMM_FORMAT_INCLUDE_SURFACESTATE_FORMATS_ONLY
#define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, SSCompressionFmt, Availability) \
GMM_SURFACESTATE_FORMAT_##Name = RcsSurfaceFormat,
#include "GmmFormatTable.h"
} GMM_SURFACESTATE_FORMAT;
typedef enum GMM_E2ECOMP_FORMAT_ENUM
{
GMM_E2ECOMP_FORMAT_INVALID = 0,
GMM_E2ECOMP_FORMAT_ML8 = GMM_E2ECOMP_FORMAT_INVALID,
GMM_E2ECOMP_FORMAT_RGB64, //1h - Reserved
GMM_E2ECOMP_FORMAT_RGB32, //2h - Reserved
GMM_E2ECOMP_MIN_FORMAT = GMM_E2ECOMP_FORMAT_RGB32,
GMM_E2ECOMP_FORMAT_YUY2, //3h
GMM_E2ECOMP_FORMAT_Y410, //4h
GMM_E2ECOMP_FORMAT_Y210, //5h
GMM_E2ECOMP_FORMAT_Y216 = GMM_E2ECOMP_FORMAT_Y210,
GMM_E2ECOMP_FORMAT_Y416, //6h
GMM_E2ECOMP_FORMAT_P010, //7h
GMM_E2ECOMP_FORMAT_P010_L = GMM_E2ECOMP_FORMAT_P010,
GMM_E2ECOMP_FORMAT_P010_C = GMM_E2ECOMP_FORMAT_P010,
GMM_E2ECOMP_FORMAT_P016, //8h
GMM_E2ECOMP_FORMAT_P016_L = GMM_E2ECOMP_FORMAT_P016,
GMM_E2ECOMP_FORMAT_P016_C = GMM_E2ECOMP_FORMAT_P016,
GMM_E2ECOMP_FORMAT_AYUV, //9h
GMM_E2ECOMP_FORMAT_ARGB8b, //Ah
GMM_E2ECOMP_FORMAT_RGB5A1 = GMM_E2ECOMP_FORMAT_ARGB8b,
GMM_E2ECOMP_FORMAT_RGBA4 = GMM_E2ECOMP_FORMAT_ARGB8b,
GMM_E2ECOMP_FORMAT_B5G6R5 = GMM_E2ECOMP_FORMAT_ARGB8b,
GMM_E2ECOMP_FORMAT_SWAPY, //Bh
GMM_E2ECOMP_FORMAT_SWAPUV, //Ch
GMM_E2ECOMP_FORMAT_SWAPUVY, //Dh
GMM_E2ECOMP_FORMAT_YCRCB_SWAPUV = GMM_E2ECOMP_FORMAT_SWAPY,
GMM_E2ECOMP_FORMAT_YCRCB_SWAPUVY = GMM_E2ECOMP_FORMAT_SWAPUV,
GMM_E2ECOMP_FORMAT_YCRCB_SWAPY = GMM_E2ECOMP_FORMAT_SWAPUVY,
GMM_E2ECOMP_FORMAT_RGB10b, //Eh --Which media format is it?
GMM_E2ECOMP_FORMAT_NV12, //Fh
GMM_E2ECOMP_FORMAT_NV12_L = GMM_E2ECOMP_FORMAT_NV12,
GMM_E2ECOMP_FORMAT_NV12_C = GMM_E2ECOMP_FORMAT_NV12,
GMM_E2ECOMP_FORMAT_RGBAFLOAT16, //0x10h
GMM_E2ECOMP_FORMAT_R32G32B32A32_FLOAT, //0x11h
GMM_E2ECOMP_FORMAT_R32G32B32A32_SINT, //0x12h
GMM_E2ECOMP_FORMAT_R32G32B32A32_UINT, //0x13h
GMM_E2ECOMP_FORMAT_R16G16B16A16_UNORM, //0x14h
GMM_E2ECOMP_FORMAT_R16G16B16A16_SNORM, //0x15h
GMM_E2ECOMP_FORMAT_R16G16B16A16_SINT, //0x16h
GMM_E2ECOMP_FORMAT_R16G16B16A16_UINT, //0x17h
GMM_E2ECOMP_FORMAT_R10G10B10A2_UNORM, //0x18h
GMM_E2ECOMP_FORMAT_RGB10A2 = GMM_E2ECOMP_FORMAT_R10G10B10A2_UNORM,
GMM_E2ECOMP_FORMAT_R10G10B10FLOAT_A2_UNORM, //0x19h
GMM_E2ECOMP_FORMAT_R10G10B10A2_UINT, //0x1Ah
GMM_E2ECOMP_FORMAT_R8G8B8A8_SNORM, //0x1Bh
GMM_E2ECOMP_FORMAT_R8G8B8A8_SINT, //0x1Ch
GMM_E2ECOMP_FORMAT_R8G8B8A8_UINT, //0x1Dh
GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT, //0x1Eh
GMM_E2ECOMP_FORMAT_RG11B10 = GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT,
GMM_E2ECOMP_MAX_FORMAT = GMM_E2ECOMP_FORMAT_R11G11B10_FLOAT, //should always be equal to last format encoding
GMM_E2ECOMP_FORMAT_RGBA = GMM_E2ECOMP_FORMAT_INVALID,
GMM_E2ECOMP_FORMAT_R = GMM_E2ECOMP_FORMAT_INVALID,
GMM_E2ECOMP_FORMAT_RG = GMM_E2ECOMP_FORMAT_INVALID,
GMM_E2ECOMP_FORMAT_D = GMM_E2ECOMP_FORMAT_INVALID,
} GMM_E2ECOMP_FORMAT;
//===========================================================================
// typedef:
// GMM_TILE_WALK
//
// Description:
// This enum details HW tile walk (i.e. X or Y walk), used to program the
// hardware.
//---------------------------------------------------------------------------
typedef enum GMM_TILE_WALK_REC
{
GMM_HW_TILED_X_WALK = 0,
GMM_HW_TILED_Y_WALK = 1,
GMM_HW_TILED_W_WALK = 2,
GMM_HW_TILED_YF_WALK = 3,
GMM_HW_TILED_YS_WALK = 4,
GMM_HW_TILED_4_WALK = 5,
GMM_HW_TILED_64_WALK = 6,
GMM_HW_NOT_TILED = 7
} GMM_TILE_WALK;
//===========================================================================
// typedef:
// GMM_DISPLAY_FRAME_ENUM
//
// Description:
// This enum details the type of display frame (for S3D resources).
//---------------------------------------------------------------------------
typedef enum GMM_DISPLAY_FRAME_ENUM
{
GMM_DISPLAY_BASE = 0, // Legacy non-S3D display resource
GMM_DISPLAY_L = GMM_DISPLAY_BASE,
GMM_DISPLAY_R = 1,
GMM_DISPLAY_BLANK_AREA = 2,
GMM_DISPLAY_FRAME_MAX
} GMM_DISPLAY_FRAME;
//===========================================================================
// typedef:
// GMM_REQ_OFFSET_INFO
//
// Description:
// This structure is used to request offset information to a surface mip
// level or video plane.
//---------------------------------------------------------------------------
typedef struct GMM_REQ_OFFSET_INFO_REC
{
uint32_t ReqRender :1;
uint32_t ReqLock :1;
uint32_t ReqStdLayout :1;
uint32_t Reserved :29;
uint32_t ArrayIndex;
uint32_t MipLevel;
uint32_t Slice;
GMM_CUBE_FACE_ENUM CubeFace;
GMM_YUV_PLANE Plane;
GMM_DISPLAY_FRAME Frame;
struct
{
union
{
uint32_t Offset;
GMM_GFX_SIZE_T Offset64;
};
uint32_t Pitch;
union
{
uint32_t Mip0SlicePitch;
uint32_t Gen9PlusSlicePitch;
};
} Lock;
struct
{
union
{
uint32_t Offset;
GMM_GFX_SIZE_T Offset64;
};
uint32_t XOffset;
uint32_t YOffset;
uint32_t ZOffset;
} Render;
struct
{
GMM_GFX_SIZE_T Offset;
GMM_GFX_SIZE_T TileRowPitch;
GMM_GFX_SIZE_T TileDepthPitch;
} StdLayout;
}GMM_REQ_OFFSET_INFO;
//===========================================================================
// typedef:
// GMM_HW_COMMAND_STREAMER
//
// Description: Enumeration to allow callers to specify a command streamer.
//
//---------------------------------------------------------------------------
typedef enum GMM_HW_COMMAND_STREAMER_ENUM
{
GMM_HW_COMMAND_STREAMER_NULL = 0, // <-- This stays zero.
GMM_CS, // Render Command Streamer
GMM_BCS, // Blitter (BLT) Command Streamer
GMM_VCS, // Video Codec (MFX) Command Streamer
GMM_VECS, // Video Enhancement (VEBOX) Command Streamer
GMM_VCS2, // Video Codec (MFX) Command Streamer 2
GMM_COMPUTE, // Compute Only Command Streamer
GMM_PICS, // Pinning Command Streamer
GMM_CAPTURE, // Capture Command Streamer
GMM_HW_COMMAND_STREAMERS // <-- This stays last.
} GMM_HW_COMMAND_STREAMER;
// Reset packing alignment to project default
#pragma pack(pop)
//===========================================================================
// typedef:
// GMM_RESOURCE_TYPE
//
// Description:
// This enum describe type of resource requested
//---------------------------------------------------------------------------
typedef enum GMM_RESOURCE_TYPE_ENUM
{
RESOURCE_INVALID,
// User-mode use
RESOURCE_1D,
RESOURCE_2D,
RESOURCE_3D,
RESOURCE_CUBE,
RESOURCE_SCRATCH,
RESOURCE_BUFFER,
//Kernel-mode use only
RESOURCE_KMD_CHECK_START,
RESOURCE_PRIMARY,
RESOURCE_SHADOW,
RESOURCE_STAGING,
RESOURCE_CURSOR,
RESOURCE_FBC,
RESOURCE_PWR_CONTEXT,
RESOURCE_PERF_DATA_QUEUE,
RESOURCE_KMD_BUFFER,
RESOURCE_HW_CONTEXT,
RESOURCE_TAG_PAGE,
RESOURCE_NNDI,
RESOURCE_HARDWARE_MBM,
RESOURCE_OVERLAY_DMA,
RESOURCE_OVERLAY_INTERMEDIATE_SURFACE,
RESOURCE_GTT_TRANSFER_REGION,
RESOURCE_GLOBAL_BUFFER,
RESOURCE_GDI,
RESOURCE_NULL_CONTEXT_INDIRECT_STATE,
RESOURCE_GFX_CLIENT_BUFFER,
RESOURCE_KMD_CHECK_END,
RESOURCE_SEGMENT,
RESOURCE_IFFS_MAPTOGTT,
#if _WIN32
RESOURCE_WGBOX_ENCODE_STATE,
RESOURCE_WGBOX_ENCODE_DISPLAY,
RESOURCE_WGBOX_ENCODE_REFERENCE,
RESOURCE_WGBOX_ENCODE_TFD,
#endif
// only used for allocation of context specific SVM Present kernels buffer
RESOURCE_SVM_KERNELS_BUFFER,
GMM_MAX_HW_RESOURCE_TYPE
} GMM_RESOURCE_TYPE;
typedef struct
{
union
{
struct
{
uint64_t AilDisableXe2CompressionRequest: 1;
uint64_t reserved: 63;
};
uint64_t Value;
};
} GMM_AIL_STRUCT;

View File

@ -0,0 +1,57 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
//------------------------------------------------------------------------
// Texture Values
//------------------------------------------------------------------------
#define __GMM_MIN_TEXTURE_WIDTH 0x1
#define __GMM_EVEN_ROW 0x2
#define __GMM_LINEAR_RENDER_ALIGNMENT 0x4 // need DWORD aligned
#define __GMM_8BPP_LINEAR_RENDER_ALIGNMENT 0x8 // need QWORD aligned (HW workaround)
#define GMM_IMCx_PLANE_ROW_ALIGNMENT 16
//------------------------------------------------------------------------
// Misc
//------------------------------------------------------------------------
#define GMM_MDL_PAGE_SHIFT 12 // Size of bit-shift to convert btween MDL page NUMBER and page ADDRESS.
#define GMM_FIELD_NA 0xFFFFFFFF
#define GMM_INTERNAL_RESOURCE 0 // Used for Alloc Tag Mapping
#define GMM_MAX_NUMBER_MOCS_INDEXES (64)
#define GMM_XE_NUM_MOCS_ENTRIES (16)
#define GMM_GEN9_MAX_NUMBER_MOCS_INDEXES (62) // On SKL there are 64 MOCS indexes, but the last two are reserved by h/w.
#define GMM_XE2_NUM_MOCS_ENTRIES (16)
#define GMM_NUM_PAT_ENTRIES_LEGACY (8)
#define GMM_NUM_PAT_ENTRIES (32)
#define GMM_NUM_MEMORY_TYPES 4
#define GMM_NUM_GFX_PAT_TYPES 6
#define GMM_TILED_RESOURCE_NO_MIP_TAIL 0xF
#define GMM_TILED_RESOURCE_NO_PACKED_MIPS 0xF
#define GMM_GEN10_HDCL1_MOCS_INDEX_START (48) // CNL+ MOCS index 48-61 allows HDC L1 caching, last 2 are reserved by h/w.
#define GMM_MSAA_SAMPLES_MIN 1 //Define min and max MSAA samples
#define GMM_MSAA_SAMPLES_MAX 16
#define GMM_HIZ_CLEAR_COLOR_SIZE (8)
#define GMM_MEDIA_COMPRESSION_STATE_SIZE (64)
#define GMM_CLEAR_COLOR_FLOAT_SIZE (16)
#define GMM_MAX_LCU_SIZE 64 // Media Largest coding Unit

View File

@ -0,0 +1,176 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
// ------------------------------------------------------------------------
// This block determines where GMM gets definitions for debug assert and
// print functions. Location differs depending who is linking GMM lib.
// ------------------------------------------------------------------------
#if ( __GMM_KMD__ || GMM_OCL)
#include "../../Common/AssertTracer/AssertTracer.h"
#include "../../util/gfxDebug.h"
#else
#include "GmmCommonExt.h"
#include "GmmLog/GmmLog.h"
//===================== Debug Message Levels========================
#define GFXDBG_OFF (0x00000000)
#define GFXDBG_CRITICAL (0x00000001)
#define GFXDBG_NORMAL (0x00000002)
#define GFXDBG_VERBOSE (0x00000004)
#define GFXDBG_FUNCTION (0x80000000)
#define GFXDBG_NONCRITICAL (0x00000010)
#define GFXDBG_CRITICAL_DEBUG (0x00000020)
#define GFXDBG_VERBOSE_VERBOSITY (0x00000040)
#define GFXDBG_PROTOCAL (0x00000100)
#define GFXDBG_FUNCTION_ENTRY (0x80000000)
#define GFXDBG_FUNCTION_EXIT (0x80000000)
#define GFXDBG_FUNCTION_ENTRY_VERBOSE (0x20000000)
#define GFXDBG_FUNCTION_EXIT_VERBOSE (0x20000000)
#define VOIDRETURN
#endif
#if (__GMM_KMD__ || GMM_OCL)
#if defined (GMM_OCL)
#include "../../3d/common/iStdLib/osinlines.h"
#endif
// Enable GMM_ASSERTS and GMM_DEBUG only for Debug builds similar to what UMD clients used to do earlier
#if (_DEBUG) //(_DEBUG || _RELEASE_INTERNAL)
#define GMM_ASSERT GMMASSERT //gfxDebug.h
#define GMM_ASSERTPTR GMMASSERTPTR //gfxDebug.h
#else
#define GMMDebugMessage(...)
#define GMM_ASSERT(expr)
#define GMM_ASSERTPTR(expr, ret)
#endif
// GMM_DPF Logging is enabled for Debug and Release_Internal
#if (_DEBUG || _RELEASE_INTERNAL)
#define GMM_DPF GMMDebugMessage //gfxDebug.h
#else
#define GMM_DPF GMMDebugMessage
#endif // (_DEBUG || _RELEASE_INTERNAL)
#define __GMM_ASSERT GMM_ASSERT
#define __GMM_ASSERTPTR GMM_ASSERTPTR
#else
// Enable GMM_ASSERTS and GMM_DEBUG only for Debug builds similar to what UMD clients used to do earlier
#if (_DEBUG) //(_DEBUG || _RELEASE_INTERNAL)
#if defined(_MSC_VER)
#define GMM_DBG_BREAK __debugbreak()
#elif defined(__GNUC__)
#define GMM_DBG_BREAK __builtin_trap()
#else
#include <assert.h>
#define GMM_DBG_BREAK assert(0)
#endif
#define GMM_LIB_ASSERT(expr) \
{ \
if(!(expr) ) \
{ \
GMM_DBG_BREAK; \
} \
}
#define GMM_LIB_ASSERTPTR(expr, ret) \
{ \
GMM_LIB_ASSERT(expr); \
if( !expr ) \
{ \
return ret; \
} \
}
#else
#define GMM_LIB_ASSERT(expr)
#define GMM_LIB_ASSERTPTR(expr, ret) \
{ \
if (!expr) \
{ \
return ret; \
} \
} \
#endif // (_DEBUG) //_DEBUG || _RELEASE_INTERNAL
#if (_DEBUG || _RELEASE_INTERNAL)
#define GMMLibDebugMessage(DebugLevel, message, ...) \
{ \
if(DebugLevel == GFXDBG_CRITICAL) \
{ \
GMM_LOG_ERROR(message, ##__VA_ARGS__); \
} \
else if(DebugLevel == GFXDBG_VERBOSE) \
{ \
GMM_LOG_TRACE(message, ##__VA_ARGS__); \
} \
else if(DebugLevel == GFXDBG_OFF) \
{ \
GMM_LOG_TRACE_IF(0, message, ##__VA_ARGS__) \
} \
else \
{ \
GMM_LOG_INFO(message, ##__VA_ARGS__); \
} \
}
#else
#define GMMLibDebugMessage(...)
#endif //_DEBUG || _RELEASE_INTERNAL
#define GMM_DPF GMMLibDebugMessage
#define __GMM_ASSERT GMM_LIB_ASSERT
#define __GMM_ASSERTPTR GMM_LIB_ASSERTPTR
#endif
// ------------------------------------------------------------------------
// This block defines various debug print macros
// ------------------------------------------------------------------------
#define GMM_DPF_ENTER \
GMM_DPF(GFXDBG_FUNCTION_ENTRY, "%s-->\n", __FUNCTION__);
#define GMM_DPF_EXIT \
GMM_DPF(GFXDBG_FUNCTION_EXIT, "%s<--\n", __FUNCTION__);
#define GMM_DPF_CRITICAL(Message) \
GMM_DPF(GFXDBG_CRITICAL, "%s:%d: %s\n", __FUNCTION__, __LINE__, (Message));
#ifndef GMM_ASSERTDPF
#define GMM_ASSERTDPF(Expression, Message) \
{ \
if (!(Expression)) \
{ \
GMM_DPF_CRITICAL(Message); \
__GMM_ASSERT(0); \
} \
}
#endif

View File

@ -0,0 +1,536 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
// #pragma once <-- Don't use with this file! (Multi-inclusions, differnt uses.)
// Format Group Selection...
#if(defined(GMM_FORMAT_INCLUDE_ASTC_FORMATS_ONLY))
#define INCLUDE_ASTC_FORMATS
#elif(defined(GMM_FORMAT_INCLUDE_SURFACESTATE_FORMATS_ONLY))
#define INCLUDE_SURFACESTATE_FORMATS
#else
#define INCLUDE_ASTC_FORMATS
#define INCLUDE_MISC_FORMATS
#define INCLUDE_SURFACESTATE_FORMATS
#endif
// Table Macros (for Readability)
#define A 1
#define ALWAYS 1
#define ASTC_3D SKU(FtrAstc3D)
#define ASTC_HDR_2D SKU(FtrAstcHdr2D)
#define ASTC_LDR_2D SKU(FtrAstcLdr2D)
#define GEN GMM_FORMAT_GEN
#define NA GMM_SURFACESTATE_FORMAT_INVALID
#define R 1
#define SKU GMM_FORMAT_SKU
#define VLV2 GFX_IS_PRODUCT(Data.Platform,IGFX_VALLEYVIEW)
#define WA GMM_FORMAT_WA
#define x 0
#if(!defined(__GMM_KMD__))
#define NC GMM_COMPR_FORMAT_INVALID(pGmmLibContext)
#else
#define NC GMM_COMPR_FORMAT_INVALID
#endif
#define MC(n) n | (0x1 << 5) //GMM_FLATCCS_MIN_MC_FORMAT - 1
#define FC(ver, bpc, fmtstr, bpcstr, typestr) \
(ver == 1 || (SKU(FtrE2ECompression) && !(SKU(FtrFlatPhysCCS) || SKU(FtrUnified3DMediaCompressionFormats) || SKU(FtrXe2Compression)))) ? \
((bpc == 16) ? GMM_E2ECOMP_FORMAT_RGBAFLOAT16 : \
(bpc == 32) ? GMM_E2ECOMP_FORMAT_R32G32B32A32_FLOAT : \
(bpc == 8) ? GMM_E2ECOMP_FORMAT_ARGB8b : \
(bpc == x) ? GMM_E2ECOMP_FORMAT_##fmtstr : \
NC) : \
(ver == 2 || (SKU(FtrFlatPhysCCS) && !(SKU(FtrUnified3DMediaCompressionFormats) || SKU(FtrXe2Compression)))) ? \
(GMM_FLATCCS_FORMAT_##fmtstr##bpcstr##typestr) : \
(ver == 3 || (SKU(FtrUnified3DMediaCompressionFormats) && !SKU(FtrXe2Compression))) ? \
(GMM_UNIFIED_COMP_FORMAT_##fmtstr##bpcstr##typestr) : \
(ver == 4 || SKU(FtrXe2Compression)) ? \
(GMM_XE2_UNIFIED_COMP_FORMAT_##fmtstr##bpcstr##typestr) : \
NC
/****************************************************************************\
GMM FORMAT TABLE
(See bottom of file for more info.)
Supported (ALWAYS / *) -----------------------------------------------------------------o
SURFACE_STATE.CompressionFormat (or NC) --------------------------------------o |
RCS SURFACE_STATE.Format (or NA) --------------------------------o | |
ASTC Format (A / x) ----------------------------------------o | | |
Render Target Eligibility (R / x / *) -------------------o | | | |
Element Depth (Pixels) -------------------------------o | | | | |
Element Height (Pixels) ---------------------------o | | | | | |
Element Width (Pixels) ------------------------o | | | | | | |
Bits-per-Element -------------------------o | | | | | | | |
| | | | | | | | |
Name bpe w h d R A RCS.SS CompressFormat Available
------------------------------------------------------------------------------------------*/
#ifdef INCLUDE_SURFACESTATE_FORMATS
GMM_FORMAT( A1B5G5R5_UNORM , 16, 1, 1, 1, R, x, 0x124, FC(4, x, RGB5A1, , ), GEN(8) || VLV2 )
GMM_FORMAT( A4B4G4R4_UNORM , 16, 1, 1, 1, R, x, 0x125, FC(4, x, RGB5A1, , ), GEN(8) )
GMM_FORMAT( A4P4_UNORM_PALETTE0 , 8, 1, 1, 1, R, x, 0x148, NC , ALWAYS )
GMM_FORMAT( A4P4_UNORM_PALETTE1 , 8, 1, 1, 1, R, x, 0x14F, NC , ALWAYS )
GMM_FORMAT( A8_UNORM , 8, 1, 1, 1, R, x, 0x144, FC(4, 8, R, 8, U), GEN(7) )
GMM_FORMAT( A8P8_UNORM_PALETTE0 , 16, 1, 1, 1, R, x, 0x10F, NC , ALWAYS )
GMM_FORMAT( A8P8_UNORM_PALETTE1 , 16, 1, 1, 1, R, x, 0x110, NC , ALWAYS )
GMM_FORMAT( A8X8_UNORM_G8R8_SNORM , 32, 1, 1, 1, R, x, 0x0E7, NC , ALWAYS )
GMM_FORMAT( A16_FLOAT , 16, 1, 1, 1, R, x, 0x117, NC , GEN(7) )
GMM_FORMAT( A16_UNORM , 16, 1, 1, 1, R, x, 0x113, NC , GEN(7) )
GMM_FORMAT( A24X8_UNORM , 32, 1, 1, 1, R, x, 0x0E2, NC , GEN(7) )
GMM_FORMAT( A32_FLOAT , 32, 1, 1, 1, R, x, 0x0E5, NC , GEN(7) )
GMM_FORMAT( A32_UNORM , 32, 1, 1, 1, R, x, 0x0DE, NC , GEN(7) )
GMM_FORMAT( A32X32_FLOAT , 64, 1, 1, 1, R, x, 0x090, NC , ALWAYS )
GMM_FORMAT( B4G4R4A4_UNORM , 16, 1, 1, 1, R, x, 0x104, FC(4, x, RGBA4, , ), ALWAYS )
GMM_FORMAT( B4G4R4A4_UNORM_SRGB , 16, 1, 1, 1, R, x, 0x105, FC(4, x, RGBA4, , ), ALWAYS )
GMM_FORMAT( B5G5R5A1_UNORM , 16, 1, 1, 1, R, x, 0x102, FC(4, x, RGB5A1, , ), ALWAYS )
GMM_FORMAT( B5G5R5A1_UNORM_SRGB , 16, 1, 1, 1, R, x, 0x103, FC(4, x, RGB5A1, , ), ALWAYS )
GMM_FORMAT( B5G5R5X1_UNORM , 16, 1, 1, 1, R, x, 0x11A, FC(4, x, RGB5A1, , ), ALWAYS )
GMM_FORMAT( B5G5R5X1_UNORM_SRGB , 16, 1, 1, 1, R, x, 0x11B, FC(4, x, RGB5A1, , ), ALWAYS )
GMM_FORMAT( B5G6R5_UNORM , 16, 1, 1, 1, R, x, 0x100, FC(4, x, B5G6R5, , ), ALWAYS )
GMM_FORMAT( B5G6R5_UNORM_SRGB , 16, 1, 1, 1, R, x, 0x101, FC(4, x, B5G6R5, , ), ALWAYS )
GMM_FORMAT( B8G8R8A8_UNORM , 32, 1, 1, 1, R, x, 0x0C0, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( B8G8R8A8_UNORM_SRGB , 32, 1, 1, 1, R, x, 0x0C1, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( B8G8R8X8_UNORM , 32, 1, 1, 1, R, x, 0x0E9, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( B8G8R8X8_UNORM_SRGB , 32, 1, 1, 1, R, x, 0x0EA, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( B8X8_UNORM_G8R8_SNORM , 32, 1, 1, 1, R, x, 0x0E8, NC , ALWAYS )
GMM_FORMAT( B10G10R10A2_SINT , 32, 1, 1, 1, R, x, 0x1BB, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( B10G10R10A2_SNORM , 32, 1, 1, 1, R, x, 0x1B7, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( B10G10R10A2_SSCALED , 32, 1, 1, 1, R, x, 0x1B9, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( B10G10R10A2_UINT , 32, 1, 1, 1, R, x, 0x1BA, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( B10G10R10A2_UNORM , 32, 1, 1, 1, R, x, 0x0D1, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( B10G10R10A2_UNORM_SRGB , 32, 1, 1, 1, R, x, 0x0D2, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( B10G10R10A2_USCALED , 32, 1, 1, 1, R, x, 0x1B8, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( B10G10R10X2_UNORM , 32, 1, 1, 1, R, x, 0x0EE, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( BC1_UNORM , 64, 4, 4, 1, x, x, 0x186, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC1_UNORM_SRGB , 64, 4, 4, 1, x, x, 0x18B, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC2_UNORM , 128, 4, 4, 1, x, x, 0x187, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC2_UNORM_SRGB , 128, 4, 4, 1, x, x, 0x18C, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC3_UNORM , 128, 4, 4, 1, x, x, 0x188, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC3_UNORM_SRGB , 128, 4, 4, 1, x, x, 0x18D, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC4_SNORM , 64, 4, 4, 1, x, x, 0x199, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC4_UNORM , 64, 4, 4, 1, x, x, 0x189, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC5_SNORM , 128, 4, 4, 1, x, x, 0x19A, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC5_UNORM , 128, 4, 4, 1, x, x, 0x18A, FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( BC6H_SF16 , 128, 4, 4, 1, x, x, 0x1A1, FC(4, x, ML8, , ), GEN(7) )
GMM_FORMAT( BC6H_UF16 , 128, 4, 4, 1, x, x, 0x1A4, FC(4, x, ML8, , ), GEN(7) )
GMM_FORMAT( BC7_UNORM , 128, 4, 4, 1, x, x, 0x1A2, FC(4, x, ML8, , ), GEN(7) )
GMM_FORMAT( BC7_UNORM_SRGB , 128, 4, 4, 1, x, x, 0x1A3, FC(4, x, ML8, , ), GEN(7) )
GMM_FORMAT( DXT1_RGB , 64, 4, 4, 1, x, x, 0x191, NC , ALWAYS ) // verify for ML8
GMM_FORMAT( DXT1_RGB_SRGB , 64, 4, 4, 1, x, x, 0x180, NC , ALWAYS ) // verify for ML8
GMM_FORMAT( EAC_R11 , 64, 4, 4, 1, x, x, 0x1AB, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( EAC_RG11 , 128, 4, 4, 1, x, x, 0x1AC, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( EAC_SIGNED_R11 , 64, 4, 4, 1, x, x, 0x1AD, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( EAC_SIGNED_RG11 , 128, 4, 4, 1, x, x, 0x1AE, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC1_RGB8 , 64, 4, 4, 1, x, x, 0x1A9, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC2_EAC_RGBA8 , 128, 4, 4, 1, x, x, 0x1C2, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC2_EAC_SRGB8_A8 , 128, 4, 4, 1, x, x, 0x1C3, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC2_RGB8 , 64, 4, 4, 1, x, x, 0x1AA, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC2_RGB8_PTA , 64, 4, 4, 1, x, x, 0x1C0, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC2_SRGB8 , 64, 4, 4, 1, x, x, 0x1AF, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( ETC2_SRGB8_PTA , 64, 4, 4, 1, x, x, 0x1C1, FC(4, x, ML8, , ), GEN(8) || VLV2 )
GMM_FORMAT( FXT1 , 128, 8, 4, 1, x, x, 0x192, NC , ALWAYS )
GMM_FORMAT( I8_SINT , 8, 1, 1, 1, R, x, 0x155, NC , GEN(9) )
GMM_FORMAT( I8_UINT , 8, 1, 1, 1, R, x, 0x154, NC , GEN(9) )
GMM_FORMAT( I8_UNORM , 8, 1, 1, 1, R, x, 0x145, NC , ALWAYS )
GMM_FORMAT( I16_FLOAT , 16, 1, 1, 1, R, x, 0x115, NC , ALWAYS )
GMM_FORMAT( I16_UNORM , 16, 1, 1, 1, R, x, 0x111, NC , ALWAYS )
GMM_FORMAT( I24X8_UNORM , 32, 1, 1, 1, R, x, 0x0E0, NC , ALWAYS )
GMM_FORMAT( I32_FLOAT , 32, 1, 1, 1, R, x, 0x0E3, NC , ALWAYS )
GMM_FORMAT( I32X32_FLOAT , 64, 1, 1, 1, R, x, 0x092, NC , ALWAYS )
GMM_FORMAT( L8_SINT , 8, 1, 1, 1, R, x, 0x153, NC , GEN(9) )
GMM_FORMAT( L8_UINT , 8, 1, 1, 1, R, x, 0x152, NC , GEN(9) )
GMM_FORMAT( L8_UNORM , 8, 1, 1, 1, R, x, 0x146, NC , ALWAYS )
GMM_FORMAT( L8_UNORM_SRGB , 8, 1, 1, 1, R, x, 0x14C, NC , ALWAYS )
GMM_FORMAT( L8A8_SINT , 16, 1, 1, 1, R, x, 0x127, NC , GEN(9) )
GMM_FORMAT( L8A8_UINT , 16, 1, 1, 1, R, x, 0x126, NC , GEN(9) )
GMM_FORMAT( L8A8_UNORM , 16, 1, 1, 1, R, x, 0x114, NC , ALWAYS )
GMM_FORMAT( L8A8_UNORM_SRGB , 16, 1, 1, 1, R, x, 0x118, NC , ALWAYS )
GMM_FORMAT( L16_FLOAT , 16, 1, 1, 1, R, x, 0x116, NC , ALWAYS )
GMM_FORMAT( L16_UNORM , 16, 1, 1, 1, R, x, 0x112, NC , ALWAYS )
GMM_FORMAT( L16A16_FLOAT , 32, 1, 1, 1, R, x, 0x0F0, NC , ALWAYS )
GMM_FORMAT( L16A16_UNORM , 32, 1, 1, 1, R, x, 0x0DF, NC , ALWAYS )
GMM_FORMAT( L24X8_UNORM , 32, 1, 1, 1, R, x, 0x0E1, NC , ALWAYS )
GMM_FORMAT( L32_FLOAT , 32, 1, 1, 1, R, x, 0x0E4, NC , ALWAYS )
GMM_FORMAT( L32_UNORM , 32, 1, 1, 1, R, x, 0x0DD, NC , ALWAYS )
GMM_FORMAT( L32A32_FLOAT , 64, 1, 1, 1, R, x, 0x08A, NC , ALWAYS )
GMM_FORMAT( L32X32_FLOAT , 64, 1, 1, 1, R, x, 0x091, NC , ALWAYS )
GMM_FORMAT( MONO8 , 1, 1, 1, 1, R, x, 0x18E, NC , x ) // No current GMM support by this name.
GMM_FORMAT( P2_UNORM_PALETTE0 , 2, 1, 1, 1, R, x, 0x184, NC , x ) // No current GMM support by this name.
GMM_FORMAT( P2_UNORM_PALETTE1 , 2, 1, 1, 1, R, x, 0x185, NC , x ) // "
GMM_FORMAT( P4A4_UNORM_PALETTE0 , 8, 1, 1, 1, R, x, 0x147, NC , ALWAYS )
GMM_FORMAT( P4A4_UNORM_PALETTE1 , 8, 1, 1, 1, R, x, 0x14E, NC , ALWAYS )
GMM_FORMAT( P8_UNORM_PALETTE0 , 8, 1, 1, 1, R, x, 0x14B, NC , ALWAYS )
GMM_FORMAT( P8_UNORM_PALETTE1 , 8, 1, 1, 1, R, x, 0x14D, NC , ALWAYS )
GMM_FORMAT( P8A8_UNORM_PALETTE0 , 16, 1, 1, 1, R, x, 0x122, NC , ALWAYS )
GMM_FORMAT( P8A8_UNORM_PALETTE1 , 16, 1, 1, 1, R, x, 0x123, NC , ALWAYS )
GMM_FORMAT( PACKED_422_16 , 64, 2, 1, 1, R, x, 0x1A7, NC , GEN(12) )
GMM_FORMAT( PLANAR_420_8 , 8, 1, 1, 1, R, x, 0x1A5, NC , x ) // No current GMM support by this name.
GMM_FORMAT( PLANAR_420_16 , 16, 1, 1, 1, R, x, 0x1A6, NC , x ) // "
GMM_FORMAT( PLANAR_422_8 , 8, 1, 1, 1, R, x, 0x00F, NC , x ) // <-- TODO(Minor): Remove this HW-internal format.
GMM_FORMAT( R1_UNORM , 1, 1, 1, 1, R, x, 0x181, NC , x ) // "
GMM_FORMAT( R8_SINT , 8, 1, 1, 1, R, x, 0x142, FC(4, 8, R, 8, S1), ALWAYS )
GMM_FORMAT( R8_SNORM , 8, 1, 1, 1, R, x, 0x141, FC(4, 8, R, 8, S), ALWAYS )
GMM_FORMAT( R8_SSCALED , 8, 1, 1, 1, R, x, 0x149, FC(4, 8, R, 8, S), ALWAYS )
GMM_FORMAT( R8_UINT , 8, 1, 1, 1, R, x, 0x143, FC(4, 8, R, 8, U1), ALWAYS )
GMM_FORMAT( R8_UNORM , 8, 1, 1, 1, R, x, 0x140, FC(4, 8, R, 8, U), ALWAYS )
GMM_FORMAT( R8_USCALED , 8, 1, 1, 1, R, x, 0x14A, FC(4, 8, R, 8, U), ALWAYS )
GMM_FORMAT( R8G8_SINT , 16, 1, 1, 1, R, x, 0x108, FC(4, 8, RG, 8, S), ALWAYS )
GMM_FORMAT( R8G8_SNORM , 16, 1, 1, 1, R, x, 0x107, FC(4, 8, RG, 8, S), ALWAYS )
GMM_FORMAT( R8G8_SSCALED , 16, 1, 1, 1, R, x, 0x11C, FC(4, 8, RG, 8, S), ALWAYS )
GMM_FORMAT( R8G8_UINT , 16, 1, 1, 1, R, x, 0x109, FC(4, 8, RG, 8, U), ALWAYS )
GMM_FORMAT( R8G8_UNORM , 16, 1, 1, 1, R, x, 0x106, FC(4, 8, RG, 8, U), ALWAYS )
GMM_FORMAT( R8G8_USCALED , 16, 1, 1, 1, R, x, 0x11D, FC(4, 8, RG, 8, U), ALWAYS )
GMM_FORMAT( R8G8B8_SINT , 24, 1, 1, 1, R, x, 0x1C9, NC , GEN(8) )
GMM_FORMAT( R8G8B8_SNORM , 24, 1, 1, 1, R, x, 0x194, NC , ALWAYS )
GMM_FORMAT( R8G8B8_SSCALED , 24, 1, 1, 1, R, x, 0x195, NC , ALWAYS )
GMM_FORMAT( R8G8B8_UINT , 24, 1, 1, 1, R, x, 0x1C8, NC , GEN(8) || VLV2 )
GMM_FORMAT( R8G8B8_UNORM , 24, 1, 1, 1, R, x, 0x193, NC , ALWAYS )
GMM_FORMAT( R8G8B8_UNORM_SRGB , 24, 1, 1, 1, R, x, 0x1A8, NC , GEN(7_5) )
GMM_FORMAT( R8G8B8_USCALED , 24, 1, 1, 1, R, x, 0x196, NC , ALWAYS )
GMM_FORMAT( R8G8B8A8_SINT , 32, 1, 1, 1, R, x, 0x0CA, FC(4, 8, RGBA, 8, S), ALWAYS )
GMM_FORMAT( R8G8B8A8_SNORM , 32, 1, 1, 1, R, x, 0x0C9, FC(4, 8, RGBA, 8, S), ALWAYS )
GMM_FORMAT( R8G8B8A8_SSCALED , 32, 1, 1, 1, R, x, 0x0F4, FC(4, 8, RGBA, 8, S), ALWAYS )
GMM_FORMAT( R8G8B8A8_UINT , 32, 1, 1, 1, R, x, 0x0CB, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( R8G8B8A8_UNORM , 32, 1, 1, 1, R, x, 0x0C7, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( R8G8B8A8_UNORM_SRGB , 32, 1, 1, 1, R, x, 0x0C8, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( R8G8B8A8_USCALED , 32, 1, 1, 1, R, x, 0x0F5, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( R8G8B8X8_UNORM , 32, 1, 1, 1, R, x, 0x0EB, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( R8G8B8X8_UNORM_SRGB , 32, 1, 1, 1, R, x, 0x0EC, FC(4, 8, RGBA, 8, U), ALWAYS )
GMM_FORMAT( R9G9B9E5_SHAREDEXP , 32, 1, 1, 1, R, x, 0x0ED, NC , ALWAYS )
GMM_FORMAT( R10G10B10_FLOAT_A2_UNORM , 32, 1, 1, 1, R, x, 0x0D5, FC(4, x, RGB10A2, , ), GEN(12) )
GMM_FORMAT( R10G10B10_SNORM_A2_UNORM , 32, 1, 1, 1, R, x, 0x0C5, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( R10G10B10A2_SINT , 32, 1, 1, 1, R, x, 0x1B6, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( R10G10B10A2_SNORM , 32, 1, 1, 1, R, x, 0x1B3, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( R10G10B10A2_SSCALED , 32, 1, 1, 1, R, x, 0x1B5, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( R10G10B10A2_UINT , 32, 1, 1, 1, R, x, 0x0C4, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( R10G10B10A2_UNORM , 32, 1, 1, 1, R, x, 0x0C2, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( R10G10B10A2_UNORM_SRGB , 32, 1, 1, 1, R, x, 0x0C3, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( R10G10B10A2_USCALED , 32, 1, 1, 1, R, x, 0x1B4, FC(4, x, RGB10A2, , ), GEN(8) )
GMM_FORMAT( R10G10B10X2_USCALED , 32, 1, 1, 1, R, x, 0x0F3, FC(4, x, RGB10A2, , ), ALWAYS )
GMM_FORMAT( R11G11B10_FLOAT , 32, 1, 1, 1, R, x, 0x0D3, FC(4, x, RG11B10, , ), ALWAYS )
GMM_FORMAT( R16_FLOAT , 16, 1, 1, 1, R, x, 0x10E, FC(4, 16, R, 16, F1), ALWAYS )
GMM_FORMAT( R16_SINT , 16, 1, 1, 1, R, x, 0x10C, FC(4, 16, R, 16, S1), ALWAYS )
GMM_FORMAT( R16_SNORM , 16, 1, 1, 1, R, x, 0x10B, FC(4, 16, R, 16, S), ALWAYS )
GMM_FORMAT( R16_SSCALED , 16, 1, 1, 1, R, x, 0x11E, FC(4, 16, R, 16, S), ALWAYS )
GMM_FORMAT( R16_UINT , 16, 1, 1, 1, R, x, 0x10D, FC(4, 16, R, 16, U1), ALWAYS )
GMM_FORMAT( R16_UNORM , 16, 1, 1, 1, R, x, 0x10A, FC(4, 16, R, 16, U), ALWAYS )
GMM_FORMAT( R16_USCALED , 16, 1, 1, 1, R, x, 0x11F, FC(4, 16, R, 16, U), ALWAYS )
GMM_FORMAT( R16G16_FLOAT , 32, 1, 1, 1, R, x, 0x0D0, FC(4, 16, RG, 16, F), ALWAYS )
GMM_FORMAT( R16G16_SINT , 32, 1, 1, 1, R, x, 0x0CE, FC(4, 16, RG, 16, S), ALWAYS )
GMM_FORMAT( R16G16_SNORM , 32, 1, 1, 1, R, x, 0x0CD, FC(4, 16, RG, 16, S), ALWAYS )
GMM_FORMAT( R16G16_SSCALED , 32, 1, 1, 1, R, x, 0x0F6, FC(4, 16, RG, 16, S), ALWAYS )
GMM_FORMAT( R16G16_UINT , 32, 1, 1, 1, R, x, 0x0CF, FC(4, 16, RG, 16, U), ALWAYS )
GMM_FORMAT( R16G16_UNORM , 32, 1, 1, 1, R, x, 0x0CC, FC(4, 16, RG, 16, U), ALWAYS )
GMM_FORMAT( R16G16_USCALED , 32, 1, 1, 1, R, x, 0x0F7, FC(4, 16, RG, 16, U), ALWAYS )
GMM_FORMAT( R16G16B16_FLOAT , 48, 1, 1, 1, R, x, 0x19B, NC , ALWAYS )
GMM_FORMAT( R16G16B16_SINT , 48, 1, 1, 1, R, x, 0x1B1, NC , GEN(8) )
GMM_FORMAT( R16G16B16_SNORM , 48, 1, 1, 1, R, x, 0x19D, NC , ALWAYS )
GMM_FORMAT( R16G16B16_SSCALED , 48, 1, 1, 1, R, x, 0x19E, NC , ALWAYS )
GMM_FORMAT( R16G16B16_UINT , 48, 1, 1, 1, R, x, 0x1B0, NC , GEN(8) || VLV2 )
GMM_FORMAT( R16G16B16_UNORM , 48, 1, 1, 1, R, x, 0x19C, NC , ALWAYS )
GMM_FORMAT( R16G16B16_USCALED , 48, 1, 1, 1, R, x, 0x19F, NC , ALWAYS )
GMM_FORMAT( R16G16B16A16_FLOAT , 64, 1, 1, 1, R, x, 0x084, FC(4, 16, RGBA, 16, F), ALWAYS )
GMM_FORMAT( R16G16B16A16_SINT , 64, 1, 1, 1, R, x, 0x082, FC(4, 16, RGBA, 16, S), ALWAYS )
GMM_FORMAT( R16G16B16A16_SNORM , 64, 1, 1, 1, R, x, 0x081, FC(4, 16, RGBA, 16, S), ALWAYS )
GMM_FORMAT( R16G16B16A16_SSCALED , 64, 1, 1, 1, R, x, 0x093, FC(4, 16, RGBA, 16, S), ALWAYS )
GMM_FORMAT( R16G16B16A16_UINT , 64, 1, 1, 1, R, x, 0x083, FC(4, 16, RGBA, 16, U), ALWAYS )
GMM_FORMAT( R16G16B16A16_UNORM , 64, 1, 1, 1, R, x, 0x080, FC(4, 16, RGBA, 16, U), ALWAYS )
GMM_FORMAT( R16G16B16A16_USCALED , 64, 1, 1, 1, R, x, 0x094, FC(4, 16, RGBA, 16, U), ALWAYS )
GMM_FORMAT( R16G16B16X16_FLOAT , 64, 1, 1, 1, R, x, 0x08F, FC(4, 16, RGBA, 16, F), ALWAYS )
GMM_FORMAT( R16G16B16X16_UNORM , 64, 1, 1, 1, R, x, 0x08E, FC(4, 16, RGBA, 16, U), ALWAYS )
GMM_FORMAT( R24_UNORM_X8_TYPELESS , 32, 1, 1, 1, R, x, 0x0D9, FC(4, 32, R, 32, U1), ALWAYS )
GMM_FORMAT( R32_FLOAT , 32, 1, 1, 1, R, x, 0x0D8, FC(4, 32, R, 32, F1), ALWAYS )
GMM_FORMAT( R32_FLOAT_X8X24_TYPELESS , 64, 1, 1, 1, R, x, 0x088, FC(4, 32, R, 32, F), ALWAYS )
GMM_FORMAT( R32_SFIXED , 32, 1, 1, 1, R, x, 0x1B2, FC(4, 32, R, 32, S), GEN(8) )
GMM_FORMAT( R32_SINT , 32, 1, 1, 1, R, x, 0x0D6, FC(4, 32, R, 32, S1), ALWAYS )
GMM_FORMAT( R32_SNORM , 32, 1, 1, 1, R, x, 0x0F2, FC(4, 32, R, 32, S), ALWAYS )
GMM_FORMAT( R32_SSCALED , 32, 1, 1, 1, R, x, 0x0F8, FC(4, 32, R, 32, S), ALWAYS )
GMM_FORMAT( R32_UINT , 32, 1, 1, 1, R, x, 0x0D7, FC(4, 32, R, 32, U1), ALWAYS )
GMM_FORMAT( R32_UNORM , 32, 1, 1, 1, R, x, 0x0F1, FC(4, 32, R, 32, U), ALWAYS )
GMM_FORMAT( R32_USCALED , 32, 1, 1, 1, R, x, 0x0F9, FC(4, 32, R, 32, U), ALWAYS )
GMM_FORMAT( R32G32_FLOAT , 64, 1, 1, 1, R, x, 0x085, FC(4, 32, RG, 32, F), ALWAYS )
GMM_FORMAT( R32G32_SFIXED , 64, 1, 1, 1, R, x, 0x0A0, FC(4, 32, RG, 32, S), ALWAYS )
GMM_FORMAT( R32G32_SINT , 64, 1, 1, 1, R, x, 0x086, FC(4, 32, RG, 32, S), ALWAYS )
GMM_FORMAT( R32G32_SNORM , 64, 1, 1, 1, R, x, 0x08C, FC(4, 32, RG, 32, S), ALWAYS )
GMM_FORMAT( R32G32_SSCALED , 64, 1, 1, 1, R, x, 0x095, FC(4, 32, RG, 32, S), ALWAYS )
GMM_FORMAT( R32G32_UINT , 64, 1, 1, 1, R, x, 0x087, FC(4, 32, RG, 32, U), ALWAYS )
GMM_FORMAT( R32G32_UNORM , 64, 1, 1, 1, R, x, 0x08B, FC(4, 32, RG, 32, U), ALWAYS )
GMM_FORMAT( R32G32_USCALED , 64, 1, 1, 1, R, x, 0x096, FC(4, 32, RG, 32, U), ALWAYS )
GMM_FORMAT( R32G32B32_FLOAT , 96, 1, 1, 1, R, x, 0x040, NC , ALWAYS )
GMM_FORMAT( R32G32B32_SFIXED , 96, 1, 1, 1, R, x, 0x050, NC , ALWAYS )
GMM_FORMAT( R32G32B32_SINT , 96, 1, 1, 1, R, x, 0x041, NC , ALWAYS )
GMM_FORMAT( R32G32B32_SNORM , 96, 1, 1, 1, R, x, 0x044, NC , ALWAYS )
GMM_FORMAT( R32G32B32_SSCALED , 96, 1, 1, 1, R, x, 0x045, NC , ALWAYS )
GMM_FORMAT( R32G32B32_UINT , 96, 1, 1, 1, R, x, 0x042, NC , ALWAYS )
GMM_FORMAT( R32G32B32_UNORM , 96, 1, 1, 1, R, x, 0x043, NC , ALWAYS )
GMM_FORMAT( R32G32B32_USCALED , 96, 1, 1, 1, R, x, 0x046, NC , ALWAYS )
GMM_FORMAT( R32G32B32A32_FLOAT , 128, 1, 1, 1, R, x, 0x000, FC(4, 32, RGBA, 32, F), ALWAYS )
GMM_FORMAT( R32G32B32A32_SFIXED , 128, 1, 1, 1, R, x, 0x020, FC(4, 32, RGBA, 32, S), ALWAYS )
GMM_FORMAT( R32G32B32A32_SINT , 128, 1, 1, 1, R, x, 0x001, FC(4, 32, RGBA, 32, S), ALWAYS )
GMM_FORMAT( R32G32B32A32_SNORM , 128, 1, 1, 1, R, x, 0x004, FC(4, 32, RGBA, 32, S), ALWAYS )
GMM_FORMAT( R32G32B32A32_SSCALED , 128, 1, 1, 1, R, x, 0x007, FC(4, 32, RGBA, 32, S), ALWAYS )
GMM_FORMAT( R32G32B32A32_UINT , 128, 1, 1, 1, R, x, 0x002, FC(4, 32, RGBA, 32, U), ALWAYS )
GMM_FORMAT( R32G32B32A32_UNORM , 128, 1, 1, 1, R, x, 0x003, FC(4, 32, RGBA, 32, U), ALWAYS )
GMM_FORMAT( R32G32B32A32_USCALED , 128, 1, 1, 1, R, x, 0x008, FC(4, 32, RGBA, 32, U), ALWAYS )
GMM_FORMAT( R32G32B32X32_FLOAT , 128, 1, 1, 1, R, x, 0x006, FC(4, 32, RGBA, 32, F), ALWAYS )
GMM_FORMAT( R5G5_SNORM_B6_UNORM , 16, 1, 1, 1, R, x, 0x119, NC , ALWAYS )
GMM_FORMAT( R64_FLOAT , 64, 1, 1, 1, R, x, 0x08D, NC , ALWAYS )
GMM_FORMAT( R64_PASSTHRU , 64, 1, 1, 1, R, x, 0x0A1, NC , ALWAYS )
GMM_FORMAT( R64G64_FLOAT , 128, 1, 1, 1, R, x, 0x005, NC , ALWAYS )
GMM_FORMAT( R64G64_PASSTHRU , 128, 1, 1, 1, R, x, 0x021, NC , ALWAYS )
GMM_FORMAT( R64G64B64_FLOAT , 192, 1, 1, 1, R, x, 0x198, NC , ALWAYS )
GMM_FORMAT( R64G64B64_PASSTHRU , 192, 1, 1, 1, R, x, 0x1BD, NC , GEN(8) )
GMM_FORMAT( R64G64B64A64_FLOAT , 256, 1, 1, 1, R, x, 0x197, NC , ALWAYS )
GMM_FORMAT( R64G64B64A64_PASSTHRU , 256, 1, 1, 1, R, x, 0x1BC, NC , GEN(8) )
GMM_FORMAT( RAW , 8, 1, 1, 1, R, x, 0x1FF, NC , GEN(7) ) // "8bpp" for current GMM implementation.
GMM_FORMAT( X24_TYPELESS_G8_UINT , 32, 1, 1, 1, R, x, 0x0DA, FC(4, 32, R, 32, U1), ALWAYS )
GMM_FORMAT( X32_TYPELESS_G8X24_UINT , 64, 1, 1, 1, R, x, 0x089, FC(4, 32, RG, 32, U), ALWAYS )
GMM_FORMAT( X8B8_UNORM_G8R8_SNORM , 32, 1, 1, 1, R, x, 0x0E6, NC , ALWAYS )
GMM_FORMAT( Y8_UNORM , 8, 1, 1, 1, R, x, 0x150, FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( YCRCB_NORMAL , 16, 1, 1, 1, R, x, 0x182, FC(4, x, YUY2, , ), ALWAYS )
GMM_FORMAT( YCRCB_SWAPUV , 16, 1, 1, 1, R, x, 0x18F, FC(4, x, YCRCB_SWAPUV, ,), ALWAYS )
GMM_FORMAT( YCRCB_SWAPUVY , 16, 1, 1, 1, R, x, 0x183, FC(4, x, YCRCB_SWAPUVY,,), ALWAYS )
GMM_FORMAT( YCRCB_SWAPY , 16, 1, 1, 1, R, x, 0x190, FC(4, x, YCRCB_SWAPY, , ), ALWAYS )
#endif // INCLUDE_SURFACESTATE_FORMATS
#ifdef INCLUDE_ASTC_FORMATS
GMM_FORMAT( ASTC_FULL_2D_4x4_FLT16 , 128, 4, 4, 1, x, A, 0x140, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_5x4_FLT16 , 128, 5, 4, 1, x, A, 0x148, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_5x5_FLT16 , 128, 5, 5, 1, x, A, 0x149, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_6x5_FLT16 , 128, 6, 5, 1, x, A, 0x151, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_6x6_FLT16 , 128, 6, 6, 1, x, A, 0x152, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_8x5_FLT16 , 128, 8, 5, 1, x, A, 0x161, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_8x6_FLT16 , 128, 8, 6, 1, x, A, 0x162, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_8x8_FLT16 , 128, 8, 8, 1, x, A, 0x164, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_10x5_FLT16 , 128, 10, 5, 1, x, A, 0x171, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_10x6_FLT16 , 128, 10, 6, 1, x, A, 0x172, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_10x8_FLT16 , 128, 10, 8, 1, x, A, 0x174, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_10x10_FLT16 , 128, 10, 10, 1, x, A, 0x176, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_12x10_FLT16 , 128, 12, 10, 1, x, A, 0x17e, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_2D_12x12_FLT16 , 128, 12, 12, 1, x, A, 0x17f, NC , ASTC_HDR_2D )
GMM_FORMAT( ASTC_FULL_3D_3x3x3_FLT16 , 128, 3, 3, 3, x, A, 0x1c0, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_4x3x3_FLT16 , 128, 4, 3, 3, x, A, 0x1d0, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_4x4x3_FLT16 , 128, 4, 4, 3, x, A, 0x1d4, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_4x4x4_FLT16 , 128, 4, 4, 4, x, A, 0x1d5, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_5x4x4_FLT16 , 128, 5, 4, 4, x, A, 0x1e5, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_5x5x4_FLT16 , 128, 5, 5, 4, x, A, 0x1e9, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_5x5x5_FLT16 , 128, 5, 5, 5, x, A, 0x1ea, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_6x5x5_FLT16 , 128, 6, 5, 5, x, A, 0x1fa, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_6x6x5_FLT16 , 128, 6, 6, 5, x, A, 0x1fe, NC , ASTC_3D )
GMM_FORMAT( ASTC_FULL_3D_6x6x6_FLT16 , 128, 6, 6, 6, x, A, 0x1ff, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_2D_4x4_FLT16 , 128, 4, 4, 1, x, A, 0x040, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_4x4_U8sRGB , 128, 4, 4, 1, x, A, 0x000, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_5x4_FLT16 , 128, 5, 4, 1, x, A, 0x048, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_5x4_U8sRGB , 128, 5, 4, 1, x, A, 0x008, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_5x5_FLT16 , 128, 5, 5, 1, x, A, 0x049, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_5x5_U8sRGB , 128, 5, 5, 1, x, A, 0x009, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_6x5_FLT16 , 128, 6, 5, 1, x, A, 0x051, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_6x5_U8sRGB , 128, 6, 5, 1, x, A, 0x011, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_6x6_FLT16 , 128, 6, 6, 1, x, A, 0x052, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_6x6_U8sRGB , 128, 6, 6, 1, x, A, 0x012, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_8x5_FLT16 , 128, 8, 5, 1, x, A, 0x061, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_8x5_U8sRGB , 128, 8, 5, 1, x, A, 0x021, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_8x6_FLT16 , 128, 8, 6, 1, x, A, 0x062, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_8x6_U8sRGB , 128, 8, 6, 1, x, A, 0x022, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_8x8_FLT16 , 128, 8, 8, 1, x, A, 0x064, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_8x8_U8sRGB , 128, 8, 8, 1, x, A, 0x024, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x5_FLT16 , 128, 10, 5, 1, x, A, 0x071, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x5_U8sRGB , 128, 10, 5, 1, x, A, 0x031, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x6_FLT16 , 128, 10, 6, 1, x, A, 0x072, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x6_U8sRGB , 128, 10, 6, 1, x, A, 0x032, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x8_FLT16 , 128, 10, 8, 1, x, A, 0x074, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x8_U8sRGB , 128, 10, 8, 1, x, A, 0x034, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x10_FLT16 , 128, 10, 10, 1, x, A, 0x076, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_10x10_U8sRGB , 128, 10, 10, 1, x, A, 0x036, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_12x10_FLT16 , 128, 12, 10, 1, x, A, 0x07e, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_12x10_U8sRGB , 128, 12, 10, 1, x, A, 0x03e, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_12x12_FLT16 , 128, 12, 12, 1, x, A, 0x07f, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_2D_12x12_U8sRGB , 128, 12, 12, 1, x, A, 0x03f, NC , ASTC_LDR_2D )
GMM_FORMAT( ASTC_LDR_3D_3x3x3_U8sRGB , 128, 3, 3, 3, x, A, 0x080, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_3x3x3_FLT16 , 128, 3, 3, 3, x, A, 0x0c0, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_4x3x3_U8sRGB , 128, 4, 3, 3, x, A, 0x090, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_4x3x3_FLT16 , 128, 4, 3, 3, x, A, 0x0d0, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_4x4x3_U8sRGB , 128, 4, 4, 3, x, A, 0x094, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_4x4x3_FLT16 , 128, 4, 4, 3, x, A, 0x0d4, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_4x4x4_U8sRGB , 128, 4, 4, 4, x, A, 0x095, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_4x4x4_FLT16 , 128, 4, 4, 4, x, A, 0x0d5, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_5x4x4_U8sRGB , 128, 5, 4, 4, x, A, 0x0a5, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_5x4x4_FLT16 , 128, 5, 4, 4, x, A, 0x0e5, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_5x5x4_U8sRGB , 128, 5, 5, 4, x, A, 0x0a9, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_5x5x4_FLT16 , 128, 5, 5, 4, x, A, 0x0e9, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_5x5x5_U8sRGB , 128, 5, 5, 5, x, A, 0x0aa, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_5x5x5_FLT16 , 128, 5, 5, 5, x, A, 0x0ea, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_6x5x5_U8sRGB , 128, 6, 5, 5, x, A, 0x0ba, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_6x5x5_FLT16 , 128, 6, 5, 5, x, A, 0x0fa, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_6x6x5_U8sRGB , 128, 6, 6, 5, x, A, 0x0be, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_6x6x5_FLT16 , 128, 6, 6, 5, x, A, 0x0fe, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_6x6x6_U8sRGB , 128, 6, 6, 6, x, A, 0x0bf, NC , ASTC_3D )
GMM_FORMAT( ASTC_LDR_3D_6x6x6_FLT16 , 128, 6, 6, 6, x, A, 0x0ff, NC , ASTC_3D )
#endif // INCLUDE_ASTC_FORMATS
#ifdef INCLUDE_MISC_FORMATS
GMM_FORMAT( AUYV , 32, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( AYUV , 32, 1, 1, 1, R, x, NA , FC(4, x, AYUV, , ), ALWAYS )
GMM_FORMAT( BAYER_BGGR8 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = B
GMM_FORMAT( BAYER_BGGR16 , 16, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = B
GMM_FORMAT( BAYER_GBRG8 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = G, (1, 0) = B
GMM_FORMAT( BAYER_GBRG16 , 16, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = G, (1, 0) = B
GMM_FORMAT( BAYER_GRBG8 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = G, (1, 0) = R
GMM_FORMAT( BAYER_GRBG16 , 16, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = G, (1, 0) = R
GMM_FORMAT( BAYER_RGGB8 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = R
GMM_FORMAT( BAYER_RGGB16 , 16, 1, 1, 1, R, x, NA , NC , ALWAYS ) // (0, 0) = R
GMM_FORMAT( BC1 , 64, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // Legacy GMM name for related HW format.
GMM_FORMAT( BC2 , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // "
GMM_FORMAT( BC3 , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // "
GMM_FORMAT( BC4 , 64, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // "
GMM_FORMAT( BC5 , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // "
GMM_FORMAT( BC6 , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // "
GMM_FORMAT( BC6H , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS ) // "
GMM_FORMAT( BC7 , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), GEN(7) ) // "
GMM_FORMAT( BGRP , 8, 1, 1, 1, R, x, NA , NC , ALWAYS ) // FOURCC:BGRP
GMM_FORMAT( D16_UNORM , 16, 1, 1, 1, x, x, NA , FC(4, 16, R, 16, U), ALWAYS ) //Depth uses color format L1e.En
GMM_FORMAT( D24_UNORM_X8_UINT , 32, 1, 1, 1, x, x, NA , FC(4, 32, D, 32, U), ALWAYS )
GMM_FORMAT( D32_FLOAT , 32, 1, 1, 1, x, x, NA , FC(4, 32, R, 32, F1), ALWAYS )
GMM_FORMAT( DXT1 , 64, 4, 4, 1, x, x, NA , NC , ALWAYS ) // Legacy GMM name for related HW format.
GMM_FORMAT( DXT2_5 , 128, 4, 4, 1, x, x, NA , NC , ALWAYS ) // "
GMM_FORMAT( ETC1 , 64, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), GEN(8) || VLV2 ) // "
GMM_FORMAT( ETC2 , 64, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), GEN(8) || VLV2 ) // "
GMM_FORMAT( ETC2_EAC , 128, 4, 4, 1, x, x, NA , FC(4, x, ML8, , ), GEN(8) || VLV2 ) // "
GMM_FORMAT( GENERIC_8BIT , 8, 1, 1, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( GENERIC_16BIT , 16, 1, 1, 1, x, x, NA , FC(4, x, ML8, , ), ALWAYS )
GMM_FORMAT( GENERIC_24BIT , 24, 1, 1, 1, x, x, NA , NC , ALWAYS ) // verify ML8 for > 16 bit
GMM_FORMAT( GENERIC_32BIT , 32, 1, 1, 1, x, x, NA , NC , ALWAYS )
GMM_FORMAT( GENERIC_48BIT , 48, 1, 1, 1, x, x, NA , NC , ALWAYS )
GMM_FORMAT( GENERIC_64BIT , 64, 1, 1, 1, x, x, NA , NC , ALWAYS )
GMM_FORMAT( GENERIC_96BIT , 96, 1, 1, 1, x, x, NA , NC , ALWAYS )
GMM_FORMAT( GENERIC_128BIT , 128, 1, 1, 1, x, x, NA , NC , ALWAYS )
GMM_FORMAT( GENERIC_192BIT , 192, 1, 1, 1, x, x, NA , NC , GEN(8) )
GMM_FORMAT( GENERIC_256BIT , 256, 1, 1, 1, x, x, NA , NC , GEN(8) )
GMM_FORMAT( I420 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS ) // Same as IYUV.
GMM_FORMAT( IYUV , 8, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( IMC1 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( IMC2 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( IMC3 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( IMC4 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( L4A4 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS ) // No HW support.
GMM_FORMAT( MFX_JPEG_YUV411 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), GEN(7) )
GMM_FORMAT( MFX_JPEG_YUV411R , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), GEN(7) )
GMM_FORMAT( MFX_JPEG_YUV420 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), GEN(7) ) // Same as IMC3.
GMM_FORMAT( MFX_JPEG_YUV422H , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), GEN(7) )
GMM_FORMAT( MFX_JPEG_YUV422V , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), GEN(7) )
GMM_FORMAT( MFX_JPEG_YUV444 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), GEN(7) )
GMM_FORMAT( NV11 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( NV12 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( NV21 , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS )
GMM_FORMAT( P8 , 8, 1, 1, 1, R, x, NA, NC , ALWAYS )
GMM_FORMAT( P010 , 16, 1, 1, 1, R, x, NA , FC(4, x, P010, ,_L ), ALWAYS )
GMM_FORMAT( P012 , 16, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( P016 , 16, 1, 1, 1, R, x, NA , FC(4, x, P016, ,_L ), ALWAYS )
GMM_FORMAT( P208 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( R10G10B10_XR_BIAS_A2_UNORM , 32, 1, 1, 1, R, x, NA , FC(4, x, RGB10A2, , ), ALWAYS ) // DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
GMM_FORMAT( R24G8_TYPELESS , 32, 1, 1, 1, x, x, NA , FC(4, 32, R, 32, U), ALWAYS ) // DXGI_FORMAT_R24G8_TYPELESS (To differentiate between GENERIC_32BIT.)
GMM_FORMAT( R32G8X24_TYPELESS , 64, 1, 1, 1, x, x, NA , FC(4, 32, R, 32, U), ALWAYS ) // DXGI_FORMAT_R32G8X24_TYPELESS (To differentiate between GENERIC_64BIT.)
GMM_FORMAT( RENDER_8BIT , 8, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( RGBP , 8, 1, 1, 1, R, x, NA , FC(4, x, NV12, ,_L ), ALWAYS ) // FOURCC:RGBP
GMM_FORMAT( Y1_UNORM , 1, 1, 1, 1, x, x, NA , NC , GEN(8) )
GMM_FORMAT( Y8_UNORM_VA , 8, 1, 1, 1, x, x, NA , FC(4, x, NV12, ,_L ), GEN(8) )
GMM_FORMAT( Y16_SNORM , 16, 1, 1, 1, x, x, NA , FC(4, x, P010, ,_L ), GEN(8) )
GMM_FORMAT( Y16_UNORM , 16, 1, 1, 1, x, x, NA , FC(4, x, P010, ,_L ), GEN(8) )
#if (IGFX_GEN >= IGFX_GEN10)
GMM_FORMAT( Y32_UNORM , 32, 1, 1, 1, x, x, NA , NC , GEN(10) ) // Y32 removed from Gen9 but still referenced, only available Gen10+
#endif
GMM_FORMAT( Y210 , 64, 2, 1, 1, R, x, NA , FC(4, x, Y210, , ), GEN(11) ) // Packed 422 10/12/16 bit
GMM_FORMAT( Y212 , 64, 2, 1, 1, R, x, NA , FC(4, x, Y216, , ), GEN(11) )
GMM_FORMAT( Y410 , 32, 1, 1, 1, R, x, NA , FC(4, x, Y410, , ), GEN(11) )
GMM_FORMAT( Y412 , 64, 1, 1, 1, R, x, NA , FC(4, x, Y416, , ), GEN(11) )
GMM_FORMAT( Y216 , 64, 2, 1, 1, R, x, NA, FC(4, x, Y216, , ), ALWAYS )
GMM_FORMAT( Y416 , 64, 1, 1, 1, R, x, NA , FC(4, x, Y416, , ), ALWAYS ) // Packed 444 10/12/16 bit,
GMM_FORMAT( YV12 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS )
GMM_FORMAT( YVU9 , 8, 1, 1, 1, R, x, NA , NC , ALWAYS )
// Implement packed 4:2:2 YUV format (UYVY, VYUY, YUY2, YVYU) as compressed block format by suffixing _2x1.(i.e. 32bpe 2x1 pixel blocks instead of 16bpp 1x1 block)
// All OS components(UMDs/KMD) can switch to *_2x1 style independent of legacy implementation.
// Refer GmmCommonExt.h for legacy implemenation of UYVY, VYUY, YUY2, YVYU)
// TODO : Unify them when all OS-components switch to compressed block format
GMM_FORMAT( UYVY_2x1 , 32, 2, 1, 1, R, x, NA , FC(4, x, SWAPY, , ), ALWAYS )
GMM_FORMAT( VYUY_2x1 , 32, 2, 1, 1, R, x, NA , FC(4, x, SWAPUVY, , ), ALWAYS )
GMM_FORMAT( YUY2_2x1 , 32, 2, 1, 1, R, x, NA , FC(4, x, YUY2, , ), ALWAYS )
GMM_FORMAT( YVYU_2x1 , 32, 2, 1, 1, R, x, NA , FC(4, x, SWAPUV, , ), ALWAYS )
GMM_FORMAT( MEDIA_Y1_UNORM , 1, 1, 1, 1, x, x, NA , NC , GEN(8) )
GMM_FORMAT( MEDIA_Y8_UNORM , 8, 1, 1, 1, x, x, NA , FC(4, x, NV12, ,_L ), GEN(8) )
GMM_FORMAT( MEDIA_Y16_SNORM , 16, 1, 1, 1, x, x, NA , FC(4, x, P010, ,_L ), GEN(8) )
GMM_FORMAT( MEDIA_Y16_UNORM , 16, 1, 1, 1, x, x, NA , FC(4, x, P010, ,_L ), GEN(8) )
GMM_FORMAT( MEDIA_Y32_UNORM , 1, 1, 1, 1, x, x, NA , NC , GEN(8) ) // Y32 is BDW name for SKL Y1, and is 1bpp with 32b granularity
GMM_FORMAT( B16G16R16A16_UNORM , 64, 1, 1, 1, R, x, NA , FC(4, 16, RGBA, 16, U), ALWAYS ) // Swapped ARGB16 for media-SFC output
GMM_FORMAT( P216 , 16, 1, 1, 1, R, x, NA , NC , ALWAYS )
#if _WIN32
GMM_FORMAT( WGBOX_YUV444 , 32, 1, 1, 1, x, x, NA , NC , GEN(9) ) // For testing purposes only.
GMM_FORMAT( WGBOX_PLANAR_YUV444 , 32, 1, 1, 1, x, x, NA , NC , GEN(9) ) // For testing purposes only.
#endif
#endif // INCLUDE_MISC_FORMATS
/*****************************************************************************\
Usage:
File #include'ed into various areas of source code, to produce different
things--various enums, struct/array-initializing code, etc.
Format Names:
The GMM_RESOURCE_FORMAT and GMM_SURFACESTATE_FORMAT enums are generated from
this table.
Supported Conditionals(*) and Meaning:
GEN(X)........"Gen X or later" where X is text for IGFX_GEN[X]_CORE.
SKU(FtrXxx)..."SKU FtrXxx is set".
WA(WaXxx)....."WA WaXxx is set". Usually used with !/NOT prefix in table.
Conditionals:
Inclusions making use of columns supporting conditionals (e.g. "RT",
"Available") must wrap the inclusion with macro definitions to service the
supported conditionals in the local source--e.g....
#define GMM_FORMAT_GEN(X) (GFX_GET_CURRENT_RENDERCORE(pHwDevExt->platform) >= IGFX_GEN##X##_CORE)
#define GMM_FORMAT_SKU(FtrXxx) (GFX_IS_SKU(pHwDevExt, FtrXxx))
#define GMM_FORMAT_WA(WaXxx) (GFX_IS_WA(pHwDevExt, WaXxx))
#define GMM_FORMAT(Name, bpe, Width, Height, Depth, IsRT, IsASTC, RcsSurfaceFormat, AuxL1eFormat, Availability) ...
#include "GmmFormatTable.h"
\*****************************************************************************/
#undef A
#undef ALWAYS
#undef ASTC_3D
#undef ASTC_HDR_2D
#undef ASTC_LDR_2D
#undef GEN
#undef INCLUDE_ASTC_FORMATS
#undef INCLUDE_MISC_FORMATS
#undef INCLUDE_SURFACESTATE_FORMATS
#undef NA
#undef NC
#undef R
#undef SKU
#undef VLV2
#undef WA
#undef x
// So include-side code doesn't have to do this...
#undef GMM_FORMAT
#undef GMM_FORMAT_INCLUDE_ASTC_FORMATS_ONLY
#undef GMM_FORMAT_INCLUDE_SURFACESTATE_FORMATS_ONLY
#undef GMM_FORMAT_GEN
#undef GMM_FORMAT_SKU
#undef GMM_FORMAT_WA

View File

@ -0,0 +1,162 @@
/*==============================================================================
Copyright(c) 2019 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#include "gfxmacro.h"
////////////////////// Auxiliary Translation Table definitions//////////////////////////////////////////
//===========================================================================
// typedef:
// GMM_AUXTTL3e
//
// Description:
// Struct for Auxiliary Translation-Table L3 entry
//--------------------------------------------------------------------------
typedef union GMM_AUXTTL3e_REC
{
struct {
uint64_t Valid : 1;
uint64_t Reserved0 : 14;
uint64_t L2GfxAddr : 33;
uint64_t Reserved1 : 16;
};
uint64_t Value;
} GMM_AUXTTL3e;
C_ASSERT(sizeof(GMM_AUXTTL3e) == 8);
// Get the L2GfxAddr bit field as a full L2 graphics address
#define GMM_FULL_GFXADDR_FROM_AUX_L3e_L2GFXADDR(L2GfxAddr) ((L2GfxAddr) << 16)
// Set the L2GfxAddr bit field given a full L2 graphics address
#define GMM_TO_AUX_L3e_L2GFXADDR(L2GfxAddress) ((L2GfxAddress) >> 16)
//===========================================================================
// typedef:
// GMM_AUXTTL2e
//
// Description:
// Struct for Auxiliary Translation-Table L2 entry
//--------------------------------------------------------------------------
typedef union GMM_AUXTTL2e_REC
{
struct
{
uint64_t Valid : 1;
uint64_t Reserved0 : 10;
uint64_t Reserved2 : 2; // used for MTL and above
uint64_t L1GfxAddr : 35;
uint64_t Reserved1 : 16;
};
uint64_t Value;
} GMM_AUXTTL2e;
C_ASSERT(sizeof(GMM_AUXTTL2e) == 8);
// Get the L1GfxAddr bit field as a full L1 graphics address
#define GMM_FULL_GFXADDR_FROM_AUX_L2e_L1GFXADDR(L1GfxAddr) ((L1GfxAddr) << 16)
#define GMM_L1TABLE_ADDR_FROM_AUX_L2e_L1GFXADDR(L2e, Is1MBaligned) (Is1MBaligned ? (L2e.L1GfxAddr << 13 | L2e.Reserved2 << 11) : (L2e.L1GfxAddr << 13))
// Set the L1GfxAddr bit field given a full L1 graphics address
#define GMM_TO_AUX_L2e_L1GFXADDR(L1GfxAddress) ((L1GfxAddress) >> 16)
#define GMM_TO_AUX_L2e_L1GFXADDR_2(GfxAddr, L2e, Is1MBaligned) { \
L2e.L1GfxAddr = (GfxAddr >> 13); \
L2e.Reserved2 = Is1MBaligned ? (GfxAddr >> 11) : 0;\
}
#define GMM_GET_AUX_CCS_SIZE(Is1MBaligned) (Is1MBaligned? GMM_KBYTE(4): GMM_BYTES(256))
typedef union GMM_AUXTTL1e_REC
{
struct
{
uint64_t Valid : 1;
uint64_t Mode : 2; //Compression ratio (128B compr ie 2:1 for RC, 256B compr ie 4:n compr for MC)
uint64_t Lossy : 1; //Lossy Compression
uint64_t Reserved0 : 2;
uint64_t Reserved2 : 2; //LSbs of 64B-aligned CCS chunk/cacheline address
uint64_t Reserved4 : 4; //LSbs of 256B-aligned CCS chunk/cacheline address
uint64_t GfxAddress : 36; //4K-aligned CCS chunk address
uint64_t Reserved1 : 4;
uint64_t TileMode : 2; //Ys = 0, Y=1, Reserved=(2-3)
uint64_t Depth : 3; //Packed/Planar bit-depth for MC; Bpp for RC
uint64_t LumaChroma : 1; //Planar Y=0 or Cr=1
uint64_t Format : 6; //Format encoding shared with Vivante/Internal CC/DEC units to recognize surafce formats
};
uint64_t Value;
} GMM_AUXTTL1e;
C_ASSERT(sizeof(GMM_AUXTTL1e) == 8);
#define GMM_NO_TABLE ((GMM_GFX_ADDRESS)(-1L)) //common
#define GMM_INVALID_AUX_ENTRY ~__BIT(0)
#define GMM_AUX_L1e_SIZE (sizeof(GMM_AUXTTL1e))
#define GMM_AUX_L2e_SIZE (sizeof(GMM_AUXTTL2e))
#define GMM_AUX_L3e_SIZE (sizeof(GMM_AUXTTL3e))
#define GMM_AUX_L1_LOW_BIT (14)
#define GMM_AUX_L1_HIGH_BIT (23)
#define GMM_AUX_L2_LOW_BIT (24)
#define GMM_AUX_L2_HIGH_BIT (35)
#define GMM_AUX_L3_LOW_BIT (36)
#define GMM_AUX_L3_HIGH_BIT (47)
//For perf, AuxTable granularity changed to 64K
#define WA16K(pGmmLibContext) (pGmmLibContext->GetWaTable().WaAuxTable16KGranular)
#define WA64K(pGmmLibContext) (pGmmLibContext->GetWaTable().WaAuxTable64KGranular)
// #L1 entries, i.e. 1024; 16K-granular ie 4 consequtive pages share Aux-cacheline;
// HW only tracks the distinct entries;
// Handle WA where HW chicken bit forces 64K-granularity
#define GMM_AUX_L1_SIZE(pGmmLibContext) ((1 << (GMM_AUX_L1_HIGH_BIT - GMM_AUX_L1_LOW_BIT + 1)) / (WA16K(pGmmLibContext) ? 1 : 4)) // MTL : L1 size is 256 entries, but only first 16 entries are used in HW (0-15)
#define GMM_AUX_L1_USABLESIZE(pGmmLibContext) ((1 << (GMM_AUX_L1_HIGH_BIT - GMM_AUX_L1_LOW_BIT + 1)) / (WA16K(pGmmLibContext) ? 1 : WA64K(pGmmLibContext) ? 4 : 64)) // MTL : L1 size is 256 entries, but only first 16 entries are used in HW (0-15)
#define GMM_AUX_L1_SIZE_DWORD(pGmmLibContext) (GFX_CEIL_DIV(GMM_AUX_L1_SIZE(pGmmLibContext), 32)) // MTL : 256/32 = 8
// #L2 entries, i.e. 4096
#define GMM_AUX_L2_SIZE (1 << (GMM_AUX_L2_HIGH_BIT - GMM_AUX_L2_LOW_BIT + 1))
#define GMM_AUX_L2_SIZE_DWORD (GFX_CEIL_DIV(GMM_AUX_L2_SIZE, 32))
// #L3 entries, i.e. 4096
#define GMM_AUX_L3_SIZE (1 << (GMM_AUX_L3_HIGH_BIT - GMM_AUX_L3_LOW_BIT + 1))
#define GMM_AUX_L1_ENTRY_IDX(GfxAddress, pGmmLibContext) \
((((GfxAddress)&GFX_MASK_LARGE(GMM_AUX_L1_LOW_BIT, GMM_AUX_L1_HIGH_BIT)) >> \
(uint64_t)GMM_AUX_L1_LOW_BIT) / \
(WA16K(pGmmLibContext) ? 1 : WA64K(pGmmLibContext) ? 4 : 64)) // MTL and above: L1 size is 256 entries, but only first 16 entries are used in HW
#define GMM_AUX_L1_ENTRY_IDX_EXPORTED(GfxAddress,WA64KEx) \
((((GfxAddress) & GFX_MASK_LARGE(GMM_AUX_L1_LOW_BIT, GMM_AUX_L1_HIGH_BIT)) >> \
(uint64_t)GMM_AUX_L1_LOW_BIT) / ((WA64KEx) ? 4 : 1))
#define GMM_AUX_L1_ENTRY_IDX_EXPORTED_2(GfxAddress, WA64KEx, WA16KEx) \
((((GfxAddress)&GFX_MASK_LARGE(GMM_AUX_L1_LOW_BIT, GMM_AUX_L1_HIGH_BIT)) >> (uint64_t)GMM_AUX_L1_LOW_BIT) / (WA16KEx ? 1 : WA64KEx ? 4 : 64) )
#define GMM_AUX_L2_ENTRY_IDX(GfxAddress) \
(((GfxAddress) & GFX_MASK_LARGE(GMM_AUX_L2_LOW_BIT, GMM_AUX_L2_HIGH_BIT)) >> \
(uint64_t)GMM_AUX_L2_LOW_BIT)
#define GMM_AUX_L3_ENTRY_IDX(GfxAddress) \
(((GfxAddress) & GFX_MASK_LARGE(GMM_AUX_L3_LOW_BIT, GMM_AUX_L3_HIGH_BIT)) >> \
(uint64_t)GMM_AUX_L3_LOW_BIT)
////////////////////// Auxiliary Translation Table definitions end//////////////////////////////////////////

View File

@ -0,0 +1,761 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
// GmmConst.h needed for GMM_MAX_NUMBER_MOCS_INDEXES
#include "GmmConst.h"
#include "../../../Platform/GmmPlatforms.h"
#ifdef _WIN32
#define GMM_MUTEX_HANDLE HANDLE
#else
#include <pthread.h>
#define GMM_MUTEX_HANDLE pthread_mutex_t
#endif
// Set packing alignment
#pragma pack(push, 8)
//===========================================================================
// Forward Declaration: Defined in GmmResourceInfoExt.h
//---------------------------------------------------------------------------
struct GMM_CONTEXT_REC;
typedef struct GMM_CONTEXT_REC GMM_CONTEXT;
//===========================================================================
// typedef:
// GMM_UMD_CONTEXT
//
// Description:
// Struct defines user mode GMM context.
//----------------------------------------------------------------------------
typedef struct GMM_UMD_CONTEXT_REC
{
uint32_t TBD1;
uint32_t TBD2;
uint32_t TBD3;
} GMM_UMD_CONTEXT;
#if (!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
#include "GmmClientContext.h"
#endif
//===========================================================================
// typedef:
// GMM_GLOBAL_CONTEXT
//
// Description:
// Struct contains contexts for user mode and kernel mode. It also contains
// platform information. This struct is initialized in user mode with
// GmmInitGlobalContext().
//
//----------------------------------------------------------------------------
#ifdef __cplusplus
#include "GmmMemAllocator.hpp"
namespace GmmLib
{
class NON_PAGED_SECTION Context : public GmmMemAllocator
{
private:
#if(!defined(__GMM_KMD__) && !GMM_LIB_DLL_MA)
static int32_t RefCount;
#endif
#if GMM_LIB_DLL_MA
int32_t RefCount;
#endif //GMM_LIB_DLL_MA
GMM_CLIENT ClientType;
GMM_PLATFORM_INFO_CLASS* pPlatformInfo;
GMM_TEXTURE_CALC* pTextureCalc;
SKU_FEATURE_TABLE SkuTable;
WA_TABLE WaTable;
GT_SYSTEM_INFO GtSysInfo;
#if(defined(__GMM_KMD__))
GMM_GTT_CONTEXT GttContext;
#endif
GMM_CONTEXT *pGmmKmdContext;
GMM_UMD_CONTEXT *pGmmUmdContext;
void *pKmdHwDev;
void *pUmdAdapter;
GMM_CACHE_POLICY_ELEMENT CachePolicy[GMM_RESOURCE_USAGE_MAX];
GMM_CACHE_POLICY_TBL_ELEMENT CachePolicyTbl[GMM_MAX_NUMBER_MOCS_INDEXES];
GMM_CACHE_POLICY *pGmmCachePolicy;
#if(defined(__GMM_KMD__))
uint64_t IA32ePATTable;
GMM_PRIVATE_PAT PrivatePATTable[GMM_NUM_PAT_ENTRIES];
int32_t PrivatePATTableMemoryType[GMM_NUM_GFX_PAT_TYPES];
#endif
// Padding Percentage limit on 64KB paged resource
uint32_t AllowedPaddingFor64KbPagesPercentage;
uint64_t InternalGpuVaMax;
uint32_t AllowedPaddingFor64KBTileSurf;
#ifdef GMM_LIB_DLL
// Mutex Object used for synchronization of ProcessSingleton Context
static GMM_MUTEX_HANDLE SingletonContextSyncMutex;
#endif
GMM_PRIVATE_PAT PrivatePATTable[GMM_NUM_PAT_ENTRIES];
GMM_MUTEX_HANDLE SyncMutex; // SyncMutex to protect access of Gmm UMD Lib process Singleton Context
public :
//Constructors and destructors
Context();
~Context();
GMM_STATUS GMM_STDCALL LockSingletonContextSyncMutex();
GMM_STATUS GMM_STDCALL UnlockSingletonContextSyncMutex();
#if GMM_LIB_DLL_MA
int32_t IncrementRefCount();
int32_t DecrementRefCount();
#endif //GMM_LIB_DLL_MA
#if(!defined(__GMM_KMD__) && (!GMM_LIB_DLL_MA))
static int32_t IncrementRefCount() // Returns the current RefCount and then increment it
{
#if defined(_WIN32)
return(InterlockedIncrement((LONG *)&RefCount) - 1); //InterLockedIncrement() returns incremented value
#elif defined(__linux__)
return(__sync_fetch_and_add(&RefCount, 1));
#endif
}
static int32_t DecrementRefCount()
{
int CurrentValue = 0;
int TargetValue = 0;
do
{
CurrentValue = RefCount;
if (CurrentValue > 0)
{
TargetValue = CurrentValue - 1;
}
else
{
break;
}
#if defined(_WIN32)
} while (!(InterlockedCompareExchange((LONG *)&RefCount, TargetValue, CurrentValue) == CurrentValue));
#elif defined(__linux__)
} while (!__sync_bool_compare_and_swap(&RefCount, CurrentValue, TargetValue));
#endif
return TargetValue;
}
#endif
GMM_STATUS GMM_STDCALL InitContext(
const PLATFORM& Platform,
const SKU_FEATURE_TABLE* pSkuTable,
const WA_TABLE* pWaTable,
const GT_SYSTEM_INFO* pGtSysInfo,
GMM_CLIENT ClientType);
void GMM_STDCALL DestroyContext();
#if (!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
GMM_CLIENT_CONTEXT *pGmmGlobalClientContext;
#endif
//Inline functions
/////////////////////////////////////////////////////////////////////////
/// Returns the client type e.g. DX, OCL, OGL etc.
/// @return client type
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CLIENT GMM_STDCALL GetClientType()
{
return (ClientType);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the PlatformInfo
/// @return PlatformInfo
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PLATFORM_INFO& GMM_STDCALL GetPlatformInfo()
{
return (const_cast<GMM_PLATFORM_INFO&>(pPlatformInfo->GetData()));
}
/////////////////////////////////////////////////////////////////////////
/// Returns the cache policy element array ptr
/// @return const cache policy elment ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CACHE_POLICY_ELEMENT* GMM_STDCALL GetCachePolicyUsage()
{
return (&CachePolicy[0]);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the cache policy tlb element array ptr
/// @return const cache policy elment ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CACHE_POLICY_TBL_ELEMENT* GMM_STDCALL GetCachePolicyTlbElement()
{
return (&CachePolicyTbl[0]);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the texture calculation object ptr
/// @return TextureCalc ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_TEXTURE_CALC* GMM_STDCALL GetTextureCalc()
{
return (pTextureCalc);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the platform info class object ptr
/// @return PlatformInfo class object ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PLATFORM_INFO_CLASS* GMM_STDCALL GetPlatformInfoObj()
{
return (pPlatformInfo);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the cache policy object ptr
/// @return TextureCalc ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CACHE_POLICY* GMM_STDCALL GetCachePolicyObj()
{
return (pGmmCachePolicy);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the sku table ptr
/// @return const SkuTable ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE const SKU_FEATURE_TABLE& GMM_STDCALL GetSkuTable()
{
return (SkuTable);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the Wa table ptr
/// @return WaTable ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE const WA_TABLE& GMM_STDCALL GetWaTable()
{
return (WaTable);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the GT system info ptr
/// @return const GtSysInfo ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE const GT_SYSTEM_INFO* GMM_STDCALL GetGtSysInfoPtr()
{
return (&GtSysInfo);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the GT system info ptr
/// @return GtSysInfo ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GT_SYSTEM_INFO* GMM_STDCALL GetGtSysInfo()
{
return (&GtSysInfo);
}
/////////////////////////////////////////////////////////////////////////
/// Returns Cache policy element for a given usage type
/// @return cache policy element
////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CACHE_POLICY_ELEMENT GetCachePolicyElement(GMM_RESOURCE_USAGE_TYPE Usage)
{
return (CachePolicy[Usage]);
}
/////////////////////////////////////////////////////////////////////////
/// Get padding percentage limit for 64kb pages
/////////////////////////////////////////////////////////////////////////
uint32_t GetAllowedPaddingFor64KbPagesPercentage()
{
return (AllowedPaddingFor64KbPagesPercentage);
}
uint64_t& GetInternalGpuVaRangeLimit()
{
return InternalGpuVaMax;
}
/////////////////////////////////////////////////////////////////////////
/// Get padding limit for 64k pages
/////////////////////////////////////////////////////////////////////////
uint32_t GetAllowedPaddingFor64KBTileSurf()
{
return (AllowedPaddingFor64KBTileSurf);
}
/////////////////////////////////////////////////////////////////////////
/// Set padding limit for 64k pages
/////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetAllowedPaddingFor64KBTileSurf(uint32_t Value)
{
AllowedPaddingFor64KBTileSurf = Value;
}
#ifdef GMM_LIB_DLL
ADAPTER_BDF sBdf; // Adpater's Bus, Device and Function info for which Gmm UMD Lib process Singleton Context is created
#ifdef _WIN32
// ProcessHeapVA Singleton HeapObj
GMM_HEAP *pHeapObj;
uint32_t ProcessHeapCounter;
// ProcessVA Partition Address space
GMM_GFX_PARTITIONING ProcessVA;
uint32_t ProcessVACounter;
/////////////////////////////////////////////////////////////////////////
/// Get ProcessHeapVA Singleton HeapObj
/////////////////////////////////////////////////////////////////////////
GMM_HEAP* GetSharedHeapObject();
/////////////////////////////////////////////////////////////////////////
/// Set ProcessHeapVA Singleton HeapObj
/////////////////////////////////////////////////////////////////////////
uint32_t SetSharedHeapObject(GMM_HEAP **pProcessHeapObj);
/////////////////////////////////////////////////////////////////////////
/// Get or Sets ProcessGfxPartition VA
/////////////////////////////////////////////////////////////////////////
void GetProcessGfxPartition(GMM_GFX_PARTITIONING* pProcessVA);
/////////////////////////////////////////////////////////////////////////
/// Get or Sets ProcessGfxPartition VA
/////////////////////////////////////////////////////////////////////////
void SetProcessGfxPartition(GMM_GFX_PARTITIONING* pProcessVA);
/////////////////////////////////////////////////////////////////////////
/// Destroy Sync Mutex created for Singleton Context access
/////////////////////////////////////////////////////////////////////////
static void DestroySingletonContextSyncMutex()
{
if (SingletonContextSyncMutex)
{
::CloseHandle(SingletonContextSyncMutex);
SingletonContextSyncMutex = NULL;
}
}
#if !GMM_LIB_DLL_MA
/////////////////////////////////////////////////////////////////////////
/// Acquire Sync Mutex for Singleton Context access
/////////////////////////////////////////////////////////////////////////
static GMM_STATUS LockSingletonContextSyncMutex()
{
if (SingletonContextSyncMutex)
{
while (WAIT_OBJECT_0 != ::WaitForSingleObject(SingletonContextSyncMutex, INFINITE));
return GMM_SUCCESS;
}
else
{
return GMM_ERROR;
}
}
/////////////////////////////////////////////////////////////////////////
/// Release Sync Mutex for Singleton Context access
/////////////////////////////////////////////////////////////////////////
static GMM_STATUS UnlockSingletonContextSyncMutex()
{
if (SingletonContextSyncMutex)
{
::ReleaseMutex(SingletonContextSyncMutex);
return GMM_SUCCESS;
}
else
{
return GMM_ERROR;
}
}
#endif //!GMM_LIB_DLL_MA
#else // Non Win OS
/////////////////////////////////////////////////////////////////////////
/// Destroy Sync Mutex created for Singleton Context access
/////////////////////////////////////////////////////////////////////////
static void DestroySingletonContextSyncMutex()
{
pthread_mutex_destroy(&SingletonContextSyncMutex);
}
#if !GMM_LIB_DLL_MA
/////////////////////////////////////////////////////////////////////////
/// Acquire Sync Mutex for Singleton Context access
/////////////////////////////////////////////////////////////////////////
static GMM_STATUS LockSingletonContextSyncMutex()
{
pthread_mutex_lock(&SingletonContextSyncMutex);
return GMM_SUCCESS;
}
/////////////////////////////////////////////////////////////////////////
/// Release Sync Mutex for Singleton Context access
/////////////////////////////////////////////////////////////////////////
static GMM_STATUS UnlockSingletonContextSyncMutex()
{
pthread_mutex_unlock(&SingletonContextSyncMutex);
return GMM_SUCCESS;
}
#endif //!GMM_LIB_DLL_MA
#endif // _WIN32
#endif // GMM_LIB_DLL
// KMD specific inline functions
#ifdef __GMM_KMD__
/////////////////////////////////////////////////////////////////////////
/// Returns private PAT table memory type for a given PAT type
/// @return PAT Memory type
/////////////////////////////////////////////////////////////////////////
GMM_INLINE int32_t GMM_STDCALL GetPrivatePATTableMemoryType(GMM_GFX_PAT_TYPE PatType)
{
return (PrivatePATTableMemoryType[PatType]);
}
/////////////////////////////////////////////////////////////////////////
/// Returns private PAT table memory type array ptr
/// @return PAT Memory type array ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE int32_t* GMM_STDCALL GetPrivatePATTableMemoryType()
{
return (PrivatePATTableMemoryType);
}
/////////////////////////////////////////////////////////////////////////
/// Returns private PAT table array ptr
/// @return PAT array ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PRIVATE_PAT* GMM_STDCALL GetPrivatePATTable()
{
return (PrivatePATTable);
}
/////////////////////////////////////////////////////////////////////////
/// Returns private PAT table entry for a given PAT index
/// @return PAT entry
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PRIVATE_PAT GMM_STDCALL GetPrivatePATEntry(uint32_t PatIndex)
{
return (PrivatePATTable[PatIndex]);
}
/////////////////////////////////////////////////////////////////////////
/// Returns gmm kmd context ptr
/// @return GmmKmdContext ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CONTEXT* GetGmmKmdContext()
{
return (pGmmKmdContext);
}
/////////////////////////////////////////////////////////////////////////
/// Sets gmm kmd context ptr
/// @return GmmKmdContext ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetGmmKmdContext(GMM_CONTEXT *pGmmKmdContext)
{
this->pGmmKmdContext = pGmmKmdContext;
}
/////////////////////////////////////////////////////////////////////////
/// Returns gtt context ptr
/// @return GttContext ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_GTT_CONTEXT* GetGttContext()
{
return (&GttContext);
}
/////////////////////////////////////////////////////////////////////////
/// Returns Cache policy tbl element for a given usage type
/// @return cache policy tbl element
////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_CACHE_POLICY_TBL_ELEMENT GetCachePolicyTblElement(GMM_RESOURCE_USAGE_TYPE Usage)
{
return (CachePolicyTbl[Usage]);
}
/////////////////////////////////////////////////////////////////////////
/// Resets the sku Table after GmmInitContext() could have changed them
/// since original latching
////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetSkuTable(SKU_FEATURE_TABLE SkuTable)
{
this->SkuTable = SkuTable;
}
/////////////////////////////////////////////////////////////////////////
/// Resets the Wa Table after GmmInitContext() could have changed them
/// since original latching
////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetWaTable(WA_TABLE WaTable)
{
this->WaTable = WaTable;
}
#if(_DEBUG || _RELEASE_INTERNAL)
/////////////////////////////////////////////////////////////////////////
/// Returns the override platform info class object ptr
/// @return PlatformInfo class object ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PLATFORM_INFO_CLASS* GMM_STDCALL GetOverridePlatformInfoObj()
{
return (Override.pPlatformInfo);
}
/////////////////////////////////////////////////////////////////////////
/// Returns the override Platform info ptr to kmd
/// @return override PlatformInfo ref
////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PLATFORM_INFO& GMM_STDCALL GetOverridePlatformInfo()
{
return (const_cast<GMM_PLATFORM_INFO&>(Override.pPlatformInfo->GetData()));
}
/////////////////////////////////////////////////////////////////////////
/// Set the override platform info calc ptr
////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetOverridePlatformInfoObj(GMM_PLATFORM_INFO_CLASS *pPlatformInfoObj)
{
Override.pPlatformInfo = pPlatformInfoObj;
}
/////////////////////////////////////////////////////////////////////////
/// Returns the override Texture calc ptr to kmd
/// @return override Texture calc ptr
////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_TEXTURE_CALC* GetOverrideTextureCalc()
{
return (Override.pTextureCalc);
}
/////////////////////////////////////////////////////////////////////////
/// Set the override Texture calc ptr
////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetOverrideTextureCalc(GMM_TEXTURE_CALC *pTextureCalc)
{
Override.pTextureCalc = pTextureCalc;
}
#endif // (_DEBUG || _RELEASE_INTERNAL)
#endif // __GMM_KMD__
GMM_CACHE_POLICY* GMM_STDCALL CreateCachePolicyCommon();
GMM_TEXTURE_CALC* GMM_STDCALL CreateTextureCalc(PLATFORM Platform, bool Override);
GMM_PLATFORM_INFO_CLASS *GMM_STDCALL CreatePlatformInfo(PLATFORM Platform, bool Override);
private:
void GMM_STDCALL OverrideSkuWa();
public:
/////////////////////////////////////////////////////////////////////////
/// Returns private PAT table array ptr
/// @return PAT array ptr
/////////////////////////////////////////////////////////////////////////
GMM_INLINE GMM_PRIVATE_PAT *GMM_STDCALL GetPrivatePATTable()
{
return (&PrivatePATTable[0]);
}
private:
uint32_t UsageBasedPaddingFor64KBTileSurf;
uint8_t MultiEngineAccessCompressedWAEnable;
public:
/////////////////////////////////////////////////////////////////////////
uint32_t GetUsageBasedPaddingFor64KBTileSurf()
{
return (UsageBasedPaddingFor64KBTileSurf);
}
/////////////////////////////////////////////////////////////////////////
/// Set usage based padding percentage limit for 64KB tile
/////////////////////////////////////////////////////////////////////////
GMM_INLINE void SetUsageBasedPaddingFor64KBTileSurf(uint32_t Value)
{
UsageBasedPaddingFor64KBTileSurf = Value;
}
/////////////////////////////////////////////////////////////////////////
/// Get Multi Engine Compression WA Flag
/////////////////////////////////////////////////////////////////////////
uint8_t IsMultiEngineAccessCompressedWAEnabled()
{
if (MultiEngineAccessCompressedWAEnable || this->WaTable.Wa_22015614752)
{
return true;
}
return false;
}
};
// Max number of Multi-Adapters allowed in the system
#define MAX_NUM_ADAPTERS 9
//===========================================================================
// typedef:
// _GMM_ADAPTER_INFO_
//
// Description:
// Struct holds Adapter level information.
//----------------------------------------------------------------------------
typedef struct _GMM_ADAPTER_INFO_
{
Context *pGmmLibContext; // Gmm UMD Lib Context which is process Singleton
_GMM_ADAPTER_INFO_ *pNext; // Linked List Next pointer to point to the Next Adapter node in the List
}GMM_ADAPTER_INFO;
////////////////////////////////////////////////////////////////////////////////////
/// Multi Adpater Context to hold data related to Multiple Adapters in the system
/// Contains functions and members that are needed to support Multi-Adapter.
///////////////////////////////////////////////////////////////////////////////////
class NON_PAGED_SECTION GmmMultiAdapterContext : public GmmMemAllocator
{
private:
GMM_ADAPTER_INFO AdapterInfo[MAX_NUM_ADAPTERS];// For Static Initialization of adapter.
GMM_MUTEX_HANDLE MAContextSyncMutex; // SyncMutex to protect access of GmmMultiAdpaterContext
uint32_t NumAdapters;
void* pCpuReserveBase;
uint64_t CpuReserveSize;
GMM_ADAPTER_INFO *pHeadNode;// For dynamic Initialization of adapter.
// The Multi-Adapter Initialization is done dynamiclly using a Linked list Vector
// pHeadNode points to the root node of the linked list and registers the first
// adapter received from UMD.
// thread safe functions; these cannot be called within a LockMAContextSyncMutex block
GMM_ADAPTER_INFO * GetAdapterNode(ADAPTER_BDF sBdf); // Replacement for GetAdapterIndex, now get adapter node from the linked list
// Mutexes which protect the below thread unsafe functions
GMM_STATUS GMM_STDCALL LockMAContextSyncMutex();
GMM_STATUS GMM_STDCALL UnLockMAContextSyncMutex();
// thread unsafe functions; these must be protected with LockMAContextSyncMutex
GMM_ADAPTER_INFO * GetAdapterNodeUnlocked(ADAPTER_BDF sBdf);
GMM_ADAPTER_INFO * AddAdapterNode();
void RemoveAdapterNode(GMM_ADAPTER_INFO *pNode);
public:
//Constructors and destructors
GmmMultiAdapterContext();
~GmmMultiAdapterContext();
/* Function prototypes */
/* Functions that update MultiAdapterContext members*/
uint32_t GMM_STDCALL GetAdapterIndex(ADAPTER_BDF sBdf);
uint32_t GMM_STDCALL GetNumAdapters();
/* Functions that update AdapterInfo*/
// thread safe functions; these cannot be called within a LockMAContextSyncMutex block
#if LHDM
GMM_STATUS GMM_STDCALL AddContext(const PLATFORM Platform,
const SKU_FEATURE_TABLE *pSkuTable,
const WA_TABLE * pWaTable,
const GT_SYSTEM_INFO * pGtSysInfo,
ADAPTER_BDF sBdf,
const char * DeviceRegistryPath);
#else
GMM_STATUS GMM_STDCALL AddContext(const PLATFORM Platform,
const void * pSkuTable,
const void * pWaTable,
const void * pGtSysInfo,
ADAPTER_BDF sBdf,
const GMM_CLIENT ClientType);
#endif
GMM_STATUS GMM_STDCALL RemoveContext(ADAPTER_BDF sBdf);
Context* GMM_STDCALL GetAdapterLibContext(ADAPTER_BDF sBdf);
}; // GmmMultiAdapterContext
} //namespace
typedef GmmLib::Context GMM_GLOBAL_CONTEXT, GMM_LIB_CONTEXT;
typedef GmmLib::GmmMultiAdapterContext GMM_MA_LIB_CONTEXT;
#else
struct GmmLibContext;
typedef struct GmmLibContext GMM_GLOBAL_CONTEXT, GMM_LIB_CONTEXT;
#endif
#ifdef __GMM_KMD__
void GMM_STDCALL GmmLinkKmdContextToGlobalInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_CONTEXT *pGmmKmdContext);
#endif /*__GMM_KMD__*/
//Declare all GMM global context C interfaces.
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
const GMM_PLATFORM_INFO* GMM_STDCALL GmmGetPlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);
const GMM_CACHE_POLICY_ELEMENT* GmmGetCachePolicyUsage(GMM_GLOBAL_CONTEXT *pGmmLibContext);
GMM_TEXTURE_CALC* GmmGetTextureCalc(GMM_GLOBAL_CONTEXT *pGmmLibContext);
const SKU_FEATURE_TABLE* GmmGetSkuTable(GMM_GLOBAL_CONTEXT *pGmmLibContext);
const WA_TABLE* GmmGetWaTable(GMM_GLOBAL_CONTEXT *pGmmLibContext);
const GT_SYSTEM_INFO* GmmGetGtSysInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);
#ifdef __GMM_KMD__
int32_t GmmGetPrivatePATTableMemoryType(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_GFX_PAT_TYPE PatType);
GMM_CONTEXT* GmmGetGmmKmdContext(GMM_GLOBAL_CONTEXT *pGmmLibContext);
GMM_GTT_CONTEXT* GmmGetGttContext(GMM_GLOBAL_CONTEXT *pGmmLibContext);
GMM_CACHE_POLICY_TBL_ELEMENT GmmGetCachePolicyTblElement(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
GMM_CACHE_POLICY_ELEMENT GmmGetCachePolicyElement(GMM_GLOBAL_CONTEXT *pGmmLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
void GmmSetSkuTable(GMM_GLOBAL_CONTEXT *pGmmLibContext, SKU_FEATURE_TABLE SkuTable);
void GmmSetWaTable(GMM_GLOBAL_CONTEXT *pGmmLibContext, WA_TABLE WaTable);
GMM_PLATFORM_INFO* GmmKmdGetPlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);
#if(_DEBUG || _RELEASE_INTERNAL)
const GMM_PLATFORM_INFO* GmmGetOverridePlatformInfo(GMM_GLOBAL_CONTEXT *pGmmLibContext);
GMM_TEXTURE_CALC* GmmGetOverrideTextureCalc(GMM_GLOBAL_CONTEXT *pGmmLibContext);
#endif
#endif
GMM_PRIVATE_PAT GmmGetPrivatePATEntry(GMM_LIB_CONTEXT *pGmmLibContext, uint32_t PatIndex);
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#define GMM_OVERRIDE_PLATFORM_INFO(pTexInfo,pGmmLibContext) (GmmGetPlatformInfo(pGmmLibContext))
#define GMM_OVERRIDE_TEXTURE_CALC(pTexInfo,pGmmLibContext) (GmmGetTextureCalc(pGmmLibContext))
#ifdef __GMM_KMD__
#define GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(pTexInfo) GMM_OVERRIDE_PLATFORM_INFO(pTexInfo)
#define GMM_IS_PLANAR(Format) GmmIsPlanar(Format)
#else
#define GMM_OVERRIDE_EXPORTED_PLATFORM_INFO(pTexInfo,pGmmLibContext) (&((GmmClientContext*)pClientContext)->GetPlatformInfo())
#define GMM_IS_PLANAR(Format) (pClientContext->IsPlanar(Format))
#endif
#define GMM_IS_1MB_AUX_TILEALIGNEDPLANES(Platform, Surf) \
((GFX_GET_CURRENT_PRODUCT(Platform) >= IGFX_METEORLAKE) && Surf.OffsetInfo.PlaneXe_LPG.Is1MBAuxTAlignedPlanes)
// Reset packing alignment to project default
#pragma pack(pop)

View File

@ -0,0 +1,47 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#include "GmmInfo.h"
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
// Set packing alignment
#pragma pack(push, 8)
//***************************************************************************
//
// GMM_GLOBAL_CONTEXT API
//
//***************************************************************************
void GMM_STDCALL GmmGetCacheSizes(GMM_LIB_CONTEXT *pGmmLibContext, GMM_CACHE_SIZES *CacheSizes);
const GMM_PLATFORM_INFO* GMM_STDCALL GmmGetPlatformInfo(GMM_GLOBAL_CONTEXT* pGmmLibContext);
// Reset packing alignment to project default
#pragma pack(pop)
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,97 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#define __STR2__(x) #x
#define __STR1__(x) __STR2__(x)
#define __LOC__ __FILE__ "(" __STR1__(__LINE__) ") : Warning Msg: "
#define __LOC2__ __FILE__ "(" __STR1__(__LINE__) ") : "
//#pragma message(__LOC2__ "Header Message")
#ifndef _WIN32
#include <portable_compiler.h>
#endif
#if !defined(GMM_DIAG_APP_DIRECTIVE)
#include "../../../../inc/umKmInc/sharedata.h"
#include "../../../../inc/common/igfxfmid.h" // Contains platform families
#include "../../../../inc/common/gfxplatform.h" // __GFX_MACRO_C__ must be defined before
#include "../../../../inc/common/gfxmacro.h" // including gfxplatform.h. See Preprocessor settings
// has MACRO ops like POW2, MASK, etc.
#include "External/Common/GmmDebug.h" // GMM definitions for assert and printf
#else
#define DRIVER_VERSION_INFO uint32_t
#endif
//For compile time GFXGEN detection. GMM_GFX_GEN is optional cmd line definition
#if (!defined(GMM_GFX_GEN) || (GMM_GFX_GEN == 80))
#define GMM_ENABLE_GEN8 1
#else
#define GMM_ENABLE_GEN8 0
#endif
#if (!defined(GMM_GFX_GEN) || (GMM_GFX_GEN == 90))
#define GMM_ENABLE_GEN9 1
#else
#define GMM_ENABLE_GEN9 0
#endif
#if (!defined(GMM_GFX_GEN) || (GMM_GFX_GEN == 100))
#define GMM_ENABLE_GEN10 1
#else
#define GMM_ENABLE_GEN10 0
#endif
#if (!defined(GMM_GFX_GEN) || (GMM_GFX_GEN == 110))
#define GMM_ENABLE_GEN11 1
#else
#define GMM_ENABLE_GEN11 0
#endif
#if (!defined(GMM_GFX_GEN) || (GMM_GFX_GEN == 120))
#define GMM_ENABLE_GEN12 1
#else
#define GMM_ENABLE_GEN12 0
#endif
#if (IGFX_GEN >= IGFX_GEN11)
#if !(GMM_ENABLE_GEN8 || GMM_ENABLE_GEN9 || GMM_ENABLE_GEN10 || \
GMM_ENABLE_GEN11 || GMM_ENABLE_GEN12)
#error "Unrecognized GMM_GFX_GEN !"
#endif
#elif (IGFX_GEN >= IGFX_GEN10)
#if !(GMM_ENABLE_GEN8 || GMM_ENABLE_GEN9 || GMM_ENABLE_GEN10)
#error "Unrecognized GMM_GFX_GEN !"
#endif
#else
#if !(GMM_ENABLE_GEN8 || GMM_ENABLE_GEN9)
#error "Unrecognized GMM_GFX_GEN !"
#endif
#endif

View File

@ -0,0 +1,80 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#include "GmmCommonExt.h"
#include "GmmInfo.h"
typedef struct _GMM_INIT_IN_ARGS_
{
PLATFORM Platform;
void *pSkuTable;
void *pWaTable;
void *pGtSysInfo;
uint32_t FileDescriptor;
GMM_CLIENT ClientType;
} GMM_INIT_IN_ARGS;
typedef struct _GMM_INIT_OUT_ARGS_
{
GMM_CLIENT_CONTEXT *pGmmClientContext;
} GMM_INIT_OUT_ARGS;
// Interfaces exported from GMM Lib DLL
typedef struct _GmmExportEntries
{
#ifdef _WIN32
GMM_STATUS (GMM_STDCALL *pfnCreateSingletonContext)(const PLATFORM Platform,
const SKU_FEATURE_TABLE* pSkuTable,
const WA_TABLE* pWaTable,
const GT_SYSTEM_INFO* pGtSysInfo);
#else
GMM_STATUS(GMM_STDCALL *pfnCreateSingletonContext)(const PLATFORM Platform,
const void* pSkuTable,
const void* pWaTable,
const void* pGtSysInfo);
#endif
void (GMM_STDCALL *pfnDestroySingletonContext)(void);
GMM_CLIENT_CONTEXT* (GMM_STDCALL *pfnCreateClientContext)(GMM_CLIENT ClientType);
void (GMM_STDCALL *pfnDeleteClientContext)(GMM_CLIENT_CONTEXT *pGmmClientContext);
}GmmExportEntries;
#ifdef __cplusplus
extern "C" {
#endif
/////////////////////////////////////////////////////////////////////////////////////
/// Only function exported from GMM lib DLL.
/////////////////////////////////////////////////////////////////////////////////////
GMM_LIB_API GMM_STATUS GMM_STDCALL InitializeGmm(GMM_INIT_IN_ARGS *pInArgs, GMM_INIT_OUT_ARGS *pOutArgs);
GMM_LIB_API void GMM_STDCALL GmmAdapterDestroy(GMM_INIT_OUT_ARGS *pInArgs);
#ifdef __cplusplus
}
#endif
typedef GMM_STATUS (GMM_STDCALL *pfnGmmEntry)(GmmExportEntries *);
typedef GMM_STATUS (GMM_STDCALL *pfnGmmInit)(GMM_INIT_IN_ARGS *, GMM_INIT_OUT_ARGS *);
typedef void (GMM_STDCALL *pfnGmmDestroy)(GMM_INIT_OUT_ARGS *);

View File

@ -0,0 +1,46 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#if defined(_WIN64 ) || defined(__x86_64__) || defined(__LP64__)
#define GMM_ADAPTER_INIT_NAME "InitializeGmm"
#define GMM_ADAPTER_DESTROY_NAME "GmmAdapterDestroy"
#if defined(_WIN64)
#define GMM_UMD_DLL "igdgmm64.dll"
#elif defined(ANDROID)
#define GMM_UMD_DLL "libigdgmm.so"
#else
#define GMM_UMD_DLL "libigdgmm.so.12"
#endif
#else
#define GMM_ADAPTER_INIT_NAME "_InitializeGmm@8"
#define GMM_ADAPTER_DESTROY_NAME "_GmmAdapterDestroy@4"
#if defined(_WIN32)
#define GMM_UMD_DLL "igdgmm32.dll"
#elif defined(ANDROID)
#define GMM_UMD_DLL "libigdgmm.so"
#else
#define GMM_UMD_DLL "libigdgmm.so.12"
#endif
#endif

View File

@ -0,0 +1,61 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#include "GmmUtil.h"
#include <stdlib.h>
#define NON_PAGED_SECTION
#define GMM_MALLOC(size) malloc(size)
#define GMM_FREE(p) free(p)
/////////////////////////////////////////////////////////////
/// Overrides new() and delete() to work with both user mode
/// and kernel mode.
/////////////////////////////////////////////////////////////
class NON_PAGED_SECTION GmmMemAllocator
{
public:
void* operator new(size_t size)
{
return GMM_MALLOC(size);
}
void* operator new(size_t size, void* ptr)
{
GMM_UNREFERENCED_PARAMETER(size);
return ptr;
}
void operator delete(void *ptr)
{
GMM_FREE(ptr);
}
void operator delete(void *ptr, void *place)
{
GMM_UNREFERENCED_PARAMETER(ptr);
GMM_UNREFERENCED_PARAMETER(place);
// placement delete -- nothing to do.
}
};

View File

@ -0,0 +1,170 @@
/*==============================================================================
Copyright(c) 2019 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
Description: This file contains the class definitions for GmmPageTableMgr
for user-mode PageTable management, that is common for both
Linux and Windows.
============================================================================*/
#pragma once
#include "GmmHw.h"
#ifdef __linux__
#include <pthread.h>
#endif
typedef enum _GMM_ENGINE_TYPE
{
ENGINE_TYPE_RCS = 0, //RCS
ENGINE_TYPE_COMPUTE = 1, //Compute-CS
ENGINE_TYPE_BCS, //BLT
ENGINE_TYPE_VD0,
ENGINE_TYPE_VD1,
ENGINE_TYPE_VE0
//Add all engines supporting AUX-TT
} GMM_ENGINE_TYPE;
typedef enum TT_Flags
{
AUXTT = 1, //Indicate TT request for AUX i.e. e2e compression
} TT_TYPE;
#if !(defined(__GMM_KMD__))
// Shared Structure for both Windows and Linux
typedef struct __GMM_DDI_UPDATEAUXTABLE
{
GMM_UMD_SYNCCONTEXT * UmdContext; // [in] pointer to thread-specific data, specifying BBQHandle/Fence etc
GMM_RESOURCE_INFO * BaseResInfo; // [in] GmmResourceInfo ptr for compressed resource
GMM_RESOURCE_INFO * AuxResInfo; // [in] GmmResourceInfo ptr for separate Auxiliary resource
GMM_GFX_ADDRESS BaseGpuVA; // [in] GPUVA where compressed resource has been mapped
GMM_GFX_ADDRESS AuxSurfVA; // [in] GPUVA where separate Auxiliary resource has been mapped
uint8_t Map; // [in] specifies if resource is being mapped or unmapped
uint8_t DoNotWait; // [in] specifies if PageTable update be done on CPU (true) or GPU (false)
}GMM_DDI_UPDATEAUXTABLE;
#ifdef __cplusplus
#include "GmmMemAllocator.hpp"
namespace GmmLib
{
class SyncInfoLin { //dummy class
public:
HANDLE BBQueueHandle;
uint64_t BBFence;
SyncInfoLin() : BBQueueHandle(NULL), BBFence(0) {}
SyncInfoLin(HANDLE Handle, uint64_t Fence) : BBQueueHandle(Handle), BBFence(Fence) {}
};
typedef class SyncInfoLin SyncInfo;
//Forward class declarations
class AuxTable;
class GmmPageTablePool;
typedef class GmmPageTablePool GMM_PAGETABLEPool;
typedef enum POOL_TYPE_REC
{
POOL_TYPE_TRTTL1 = 0,
POOL_TYPE_TRTTL2 = 1,
POOL_TYPE_AUXTTL1 = 2,
POOL_TYPE_AUXTTL2 = 3,
} POOL_TYPE;
//////////////////////////////////////////////////////////////////////////////////////////////
/// Contains functions and members for GMM_PAGETABLE_MGR, clients must place its pointer in
/// their device object. Clients call GmmLib to initialize the instance and use it for mapping
/// /unmapping on GmmLib managed page tables (TR-TT for SparseResources, AUX-TT for compression)
//////////////////////////////////////////////////////////////////////////////////////////////
class GMM_LIB_API NON_PAGED_SECTION GmmPageTableMgr :
public GmmMemAllocator
{
private:
GMM_ENGINE_TYPE EngType; //PageTable managed @ device-level (specifies engine associated with the device)
AuxTable* AuxTTObj; //Auxiliary Translation Table obj
GMM_PAGETABLEPool *pPool; //Common page table pool
uint32_t NumNodePoolElements;
GmmClientContext *pClientContext; ///< ClientContext of the client creating this Object
//OS-specific defn
#if defined __linux__
pthread_mutex_t PoolLock;
#endif
public:
GMM_DEVICE_CALLBACKS DeviceCb; //OS-specific defn: Will be used by Clients to send as input arguments for TR-TT APIs
GMM_DEVICE_CALLBACKS_INT DeviceCbInt; //OS-specific defn: Will be used internally GMM lib
GMM_TRANSLATIONTABLE_CALLBACKS TTCb; //OS-specific defn
HANDLE hCsr; // OCL per-device command stream receiver handle for aubcapture
public:
GmmPageTableMgr();
GmmPageTableMgr(GMM_DEVICE_CALLBACKS_INT *, uint32_t TTFlags, GmmClientContext *pClientContextIn); // Allocates memory for indicate TT’s root-tables, initializes common node-pool
//GMM_VIRTUAL GMM_GFX_ADDRESS GetTRL3TableAddr();
GMM_VIRTUAL GMM_GFX_ADDRESS GetAuxL3TableAddr();
//Update TT root table address in context-image
GMM_VIRTUAL GMM_STATUS InitContextAuxTableRegister(HANDLE initialBBHandle, GMM_ENGINE_TYPE engType); //Clients call it to update Aux-Table pointer in context-image, engType reqd. if @ context level
//Aux TT management API
GMM_VIRTUAL GMM_STATUS UpdateAuxTable(const GMM_DDI_UPDATEAUXTABLE*); //new API for updating Aux-Table to point to correct 16B-chunk
//for given host page VA when base/Aux surf is mapped/unmapped
GMM_VIRTUAL void __ReleaseUnusedPool(GMM_UMD_SYNCCONTEXT *UmdContext);
GMM_VIRTUAL GMM_PAGETABLEPool * __GetFreePoolNode(uint32_t * FreePoolNodeIdx, POOL_TYPE PoolType);
#if defined __linux__
//returns number of BOs for indicated TTs = NumNodePoolElements+1 BOs for root table and pools
GMM_VIRTUAL int GetNumOfPageTableBOs(uint8_t TTFlags);
//returns BO* list for indicated TT in client allocated memory
GMM_VIRTUAL int GetPageTableBOList(uint8_t TTFlags, void* BOList);
#endif
//Destructor
GMM_VIRTUAL ~GmmPageTableMgr(); //Clean-up page table structures
// Inline Functions
/////////////////////////////////////////////////////////////////////////////////////
/// Returns GmmClientContext associated with this PageTableMgr
/// @return ::GmmClientContext
/////////////////////////////////////////////////////////////////////////////////////
GMM_INLINE_VIRTUAL GmmClientContext* GetClientContext()
{
return pClientContext;
}
private:
GMM_PAGETABLEPool * __AllocateNodePool(uint32_t AddrAlignment, POOL_TYPE Type);
GMM_INLINE GMM_LIB_CONTEXT *GetLibContext()
{
return pClientContext->GetLibContext();
}
};
}
#endif // #ifdef __cplusplus
#endif

View File

@ -0,0 +1,570 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
typedef enum GMM_FLATCCS_FORMAT_ENUM
{
GMM_FLATCCS_FORMAT_R16S = 0,
GMM_FLATCCS_FORMAT_R16U = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_RG16F = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_RG16U = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_RG16S = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_RGBA16S = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_RGBA16U = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_RGBA16F = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_MIN_RC_FORMAT = GMM_FLATCCS_FORMAT_R16S,
GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_R32S = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_R32U = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RG32F = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RG32S = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RG32U = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RGBA32F = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RGBA32S = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RGBA32U = GMM_FLATCCS_FORMAT_R32F,
GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_RGBA4 = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_B5G6R5 = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_R8S = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_R8U = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_RG8S = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_RG8U = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_RGBA8S = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_RGBA8U = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_ML8 = GMM_FLATCCS_FORMAT_RGB5A1,
GMM_FLATCCS_FORMAT_RGB10A2,
GMM_FLATCCS_FORMAT_RG11B10,
GMM_FLATCCS_FORMAT_R32F1,
GMM_FLATCCS_FORMAT_R32S1 = GMM_FLATCCS_FORMAT_R32F1,
GMM_FLATCCS_FORMAT_R32U1 = GMM_FLATCCS_FORMAT_R32F1,
GMM_FLATCCS_FORMAT_D32U = GMM_FLATCCS_FORMAT_R32F1,
GMM_FLATCCS_FORMAT_R16F1,
GMM_FLATCCS_FORMAT_R16S1 = GMM_FLATCCS_FORMAT_R16F1,
GMM_FLATCCS_FORMAT_R16U1 = GMM_FLATCCS_FORMAT_R16F1,
GMM_FLATCCS_FORMAT_R8S1,
GMM_FLATCCS_FORMAT_R8U1 = GMM_FLATCCS_FORMAT_R8S1,
GMM_FLATCCS_MAX_RC_FORMAT = GMM_FLATCCS_FORMAT_R8U1,
GMM_FLATCCS_MIN_MC_FORMAT = 0x21, //(0x1 <<5) ie Msb-5th bit turned on to identify MC encoding, to drop before SurfaceState usage
GMM_FLATCCS_FORMAT_RGBA16_MEDIA = GMM_FLATCCS_MIN_MC_FORMAT,
GMM_FLATCCS_FORMAT_Y210,
GMM_FLATCCS_FORMAT_YUY2,
GMM_FLATCCS_FORMAT_Y410,
GMM_FLATCCS_FORMAT_Y216,
GMM_FLATCCS_FORMAT_Y416,
GMM_FLATCCS_FORMAT_P010,
GMM_FLATCCS_FORMAT_P010_L = GMM_FLATCCS_FORMAT_P010, //MC 7h
GMM_FLATCCS_FORMAT_P010_C = GMM_FLATCCS_FORMAT_P010, //MC 7h
GMM_FLATCCS_FORMAT_P016,
GMM_FLATCCS_FORMAT_P016_L = GMM_FLATCCS_FORMAT_P016, //MC 8h
GMM_FLATCCS_FORMAT_P016_C = GMM_FLATCCS_FORMAT_P016, //MC 8h
GMM_FLATCCS_FORMAT_AYUV,
GMM_FLATCCS_FORMAT_ARGB8b,
GMM_FLATCCS_FORMAT_SWAPY,
GMM_FLATCCS_FORMAT_SWAPUV,
GMM_FLATCCS_FORMAT_SWAPUVY,
GMM_FLATCCS_FORMAT_RGB10b,
GMM_FLATCCS_FORMAT_NV12,
GMM_FLATCCS_FORMAT_NV12_L = GMM_FLATCCS_FORMAT_NV12,
GMM_FLATCCS_FORMAT_NV12_C = GMM_FLATCCS_FORMAT_NV12,
GMM_FLATCCS_FORMAT_YCRCB_SWAPUV = GMM_FLATCCS_FORMAT_SWAPUV,
GMM_FLATCCS_FORMAT_YCRCB_SWAPUVY = GMM_FLATCCS_FORMAT_SWAPUVY,
GMM_FLATCCS_FORMAT_YCRCB_SWAPY = GMM_FLATCCS_FORMAT_SWAPY,
GMM_FLATCCS_MAX_MC_FORMAT = GMM_FLATCCS_FORMAT_NV12, //should always be equal to last format encoding
GMM_FLATCCS_FORMAT_INVALID, //equal to last valid encoding plus one
} GMM_FLATCCS_FORMAT;
typedef enum GMM_XE2_UNIFIED_COMP_FORMAT_ENUM
{
GMM_XE2_UNIFIED_COMP_FORMAT_R8 = 0, //0h – bpc8 ‘R’
GMM_XE2_UNIFIED_COMP_MIN_FORMAT = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_NV12_L = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_D32U = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_R8U = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_R8S = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_R8U1 = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_R8S1 = GMM_XE2_UNIFIED_COMP_FORMAT_R8,
GMM_XE2_UNIFIED_COMP_FORMAT_RG8, //1h – bpc8 ‘RG’
GMM_XE2_UNIFIED_COMP_FORMAT_RGB5A1 = GMM_XE2_UNIFIED_COMP_FORMAT_RG8,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA4 = GMM_XE2_UNIFIED_COMP_FORMAT_RG8,
GMM_XE2_UNIFIED_COMP_FORMAT_B5G6R5 = GMM_XE2_UNIFIED_COMP_FORMAT_RG8,
GMM_XE2_UNIFIED_COMP_FORMAT_NV12_C = GMM_XE2_UNIFIED_COMP_FORMAT_RG8,
GMM_XE2_UNIFIED_COMP_FORMAT_RG8U = GMM_XE2_UNIFIED_COMP_FORMAT_RG8,
GMM_XE2_UNIFIED_COMP_FORMAT_RG8S = GMM_XE2_UNIFIED_COMP_FORMAT_RG8,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8, // 2h – bpc8 ‘RGBA’
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8U = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8S = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8,
GMM_XE2_UNIFIED_COMP_FORMAT_YUY2 = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8,
GMM_XE2_UNIFIED_COMP_FORMAT_AYUV = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8,
GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA8,
GMM_XE2_UNIFIED_COMP_FORMAT_SWAPY = GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB,
GMM_XE2_UNIFIED_COMP_FORMAT_SWAPUV = GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB,
GMM_XE2_UNIFIED_COMP_FORMAT_SWAPUVY = GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB,
GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB_SWAPUV = GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB,
GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB_SWAPUVY = GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB,
GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB_SWAPY = GMM_XE2_UNIFIED_COMP_FORMAT_YCRCB,
GMM_XE2_UNIFIED_COMP_FORMAT_RGB10A2, // 3h – 3bpc10_1bpc2 ‘RGBA10A2’
GMM_XE2_UNIFIED_COMP_FORMAT_Y410 = GMM_XE2_UNIFIED_COMP_FORMAT_RGB10A2,
GMM_XE2_UNIFIED_COMP_FORMAT_RG11B10, // 4h - 2bpc11_1bpc10 ‘RG11B10’
GMM_XE2_UNIFIED_COMP_FORMAT_R16, // 5h - bpc16 ‘R’
GMM_XE2_UNIFIED_COMP_FORMAT_R16U = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_R16S = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_R16F1 = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_R16U1 = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_R16S1 = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_P010_L = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_P016_L = GMM_XE2_UNIFIED_COMP_FORMAT_R16,
GMM_XE2_UNIFIED_COMP_FORMAT_RG16, // 6h – bpc16 ‘RG’
GMM_XE2_UNIFIED_COMP_FORMAT_RG16U = GMM_XE2_UNIFIED_COMP_FORMAT_RG16,
GMM_XE2_UNIFIED_COMP_FORMAT_RG16F = GMM_XE2_UNIFIED_COMP_FORMAT_RG16,
GMM_XE2_UNIFIED_COMP_FORMAT_RG16S = GMM_XE2_UNIFIED_COMP_FORMAT_RG16,
GMM_XE2_UNIFIED_COMP_FORMAT_P010_C = GMM_XE2_UNIFIED_COMP_FORMAT_RG16,
GMM_XE2_UNIFIED_COMP_FORMAT_P016_C = GMM_XE2_UNIFIED_COMP_FORMAT_RG16,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16, // 7h - bpc16 ‘RGBA’
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16U = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16F = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16S = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA16,
GMM_XE2_UNIFIED_COMP_FORMAT_R32, // 8h - bpc32 ‘R’
GMM_XE2_UNIFIED_COMP_FORMAT_R32U = GMM_XE2_UNIFIED_COMP_FORMAT_R32,
GMM_XE2_UNIFIED_COMP_FORMAT_R32F = GMM_XE2_UNIFIED_COMP_FORMAT_R32,
GMM_XE2_UNIFIED_COMP_FORMAT_R32S = GMM_XE2_UNIFIED_COMP_FORMAT_R32,
GMM_XE2_UNIFIED_COMP_FORMAT_R32U1 = GMM_XE2_UNIFIED_COMP_FORMAT_R32,
GMM_XE2_UNIFIED_COMP_FORMAT_R32F1 = GMM_XE2_UNIFIED_COMP_FORMAT_R32,
GMM_XE2_UNIFIED_COMP_FORMAT_R32S1 = GMM_XE2_UNIFIED_COMP_FORMAT_R32,
GMM_XE2_UNIFIED_COMP_FORMAT_RG32, // 9h - bpc32 ‘RG’
GMM_XE2_UNIFIED_COMP_FORMAT_RG32U = GMM_XE2_UNIFIED_COMP_FORMAT_RG32,
GMM_XE2_UNIFIED_COMP_FORMAT_RG32F = GMM_XE2_UNIFIED_COMP_FORMAT_RG32,
GMM_XE2_UNIFIED_COMP_FORMAT_RG32S = GMM_XE2_UNIFIED_COMP_FORMAT_RG32,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32, // 10h - bpc32 ‘RGBA’
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32U = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32F = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32,
GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32S = GMM_XE2_UNIFIED_COMP_FORMAT_RGBA32,
GMM_XE2_UNIFIED_COMP_FORMAT_Y210, // 11h – packed YUV (Y210, Y416, Y216)
GMM_XE2_UNIFIED_COMP_FORMAT_Y216 = GMM_XE2_UNIFIED_COMP_FORMAT_Y210,
GMM_XE2_UNIFIED_COMP_FORMAT_Y416 = GMM_XE2_UNIFIED_COMP_FORMAT_Y210,
GMM_XE2_UNIFIED_COMP_FORMAT_RSVD1, // 12h – Unused
GMM_XE2_UNIFIED_COMP_FORMAT_HW_RSVD, // 13h – HW Stateless from MMIO or Uncompressed
GMM_XE2_UNIFIED_COMP_FORMAT_RSVD2_, // 13h – Stateless MMIO CMF?
GMM_XE2_UNIFIED_COMP_FORMAT_ML8 = 0xF, // 15h – ML and Lossy-Compressed textures
GMM_XE2_UNIFIED_COMP_MAX_FORMAT = GMM_XE2_UNIFIED_COMP_FORMAT_ML8,
GMM_XE2_UNIFIED_COMP_FORMAT_INVALID, //equal to last valid encoding plus one
} GMM_XE2_UNIFIED_COMP_FORMAT;
typedef enum GMM_UNIFIED_COMP_FORMAT_ENUM
{
GMM_UNIFIED_COMP_FORMAT_RGBA32F = 0, //0h - bpc32 RGBA F/S
GMM_UNIFIED_COMP_FORMAT_RGBA32S = GMM_UNIFIED_COMP_FORMAT_RGBA32F,
GMM_UNIFIED_COMP_MIN_RC_FORMAT = GMM_UNIFIED_COMP_FORMAT_RGBA32F,
GMM_UNIFIED_COMP_FORMAT_RGBA32U, //1h - bpc32 RGBA U
GMM_UNIFIED_COMP_FORMAT_RG32F, // 2h - bpc32 RG F/S
GMM_UNIFIED_COMP_FORMAT_RG32S = GMM_UNIFIED_COMP_FORMAT_RG32F,
GMM_UNIFIED_COMP_FORMAT_RG32U, // 3h - bpc32 RG U
GMM_UNIFIED_COMP_FORMAT_RGBA16U, // 4h - bpc16 RGBA U
GMM_UNIFIED_COMP_FORMAT_RGBA16F, // 5h - bpc16 RGBA F/S
GMM_UNIFIED_COMP_FORMAT_RGBA16S = GMM_UNIFIED_COMP_FORMAT_RGBA16F,
GMM_UNIFIED_COMP_FORMAT_RG16U, // 6h - bpc16 RG U
GMM_UNIFIED_COMP_FORMAT_RG16F, // 7h - bpc16 RG F/S
GMM_UNIFIED_COMP_FORMAT_RG16S = GMM_UNIFIED_COMP_FORMAT_RG16F,
GMM_UNIFIED_COMP_FORMAT_RGBA8U, // 8h - bpc8 RGBA U
GMM_UNIFIED_COMP_FORMAT_RGBA8S, // 9h - bpc8 RGBA S
GMM_UNIFIED_COMP_FORMAT_RGB5A1, // Ah - bpc8
GMM_UNIFIED_COMP_FORMAT_RGBA4 = GMM_UNIFIED_COMP_FORMAT_RGB5A1,
GMM_UNIFIED_COMP_FORMAT_B5G6R5 = GMM_UNIFIED_COMP_FORMAT_RGB5A1,
GMM_UNIFIED_COMP_FORMAT_RG8U = GMM_UNIFIED_COMP_FORMAT_RGB5A1,
GMM_UNIFIED_COMP_FORMAT_RG8S, // Bh - bpc8
GMM_UNIFIED_COMP_FORMAT_RGB10A2, // Ch - bpc8
GMM_UNIFIED_COMP_FORMAT_RG11B10, // Dh - bpc8
GMM_UNIFIED_COMP_FORMAT_R32F = 0x10, // 10h - bpc32 R F/S
GMM_UNIFIED_COMP_FORMAT_R32F1 = GMM_UNIFIED_COMP_FORMAT_R32F,
GMM_UNIFIED_COMP_FORMAT_R32S = GMM_UNIFIED_COMP_FORMAT_R32F,
GMM_UNIFIED_COMP_FORMAT_R32S1 = GMM_UNIFIED_COMP_FORMAT_R32F,
GMM_UNIFIED_COMP_FORMAT_R32U, // 11h - bpc32 R U
GMM_UNIFIED_COMP_FORMAT_R32U1 = GMM_UNIFIED_COMP_FORMAT_R32U,
GMM_UNIFIED_COMP_FORMAT_D32U = GMM_UNIFIED_COMP_FORMAT_R32U,
GMM_UNIFIED_COMP_FORMAT_R16U = 0x14, // 14h - bpc16 R U
GMM_UNIFIED_COMP_FORMAT_R16U1 = GMM_UNIFIED_COMP_FORMAT_R16U, // 14h - bpc16 R U
GMM_UNIFIED_COMP_FORMAT_R16F, // 15h - bpc16 R F/S
GMM_UNIFIED_COMP_FORMAT_R16F1 = GMM_UNIFIED_COMP_FORMAT_R16F,
GMM_UNIFIED_COMP_FORMAT_R16S = GMM_UNIFIED_COMP_FORMAT_R16F,
GMM_UNIFIED_COMP_FORMAT_R16S1 = GMM_UNIFIED_COMP_FORMAT_R16F,
GMM_UNIFIED_COMP_FORMAT_R8U = 0x18, // 18h - bpc8 R U
GMM_UNIFIED_COMP_FORMAT_R8U1 = GMM_UNIFIED_COMP_FORMAT_R8U,
GMM_UNIFIED_COMP_FORMAT_R8S, // 19h - bpc8 R S
GMM_UNIFIED_COMP_FORMAT_R8S1 = GMM_UNIFIED_COMP_FORMAT_R8S,
GMM_UNIFIED_COMP_FORMAT_ML8 = 0x1F,
GMM_UNIFIED_COMP_MAX_RC_FORMAT = GMM_UNIFIED_COMP_FORMAT_ML8,
GMM_UNIFIED_COMP_MIN_MC_FORMAT = 0x21, //(0x1 <<5) ie Msb-5th bit turned on to identify MC encoding, to drop before SurfaceState usage
GMM_UNIFIED_COMP_FORMAT_RGBA16_MEDIA = GMM_UNIFIED_COMP_MIN_MC_FORMAT, //MC 1h
GMM_UNIFIED_COMP_FORMAT_Y210, //MC 2h
GMM_UNIFIED_COMP_FORMAT_YUY2, //MC 3h
GMM_UNIFIED_COMP_FORMAT_Y410, //MC 4h
GMM_UNIFIED_COMP_FORMAT_Y216, //MC 5h
GMM_UNIFIED_COMP_FORMAT_Y416, //MC 6h
GMM_UNIFIED_COMP_FORMAT_P010, //MC 7h
GMM_UNIFIED_COMP_FORMAT_P010_L = GMM_UNIFIED_COMP_FORMAT_P010,
GMM_UNIFIED_COMP_FORMAT_P010_C = GMM_UNIFIED_COMP_FORMAT_P010,
GMM_UNIFIED_COMP_FORMAT_P016, //MC 8h
GMM_UNIFIED_COMP_FORMAT_P016_L = GMM_UNIFIED_COMP_FORMAT_P016,
GMM_UNIFIED_COMP_FORMAT_P016_C = GMM_UNIFIED_COMP_FORMAT_P016,
GMM_UNIFIED_COMP_FORMAT_AYUV, //MC 9h
GMM_UNIFIED_COMP_FORMAT_ARGB8b, //MC Ah
GMM_UNIFIED_COMP_FORMAT_SWAPY, //MC Bh
GMM_UNIFIED_COMP_FORMAT_SWAPUV, //MC Ch
GMM_UNIFIED_COMP_FORMAT_SWAPUVY, //MC Dh
GMM_UNIFIED_COMP_FORMAT_RGB10b, //MC Eh --Which media format is it?
GMM_UNIFIED_COMP_FORMAT_NV12, //MC Fh
GMM_UNIFIED_COMP_FORMAT_NV12_L = GMM_UNIFIED_COMP_FORMAT_NV12,
GMM_UNIFIED_COMP_FORMAT_NV12_C = GMM_UNIFIED_COMP_FORMAT_NV12,
GMM_UNIFIED_COMP_FORMAT_YCRCB_SWAPUV = GMM_UNIFIED_COMP_FORMAT_SWAPUV,
GMM_UNIFIED_COMP_FORMAT_YCRCB_SWAPUVY = GMM_UNIFIED_COMP_FORMAT_SWAPUVY,
GMM_UNIFIED_COMP_FORMAT_YCRCB_SWAPY = GMM_UNIFIED_COMP_FORMAT_SWAPY,
GMM_UNIFIED_COMP_MAX_MC_FORMAT = GMM_UNIFIED_COMP_FORMAT_NV12, //should always be equal to last format encoding
GMM_UNIFIED_COMP_FORMAT_INVALID, //equal to last valid encoding plus one
} GMM_UNIFIED_COMP_FORMAT;
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
// Set packing alignment
#pragma pack(push, 8)
#ifndef __GMM_KMD__
#ifdef _WIN32
#ifndef PHYSICAL_ADDRESS
#define PHYSICAL_ADDRESS LARGE_INTEGER
#endif
#endif
#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
#endif
#endif /*__GMM_KMD__*/
//===========================================================================
// typedef:
// GMM_FORMAT_ENTRY
//
// Description:
// This struct is used to describe each surface format in the
// GMM_RESOURCE_FORMAT enum. Each surface format is desginated as a
// supported format on the running platform, as well as if the format is
// renderable.
//
//---------------------------------------------------------------------------
typedef struct GMM_FORMAT_ENTRY_REC
{
struct
{
uint32_t ASTC : 1;
uint32_t Compressed : 1;
uint32_t RenderTarget : 1;
uint32_t Supported : 1;
};
struct
{
uint16_t BitsPer;
uint8_t Depth;
uint8_t Height;
uint8_t Width;
} Element;
GMM_SURFACESTATE_FORMAT SurfaceStateFormat;
union {
GMM_E2ECOMP_FORMAT AuxL1eFormat;
uint8_t CompressionFormat;
} CompressionFormat;
}GMM_FORMAT_ENTRY;
//===========================================================================
// typedef:
// GMM_TILE_MODE_ENUM
//
// Description:
// Enumeration of supported tile modes.
//
//--------------------------------------------------------------------------
#define DEFINE_TILE_BPEs(TileName) \
TILE_##TileName##_8bpe, \
TILE_##TileName##_16bpe, \
TILE_##TileName##_32bpe, \
TILE_##TileName##_64bpe, \
TILE_##TileName##_128bpe \
typedef enum GMM_TILE_MODE_ENUM
{
TILE_NONE,
// Legacy Tile Modes
LEGACY_TILE_X,
LEGACY_TILE_Y,
// Tile-W is a 64x64 tile swizzled
// onto a 128x32 Tile-Y.
// For allocation purposes Tile-W
// can be treated like Tile-Y
// TILE_W
// Tiled Resource Modes (SKL+)
DEFINE_TILE_BPEs( YF_1D ),
DEFINE_TILE_BPEs( YS_1D ),
DEFINE_TILE_BPEs( YF_2D ),
DEFINE_TILE_BPEs( YF_2D_2X ),
DEFINE_TILE_BPEs( YF_2D_4X ),
DEFINE_TILE_BPEs( YF_2D_8X ),
DEFINE_TILE_BPEs( YF_2D_16X ),
DEFINE_TILE_BPEs( YF_3D ),
DEFINE_TILE_BPEs( YS_2D ),
DEFINE_TILE_BPEs( YS_2D_2X ),
DEFINE_TILE_BPEs( YS_2D_4X ),
DEFINE_TILE_BPEs( YS_2D_8X ),
DEFINE_TILE_BPEs( YS_2D_16X ),
DEFINE_TILE_BPEs( YS_3D ),
// XE_HP/Xe2_LPG
TILE4,
DEFINE_TILE_BPEs( _64_1D ),
DEFINE_TILE_BPEs( _64_2D ),
DEFINE_TILE_BPEs( _64_2D_2X),
DEFINE_TILE_BPEs( _64_2D_4X),
DEFINE_TILE_BPEs( _64_3D),
// Xe2 above
DEFINE_TILE_BPEs(_64_2D_8X),
DEFINE_TILE_BPEs(_64_2D_16X),
GMM_TILE_MODES
}GMM_TILE_MODE;
#undef DEFINE_TILE_BPEs
typedef struct __TEX_ALIGNMENT
{
uint32_t Width; // pixels
uint32_t Height; // scanlines
uint32_t Depth; // pixels
} ALIGNMENT;
//===========================================================================
// typedef:
// GMM_TEXTURE_ALIGN
//
// Description:
// The following struct describes the texture mip map unit alignment
// required for each map format. The alignment values are platform
// dependent.
//
//---------------------------------------------------------------------------
typedef struct GMM_TEXTURE_ALIGN_REC
{
ALIGNMENT Compressed, Depth, Depth_D16_UNORM_1x_4x_16x, Depth_D16_UNORM_2x_8x, SeparateStencil, YUV422, XAdapter, AllOther;
struct
{
ALIGNMENT Align;
uint32_t MaxPitchinTiles;
} CCS;
}GMM_TEXTURE_ALIGN;
//===========================================================================
// typedef:
// __GMM_BUFFER_TYPE_REC
//
// Description:
// This structure represents a buffer type. Common buffer types are
// Display buffers, Color buffers, Linear buffers and ring buffers.
// Each buffer type has platform specific size, dimension and alignment
// restricions that are stored here.
//
//---------------------------------------------------------------------------
typedef struct __GMM_BUFFER_TYPE_REC
{
uint32_t Alignment; // Base Address Alignment
uint32_t PitchAlignment; // Pitch Alignment restriction.
uint32_t RenderPitchAlignment; // Pitch Alignment for render surface
uint32_t LockPitchAlignment; // Pitch Alignment for locked surface
uint32_t MinPitch; // Minimum pitch
GMM_GFX_SIZE_T MaxPitch; // Maximum pitch
GMM_GFX_SIZE_T MinAllocationSize; // Minimum Allocation size requirement
uint32_t MinHeight; // Mininum height in bytes
GMM_GFX_SIZE_T MinWidth; // Minimum width in bytes
uint32_t MinDepth; // Minimum depth (only for volume)
GMM_GFX_SIZE_T MaxHeight; // Maximum height in bytes
GMM_GFX_SIZE_T MaxWidth; // Maximum Width in bytes
uint32_t MaxDepth; // Maximum depth (only for volume)
uint32_t MaxArraySize;
uint8_t NeedPow2LockAlignment; // Locking surface need to be power of 2 aligned
} __GMM_BUFFER_TYPE;
//===========================================================================
// typedef:
// __GMM_PLATFORM_RESOURCE
//
// Description:
// This structure represents various platform specific restrictions for
// - buffer types
// - tile dimensions
// - # of fences regisers platform supports
// - # of addressable bits
// - aperture size
//
//----------------------------------------------------------------------------
typedef struct __GMM_PLATFORM_RESOURCE_REC
{
PLATFORM Platform;
//
// Define memory type req., alignment, min allocation size;
//
__GMM_BUFFER_TYPE Vertex; // Vertex Buffer restrictions
__GMM_BUFFER_TYPE Index; // Index Buffer restrictions
__GMM_BUFFER_TYPE Constant; //
__GMM_BUFFER_TYPE StateDx9ConstantBuffer; // Dx9 Constant Buffer pool restrictions
__GMM_BUFFER_TYPE Texture2DSurface; // 2D texture surface
__GMM_BUFFER_TYPE Texture2DLinearSurface; // 2D Linear media surface
__GMM_BUFFER_TYPE Texture3DSurface; // 3D texture surface
__GMM_BUFFER_TYPE CubeSurface; // cube texture surface
__GMM_BUFFER_TYPE BufferType; // Buffer type surface
__GMM_BUFFER_TYPE Color; // Color (Render Target) Buffer
__GMM_BUFFER_TYPE Depth; // Depth Buffer Restriction
__GMM_BUFFER_TYPE Stencil; // Stencil Buffer Restrictions
__GMM_BUFFER_TYPE HiZ; // Hierarchical Depth Buffer Resrictions
__GMM_BUFFER_TYPE Stream; //
__GMM_BUFFER_TYPE Video; // Video Planar surface restrictions
__GMM_BUFFER_TYPE MotionComp; // Motion Compensation buffer
__GMM_BUFFER_TYPE Overlay; // Overlay Buffer
__GMM_BUFFER_TYPE Nndi; // Non native display buffer restrictions
__GMM_BUFFER_TYPE ASyncFlipSurface; // ASync flip chain Buffers
__GMM_BUFFER_TYPE HardwareMBM; // Buffer Restrictions
__GMM_BUFFER_TYPE InterlacedScan; //
__GMM_BUFFER_TYPE TextApi; //
__GMM_BUFFER_TYPE Linear; // Linear(Generic) Buffer restrictions
__GMM_BUFFER_TYPE Cursor; // Cursor surface restrictions
__GMM_BUFFER_TYPE NoRestriction; // Motion Comp Buffer
__GMM_BUFFER_TYPE XAdapter; // Cross adapter linear buffer restrictions
GMM_TEXTURE_ALIGN TexAlign; // Alignment Units for Texture Maps
//
// various tile dimension based on platform
//
GMM_TILE_INFO TileInfo[GMM_TILE_MODES];
//
// General platform Restriction
//
uint32_t NumberFenceRegisters;
uint32_t MinFenceSize; // 1 MB for Napa, 512 KB for Almador
uint32_t FenceLowBoundShift;
uint32_t FenceLowBoundMask;
uint32_t PageTableSteer; // Default for page table steer register
uint32_t PagingBufferPrivateDataSize;
uint32_t MaxLod;
uint32_t FBCRequiredStolenMemorySize; // Stolen Memory size required for FBC
GMM_FORMAT_ENTRY FormatTable[GMM_RESOURCE_FORMATS];
uint32_t ResAllocTag[GMM_MAX_HW_RESOURCE_TYPE]; // uint32_t = 4 8-bit ASCII characters
uint32_t SurfaceStateYOffsetGranularity;
uint32_t SamplerFetchGranularityWidth;
uint32_t SamplerFetchGranularityHeight;
int64_t SurfaceMaxSize; // int64_t - Surface size is 64 bit for all configurations
uint32_t MaxGpuVirtualAddressBitsPerResource;
uint32_t MaxSLMSize;
uint8_t HiZPixelsPerByte; //HiZ-Bpp is < 1, keep inverse
uint64_t ReconMaxHeight;
uint64_t ReconMaxWidth;
uint8_t NoOfBitsSupported; // No of bits supported for System physcial address on GPU
uint64_t HighestAcceptablePhysicalAddress; // Highest acceptable System physical Address
}__GMM_PLATFORM_RESOURCE, GMM_PLATFORM_INFO;
//***************************************************************************
//
// GMM_PLATFORM_INFO API
//
//***************************************************************************
uint32_t GMM_STDCALL GmmPlatformGetBppFromGmmResourceFormat(void *pLibContext, GMM_RESOURCE_FORMAT Format);
// Reset packing alignment to project default
#pragma pack(pop)
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,30 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
//////////////////////////////////////////////////////////////////////////////////////
// GmmRestrictions.c
//////////////////////////////////////////////////////////////////////////////////////
void __GmmGetCubeTexRestrictions(GMM_PLATFORM_INFO* pPlatformResource,
GMM_RESOURCE_INFO* pResourceInfo,
__GMM_BUFFER_TYPE* pBuff);

View File

@ -0,0 +1,172 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
// Set packing alignment
#pragma pack(push, 8)
//===========================================================================
// typedef:
// GMM_RESOURCE_FLAG
//
// Description:
// This structure describe flags that are used for each allocation
//---------------------------------------------------------------------------
typedef struct GMM_RESOURCE_FLAG_REC
{
// Gpu: Used to describe how the surface will be used by the GPU
struct
{
uint32_t CameraCapture : 1; // Camera Capture Buffer flag to be registered with DXGK for Camera Child VRAM buffer sharing
uint32_t CCS : 1; // Color Control Surface (Gen9+ for MSAA Compression or Non-MSAA Fast Color Clear) + Apply CCS restrictions when padding/aligning this resource (see GmmRestrictions.c)
uint32_t ColorDiscard : 1; // Tile-pass color discard
uint32_t ColorSeparation : 1; // Color Separated surface (Sakura display), surface scanned out as 16bpp
uint32_t ColorSeparationRGBX : 1; // Color Separated surface (Sakura display), surface scanned out as 24bpp (stored as 32bpp)
uint32_t Constant : 1;
uint32_t Depth : 1;
uint32_t FlipChain : 1; // Indicating that this buffer is to be (potentially) scanned out by the display engine.
uint32_t FlipChainPreferred : 1; // .FlipChain & .Overlay are softer, in that they will be cleared in the result if other parameters cause conflict -- e.g. Info.TiledY.
uint32_t HistoryBuffer : 1; // History buffer for performace timestamp feature
uint32_t HiZ : 1;
uint32_t Index : 1;
uint32_t IndirectClearColor : 1; // Hardware managed clear color
uint32_t InstructionFlat : 1; // (Not for heaps!) EU Instruction Resource (addressed by *flat* STATE_BASE_ADDRESS:InstructionState--Do NOT use for STATE_BASE_ADDRESS heap resources!!)
uint32_t InterlacedScan : 1;
uint32_t MCS : 1; // Multisample Control Surface (Pre-Gen9 for MSAA Compression or Non-MSAA Fast Color Clear)
uint32_t MMC : 1; // Media Memory Compression (Gen9+): (right-side) extension to the pixel buffer for media oriented clear-compression data for texture sampling.
uint32_t MotionComp : 1;
uint32_t NoRestriction : 1; // Apply no (more correctly, minimal) restrictions when padding/aligning this resource (see GmmRestrictions.c) e.g. BLOBS.
uint32_t Overlay : 1; // Equivalent to FlipChain, mutually exclusive to it. Legacy (pre gen9) name for sprite plane scane-out buffer..
uint32_t Presentable : 1; // The pixel format is to be validated against those supported by the render core (GPU).
uint32_t ProceduralTexture : 1;
uint32_t Query : 1;
uint32_t RenderTarget : 1; // Apply RenderTarget restrictions when padding/aligning this resource (see GmmRestrictions.c)
uint32_t S3d : 1;
uint32_t S3dDx : 1;
uint32_t __S3dNonPacked : 1; // For OS unaware S3D only
uint32_t __S3dWidi : 1; // For OS unaware S3D only
uint32_t ScratchFlat : 1; // (Not for heaps!) General State Resource (addressed by *flat* STATE_BASE_ADDRESS:GeneralState--Do NOT use for STATE_BASE_ADDRESS heap resources!!)
uint32_t SeparateStencil : 1;
uint32_t State : 1;
uint32_t StateDx9ConstantBuffer : 1; // Use w/ HSW+ cmd 3DSTATE_DX9_CONSTANT_BUFFER_POOL_ALLOC
uint32_t Stream : 1; // Stream-Output Resource (e.g. the target of DX10's Stream-Output Stage)
uint32_t TextApi : 1;
uint32_t Texture : 1; // Apply Texture restrictions when padding/aligning this resource (see GmmRestrictions.c)
uint32_t TiledResource : 1; // Used for DirectX11.2 tiled resources aka sparse resources
uint32_t TilePool : 1; // Used for DirectX11.2 tiled resources
uint32_t UnifiedAuxSurface : 1; // Flag to indicate unified aux surfaces where a number of buffers are allocated as one resource creation call (e.g. for Android/gralloc when a combined CCS with its partner MSAA). A conveneince over making two GmmResCreate calls. Gen9+.
uint32_t Vertex : 1;
uint32_t Video : 1; // Apply Video restrictions when padding/aligning this resource (see GmmRestrictions.c)
uint32_t __NonMsaaTileXCcs : 1; // Internal GMM flag--Clients don't set.
uint32_t __NonMsaaTileYCcs : 1; // Internal GMM flag--Clients don't set.
uint32_t __MsaaTileMcs : 1; // Internal GMM flag--Clients don't set.
uint32_t __NonMsaaLinearCCS : 1; // Internal GMM flag--Clients don't set.
uint32_t __Remaining : 20;// Defining rather than letting float for the two zero-and-memcmp we do with the .Gpu struct (in case ={0} doesn't zero unnamed fields).
} Gpu;
// Info: Used to specify preferences at surface creation time
struct
{
uint32_t AllowVirtualPadding : 1;
uint32_t BigPage : 1;
uint32_t Cacheable : 1;
uint32_t ContigPhysMemoryForiDART : 1; // iDART clients only; resource allocation must be physically contiguous.
uint32_t CornerTexelMode : 1; // Corner Texel Mode
uint32_t ExistingSysMem : 1;
uint32_t ForceResidency : 1; // (SVM Only) Forces CPU/GPU residency of the allocation's backing pages at creation.
uint32_t Gfdt : 1;
uint32_t GttMapType : 5;
uint32_t HardwareProtected : 1;
uint32_t KernelModeMapped : 1; // Sets up pGmmBlock->pKernelModeMapping to allow kernel-mode mapping of the backing memory
uint32_t LayoutBelow : 1; // Indicates the orientation of MIP data in the buffer. This is the surviving option and may be inferred as the default.
uint32_t LayoutMono : 1; // Legacy, deprecated MIP layout. Used for internal debugging.
uint32_t LayoutRight : 1; // Legacy, deprecated MIP layout.
uint32_t LocalOnly : 1;
uint32_t Linear : 1; // (non-)tiling preference for the allocation. (lowest priority) Y>X>W>L. See GmmLib::GmmTextureCalc::SetTileMode()
uint32_t MediaCompressed : 1;
uint32_t NoOptimizationPadding : 1; // don't swell size for sake of 64KB pages - FtrWddm2_1_64kbPages
uint32_t NoPhysMemory : 1; // KMD Gfx Client Submission. Client miniport drivers may want to map their physical pages to Gfx memory space instead of allocating Gfx physical memory.
uint32_t NotLockable : 1; // Resource is GPU-exclusive and shall not be reference by the CPU. Relevant to memory allocation components as an optimisation opportunity for mapping buffers in CPU-side.
uint32_t NonLocalOnly : 1;
uint32_t StdSwizzle : 1; // Standard Swizzle (YS) support on SKL+
uint32_t PseudoStdSwizzle : 1; // Only applicable to D3D12+ UMD's, for special-case of limited Standard Swizzle (YS) support on HSW/BDW/CHV.
uint32_t Undefined64KBSwizzle : 1; // Only applicable if system doesn't support StdSwizzle (i.e. Pre-Gen9). If set, surface is using one of the INTEL_64KB_UNDEFINED_* swizzles.
uint32_t RedecribedPlanes : 1; // The resource has redescribed planar surfaces
uint32_t RenderCompressed : 1;
uint32_t Rotated : 1;
uint32_t Shared : 1;
uint32_t SoftwareProtected : 1; // Resource is driver protected against CPU R/W access
uint32_t SVM : 1; // Shared Virtual Memory (i.e. GfxAddr = CpuAddr) Can only be set for ExistingSysMem allocations.
uint32_t TiledW : 1; // Tiling preference for the allocation. (second lowest priority) Y>X>W>L. Special use case.
uint32_t TiledX : 1; // Tiling preference for the allocation. (second highest priority) Y>X>W>L. Common use case.
uint32_t TiledY : 1; // Tiling preference for the allocation. (highest priority) Y>X>W>L. Common use case. Displayable GEn9+
uint32_t TiledYf : 1; // Tiling modifier for the allocation. Affects Linear and Y preferences. Gen9+
uint32_t TiledYs : 1; // Tiling modifier for the allocation. Affects Linear and Y preferences. Gen9+
uint32_t WddmProtected : 1; // Sets the DXGK_ALLOCATIONINFOFLAGS.Protected flag
uint32_t XAdapter : 1; // For WinBlue: to support Hybrid graphics
uint32_t __PreallocatedResInfo : 1; // Internal GMM flag--Clients don't set.
uint32_t __PreWddm2SVM : 1; // Internal GMM flag--Clients don't set.
uint32_t Tile4 : 1; // 4KB tile
uint32_t Tile64 : 1; // 64KB tile
uint32_t NotCompressed : 1; // UMD to set this for a resource, this will be a request to GMM which need not be honoured always
uint32_t __MapCompressible : 1; // Internal GMM flag which marks a resource as compressed during map, used for tracking
uint32_t __MapUnCompressible : 1; // Internal GMM flag which marks a resource as not compressed during map, used for tracking
} Info;
// Wa: Any Surface specific Work Around will go in here
struct
{
uint32_t GTMfx2ndLevelBatchRingSizeAlign : 1; // GT steppings prior to C0 require MFX 2nd level bb's to have certain alignment.
uint32_t ILKNeedAvcMprRowStore32KAlign : 1; // ILK A0 requires 32K align WA for AVC MPR RowStore
uint32_t ILKNeedAvcDmvBuffer32KAlign : 1; // ILK A0 requires 32K align WA for AVC DMV Buffers
uint32_t NoBufferSamplerPadding : 1; // GMM not to add pre-BDW buffer sampler padding--UMD's take responsibility to flush L3 after sampling, etc.
uint32_t NoLegacyPlanarLinearVideoRestrictions : 1; // GMM not to apply Legacy Planar "Linear Video" Restrictions (64B pitch alignment)
uint32_t CHVAstcSkipVirtualMips : 1; // GMM adjusts mip-map allocation to skip mip0 size
uint32_t DisablePackedMipTail : 1; // Disables Yf/Ys MIP Tail packing--forcing each MIP to its own tile boundary.
uint32_t __ForceOtherHVALIGN4 : 1;
uint32_t DisableDisplayCcsClearColor : 1; // Disables display clear color
uint32_t DisableDisplayCcsCompression : 1; // Disables display decompression on the surface (it disables display awareness of both fast clear/render compression)
uint32_t PreGen12FastClearOnly : 1; // i.e. AUX_CCS_D (instead of AUX_CCS_E). Flag carried by GMM between UMD’s to support shared resources.
uint32_t MediaPipeUsage : 1; // TileHeight Aligned ArrayQPitch on Tile4/TileY
uint32_t ForceStdAllocAlign : 1; // Align standard allocation to 2MB, allowing 64K-PageTable. Set by KMD, not be used by UMDs
uint32_t DeniableLocalOnlyForCompression : 1; // Align standard allocation to 2MB, allowing 64K-PageTable. Set by KMD, not be used by UMDs
uint32_t SlicePitchPadding64KB : 1; // WA for MultiEngine compression, to enable slice pitch padding
uint32_t SizePadding64KB : 1; // WA for MultiEngine compression, to enable size padding to 64KB
uint32_t IgnoreMultiEngineCompression64KBWA : 1; // ignore multi engine compression 64KB WA
} Wa;
} GMM_RESOURCE_FLAG;
// Reset packing alignment to project default
#pragma pack(pop)
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,104 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
// Set packing alignment
#pragma pack(push, 8)
extern const uint32_t __GmmMSAAConversion[5][2];
extern const uint32_t __GmmTileYConversionTable[5][2];
//
// Normally, GMM_RESOURCE_INFO should not contain any user mode pointers because
// if the resource is shared, then the pointer will be invalid in the other process.
// However, the pointers below are OK because pMappedTiles and pTiledPoolArray are
// associated with a TR surface, which is not shareable. AuxInfo.pTilePoolInfo is associated
// with tile pools; Tile Pools are shareable, but Aux tile pool aren't.
//
typedef struct TILE_POOL_INFO_REC
{
uint64_t UsedTiles[4]; // Tiles being used in 1 tile pool
GMM_GFX_ADDRESS StartingGfxAddress; // GfxAddress associated with the TilePool
} TILE_POOL_INFO;
typedef struct GMM_TILED_RESOURCE_INFO_REC
{
GMM_GFX_ADDRESS TiledResourceGfxAddress; // used for tiled resources
uint64_t pMappedTiles; // tracks which tiles have been mapped
uint64_t pTilePoolArray; // list of tile pool allocation
// handles (D3DKMT_HANDLE),
// only used for tiled resources
uint64_t pAuxTilePoolResArray; // list of aux tile pool allocation resource, and handles
uint32_t TilePoolArraySize;
uint32_t AuxTilePoolArraySize;
struct
{
uint64_t pTilePoolInfo;
uint64_t PagingFenceValue;
uint32_t TilePoolInfoTotalNumElements; // Number of elements in pTilePoolInfo array
uint32_t TilePoolInfoFreeNumElements; // Number of free tile pools
} AuxInfo;
} GMM_TILED_RESOURCE_INFO;
typedef struct GMM_EXISTING_SYS_MEM_REC
{
// 64bit kernel mode drivers must validate sizeof structs passed from
// 32bit & 64bit user mode drivers. Store as 64bit to keep uniform size.
uint64_t pExistingSysMem; //Original buffer address.
uint64_t pVirtAddress;
uint64_t pGfxAlignedVirtAddress;
#if(LHDM)
D3DKMT_HANDLE hParentAllocation;
#endif
GMM_GFX_SIZE_T Size;
uint8_t IsGmmAllocated;
} GMM_EXISTING_SYS_MEM;
//===========================================================================
// typedef:
// GMM_RESOURCE_INFO
//
// Description:
// Struct describing the attributes and properties of a user mode resource
//
//----------------------------------------------------------------------------
#ifndef _WIN32
#include "../Linux/GmmResourceInfoLin.h"
#endif
// Reset packing alignment to project default
#pragma pack(pop)
uint8_t GMM_STDCALL GmmResValidateParams(GMM_RESOURCE_INFO *pResourceInfo);
void GMM_STDCALL GmmResGetRestrictions(GMM_RESOURCE_INFO* pResourceInfo, __GMM_BUFFER_TYPE* pRestrictions);
uint8_t __CanSupportStdTiling(GMM_TEXTURE_INFO Surface, GMM_LIB_CONTEXT *pGmmLibContext);
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,773 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#if _WIN32
#ifndef __GMM_KMD__
typedef LONG NTSTATUS;
#include <windows.h>
#include <d3d9types.h>
#include <d3dkmthk.h>
#endif
#endif
// Set packing alignment
#pragma pack(push, 8)
// Rotation bitmap fields
#define GMM_KMD_ROTATE 0x00000001 // this is to inform KMD to enable
// rotation in Full screen case
// Color separation textures width division factors and array size
#define GMM_COLOR_SEPARATION_WIDTH_DIVISION 4
#define GMM_COLOR_SEPARATION_RGBX_WIDTH_DIVISION 3
#define GMM_COLOR_SEPARATION_ARRAY_SIZE 4 // XXX: Change that to 3 once 2nd green scanout using sprites is validated
//===========================================================================
// typedef:
// GMM_RESOURCE_MMC_INFO
//
// Description:
// This struct is used to describe Media Memory Compression information.
//---------------------------------------------------------------------------
typedef enum GMM_RESOURCE_MMC_INFO_REC
{
GMM_MMC_DISABLED = 0,
GMM_MMC_HORIZONTAL,
GMM_MMC_VERTICAL,
GMM_MMC_MC,
GMM_MMC_RC
}GMM_RESOURCE_MMC_INFO;
//===========================================================================
// typedef:
// GMM_RESOURCE_MMC_HINT
//
// Description:
// This struct is used to indicate if Media Memory Compression is needed.
//---------------------------------------------------------------------------
typedef enum GMM_RESOURCE_MMC_HINT_REC
{
GMM_MMC_HINT_ON = 0,
GMM_MMC_HINT_OFF,
}GMM_RESOURCE_MMC_HINT;
//===========================================================================
// typedef:
// GMM_MSAA_SAMPLE_PATTERN
//
// Description:
// This enum details the sample pattern of a MSAA texture
//---------------------------------------------------------------------------
typedef enum GMM_MSAA_SAMPLE_PATTERN_REC
{
GMM_MSAA_DISABLED = 0,
GMM_MSAA_STANDARD,
GMM_MSAA_CENTEROID,
GMM_MSAA_REGULAR
}GMM_MSAA_SAMPLE_PATTERN;
typedef enum GMM_TILE_RANGE_FLAG_ENUM
{
GMM_TILE_RANGE_NULL = 0x00000001,
GMM_TILE_RANGE_SKIP = 0x00000002,
GMM_TILE_RANGE_REUSE_SINGLE_TILE = 0x00000004,
} GMM_TILE_RANGE_FLAG;
//===========================================================================
// typedef:
// GMM_RESOURCE_MSAA_INFO
//
// Description:
// This struct is used to describe MSAA information.
//---------------------------------------------------------------------------
typedef struct GMM_RESOURCE_MSAA_INFO_REC
{
GMM_MSAA_SAMPLE_PATTERN SamplePattern;
uint32_t NumSamples;
}GMM_RESOURCE_MSAA_INFO;
//===========================================================================
// typedef:
// GMM_RESOURCE_ALIGNMENT_UNITS
//
// Description:
// Various alignment units of an allocation.
// NOTE: H/VAlign and QPitch stored *UNCOMPRESSED* here, despite Gen9+
// SURFACE_STATE using compressed!!!
//---------------------------------------------------------------------------
typedef struct GMM_RESOURCE_ALIGNMENT_REC
{
uint8_t ArraySpacingSingleLod; // Single-LOD/Full Array Spacing
uint32_t BaseAlignment; // Base Alignment
uint32_t HAlign, VAlign, DAlign; // Alignment Unit Width/Height
uint32_t MipTailStartLod; // Mip Tail (SKL+)
uint32_t PackedMipStartLod; // Packed Mip (Pre-Gen9 / Undefined64KBSwizzle)
uint32_t PackedMipWidth; // Packed Mip Width in # of 64KB Tiles (Pre-Gen9 / Undefined64KBSwizzle)
uint32_t PackedMipHeight; // Packed Mip Height in # of 64KB Tiles (Pre-Gen9 / Undefined64KBSwizzle)
uint32_t QPitch; // Programmable QPitch (BDW+)
}GMM_RESOURCE_ALIGNMENT;
//===========================================================================
// typedef:
// GMM_PAGETABLE_MGR
//
// Description:
// This struct is used to describe page table manager.
// Forward Declaration: Defined in GmmPageTableMgr.h
//---------------------------------------------------------------------------
#ifdef __cplusplus
namespace GmmLib
{
class GmmPageTableMgr;
}
typedef GmmLib::GmmPageTableMgr GMM_PAGETABLE_MGR;
#else
typedef struct GmmPageTableMgr GMM_PAGETABLE_MGR;
#endif
#ifdef __cplusplus
namespace GmmLib
{
class Context;
} // namespace GmmLib
typedef GmmLib::Context GMM_LIB_CONTEXT;
#else
typedef struct GmmLibContext GMM_LIB_CONTEXT;
#endif
//===========================================================================
// typedef:
// GMM_RESOURCE_INFO
//
// Description:
// This struct is used to describe resource allocations.
// Forward Declaration: Defined in GmmResourceInfo*.h
//---------------------------------------------------------------------------
#ifdef __cplusplus
namespace GmmLib
{
#ifdef _WIN32
class GmmResourceInfoWin;
typedef GmmResourceInfoWin GmmResourceInfo;
#else
class GmmResourceInfoLin;
typedef GmmResourceInfoLin GmmResourceInfo;
#endif
}
typedef GmmLib::GmmResourceInfo GMM_RESOURCE_INFO;
typedef GmmLib::GmmResourceInfo GMM_RESOURCE_INFO_REC;
typedef GmmLib::GmmResourceInfo* PGMM_RESOURCE_INFO;
#else
typedef struct GmmResourceInfo GMM_RESOURCE_INFO;
typedef struct GmmResourceInfo* PGMM_RESOURCE_INFO;
#endif
//===========================================================================
// Place holder for GMM_RESOURCE_FLAG definition.
//---------------------------------------------------------------------------
#include "GmmResourceFlags.h"
#if defined __linux__
#include "External/Linux/GmmResourceInfoLinExt.h"
#endif
//==========================================================================
// typedef:
// GMM_S3D_OFFSET_INFO
//
// Description:
// Contains offset info for S3D resources.
//
//--------------------------------------------------------------------------
typedef struct GMM_S3D_OFFSET_INFO_REC
{
uint32_t AddressOffset;
uint32_t OffsetX;
uint32_t OffsetY;
uint32_t LineOffsetY;
} GMM_S3D_OFFSET_INFO;
//==========================================================================
// typedef:
// GMM_S3D_INFO
//
// Description:
// Describes properties of S3D feature.
//
//--------------------------------------------------------------------------
typedef struct GMM_S3D_INFO_REC
{
uint32_t DisplayModeHeight; // Current display mode resolution
uint32_t NumBlankActiveLines; // Number of blank lines
uint32_t RFrameOffset; // R frame offset
uint32_t BlankAreaOffset; // Blank area offset
uint32_t TallBufferHeight; // Tall buffer height
uint32_t TallBufferSize; // Tall buffer size
uint8_t IsRFrame; // Flag indicating this is the R frame
} GMM_S3D_INFO;
//===========================================================================
// typedef:
// GMM_MULTI_TILE_ARCH
//
// Description:
// This structure is provides an advanced allocation interface for 4xXeHP
// multi tile Gpu support
//---------------------------------------------------------------------------
typedef struct GMM_MULTI_TILE_ARCH_REC // FtrMultiTileArch Advanced Parameters...
{
uint8_t Enable : 1; // When FALSE, this struct is ignored
// and GMM will make such decisions
// based on the process's default
// tile assignment from KMD.
uint8_t TileInstanced : 1; // When TRUE allocation is Tile
// instanced resource
uint8_t GpuVaMappingSet; // Bitmask indicating which tiles
// should receive page table updates
// when this allocation is mapped.
// For all tiles set ADAPTER_INFO.MultiTileArch.TileMask
uint8_t LocalMemEligibilitySet; // Bitmask indicating which tile's
// Local Memory this allocation
// can reside in--i.e. in addition to
// its preferred set, which others
// can it be migrated to under memory
// pressure. Entirely zeroed mask
// would be used for NonLocalOnly
// allocations.
uint8_t LocalMemPreferredSet; // Bitmask indicating subset of above
// eligibility set that is preferred
// above the others. Entirely zeroed
// mask is equivalent to mask of all
// ones--i.e. "no preference within
// eligibility set".
uint32_t Reserved;
} GMM_MULTI_TILE_ARCH;
//===========================================================================
// typedef:
// GMM_RESCREATE_PARAMS
//
// Description:
// This structure is used to describe an resource allocation request.
// Please note that AllocationReuse makes use of member order.
// more info: oskl.h: AllocationReusePredicate and Functor
//---------------------------------------------------------------------------
typedef struct GMM_RESCREATE_PARAMS_REC
{
GMM_RESOURCE_TYPE Type; // 1D/2D/.../SCRATCH/...
GMM_RESOURCE_FORMAT Format; // Pixel format e.g. NV12, GENERIC_8BIT
GMM_RESOURCE_FLAG Flags; // See substructure type.
GMM_RESOURCE_MSAA_INFO MSAA; // How to sample this resource for anti-alisaing.
GMM_RESOURCE_USAGE_TYPE Usage; // Intended use for this resource. See enumerated type.
uint32_t CpTag;
union
{
uint32_t BaseWidth; // Aligned width of buffer (aligned according to .Format)
GMM_GFX_SIZE_T BaseWidth64;
// The HW buffer types, BUFFER and STRBUF, are arrays of user-defined
// struct's. Their natural sizing parameters are (1) the struct size
// and (2) the numer of array elements (i.e. the number of structs).
// However, the GMM allows these to be allocated in either of two ways:
// (1) Client computes total allocation size and passes via BaseWidth
// (leaving ArraySize 0), or (2) Client passes natural sizing parameters
// via BaseWidth and ArraySize. To make the latter more readable,
// clients can use the BaseWidth union alias, BufferStructSize (as well
// as the GmmResGetBaseWidth alias, GmmResGetBufferStructSize).
uint32_t BufferStructSize; // Note: If ever de-union'ing, mind the GmmResGetBufferStructSize #define.
};
uint32_t BaseHeight; // Aligned height of buffer (aligned according to .Format)
uint32_t Depth; // For 3D resources Depth>1, for 1D/2D, a default of 0 is uplifted to 1.
uint32_t MaxLod;
uint32_t ArraySize; // A number of n-dimensional buffers can be allocated together.
uint32_t BaseAlignment;
uint32_t OverridePitch;
#if(LHDM)
D3DDDI_RATIONAL DdiRefreshRate;
D3DDDI_RESOURCEFLAGS DdiD3d9Flags;
D3DDDIFORMAT DdiD3d9Format;
D3DDDI_VIDEO_PRESENT_SOURCE_ID DdiVidPnSrcId;
#endif
uint32_t RotateInfo;
uint64_t pExistingSysMem;
GMM_GFX_SIZE_T ExistingSysMemSize;
#ifdef _WIN32
D3DKMT_HANDLE hParentAllocation; //For ExistingSysMem Virtual Padding
#endif
#if __GMM_KMD__
uint32_t CpuAccessible; // Kernel mode clients set if CPU pointer to resource is required.
GMM_S3D_INFO S3d;
void *pDeviceContext;
#endif
uint32_t MaximumRenamingListLength;
uint8_t NoGfxMemory;
GMM_RESOURCE_INFO *pPreallocatedResInfo;
GMM_MULTI_TILE_ARCH MultiTileArch;
} GMM_RESCREATE_PARAMS;
typedef struct GMM_RESCREATE_CUSTOM_PARAMS__REC
{
GMM_RESOURCE_TYPE Type; // 1D/2D/.../SCRATCH/...
GMM_RESOURCE_FORMAT Format; // Pixel format e.g. NV12, GENERIC_8BIT
GMM_RESOURCE_FLAG Flags; // See substructure type.
GMM_RESOURCE_USAGE_TYPE Usage; // Intended use for this resource. See enumerated type.
GMM_GFX_SIZE_T BaseWidth64;
uint32_t BaseHeight; // Aligned height of buffer (aligned according to .Format)
uint32_t Pitch;
GMM_GFX_SIZE_T Size;
uint32_t BaseAlignment;
struct
{
uint32_t X[GMM_MAX_PLANE];
uint32_t Y[GMM_MAX_PLANE];
}PlaneOffset;
uint32_t NoOfPlanes;
uint32_t CpTag;
}GMM_RESCREATE_CUSTOM_PARAMS;
typedef union GMM_DRIVERPROTECTION_BITS
{
struct
{
uint64_t PATIndex : 5; // PATIndex
uint64_t Reserved : 25;
uint64_t CacheableNoSnoop: 1; // disregard OS's coherent request in UpdatePageTable
uint64_t CompressionEnReq: 1; // C/NC request from UMD
uint64_t Reserved1 : 32; //DO NOT SET !! Reserved for OS Refer: D3DGPU_UNIQUE_DRIVER_PROTECTION
};
uint64_t Value;
} GMM_DRIVERPROTECTION;
#ifndef __GMM_KMD__
typedef struct GMM_RESCREATE_CUSTOM_PARAMS_2_REC : public GMM_RESCREATE_CUSTOM_PARAMS
{
struct
{
uint32_t Pitch;
GMM_GFX_SIZE_T Size;
uint32_t BaseAlignment;
struct
{
uint32_t X[GMM_MAX_PLANE];
uint32_t Y[GMM_MAX_PLANE];
} PlaneOffset;
} AuxSurf;
uint64_t Reserved;
uint64_t Reserved1;
}GMM_RESCREATE_CUSTOM_PARAMS_2;
#endif
typedef struct GMM_OVERRIDE_VALUES_REC
{
uint32_t Usage; // GMM_RESOURCE_USAGE_TYPE
uint8_t CompressionDis;
} GMM_OVERRIDE_VALUES;
//===========================================================================
// enum :
// GMM_UNIFIED_AUX_TYPE
//
// Description:
// This enumarates various aux surface types in a unified
// auxiliary surface
//---------------------------------------------------------------------------
// Usage :
// UMD client use this enum to request the aux offset and size.
// using via GmmResGetAuxSurfaceOffset, GmmResGetSizeAuxSurface
//
// RT buffer with Clear Color
// ________________________________________________
// | |
// | |
// | |
// | Pixel Data |
// | |
// | |
// | |
// | |
// | |
// | |
// A | |
// -->|________________________________________________|
// | | |
// | | |
// | Tag plane | |
// | (a.k.a mcs, aux-plane,ccs) | ------------|->GmmResGetSizeAuxSurface(pRes, GMM_AUX_CCS)
// | | |
// -->|__________________________________| |
// B | CC FV | CC NV | ------------------------------|--->GmmResGetSizeAuxSurface(pRes, GMM_AUX_CC)
// |_______|________| |
// | |
// | |
// | Padded to Main Surf's(TileHeight & SurfPitch)| --> Padding needed for Global GTT aliasing
// -->|________________________________________________|
// C | |
// | Tag plane |
// | for MSAA/Depth compr |
// | (a.k.a ccs, zcs) ------------|->GmmResGetSizeAuxSurface(pRes, GMM_AUX_CCS or GMM_AUX_ZCS)
// |________________________________________________|
//
// Where
// FV. Clear color Float Value
// NV. Clear color Native Value
// A. GmmResGetAuxSurfaceOffset(pRes, GMM_AUX_CCS)
// B. GmmResGetAuxSurfaceOffset(pRes, GMM_AUX_CC)
// C. GmmResGetAuxSurfaceOffset(pRes, GMM_AUX_CCS or GMM_AUX_ZCS)
typedef enum
{
GMM_AUX_INVALID, // Main resource
GMM_AUX_CCS, // RT buffer's color control surface (Unpadded)
GMM_AUX_Y_CCS, // color control surface for Y-plane
GMM_AUX_UV_CCS, // color control surface for UV-plane
GMM_AUX_CC, // clear color value (4kb granularity)
GMM_AUX_COMP_STATE, // Media compression state (cacheline aligned 64B)
GMM_AUX_HIZ, // HiZ surface for unified Depth buffer
GMM_AUX_MCS, // multi-sample control surface for unified MSAA
GMM_AUX_ZCS, // CCS for Depth Z compression
GMM_AUX_SURF // Total Aux Surface (CCS + CC + Padding)
} GMM_UNIFIED_AUX_TYPE;
//===========================================================================
// enum :
// GMM_SIZE_PARAM
//
// Description:
// This enumarates various surface size parameters available for GetSize query.
// Refer GmmResourceInfoCommon.h GetSize() api
//
// Note:
// Below legacy API to query surface size are deprecated and will be removed in
// later gmm releases.
// - GmmResGetSizeSurface()/ pResInfo->GetSizeSurface()
// - GmmResGetSizeMainSurface()/ pResInfo->GetSizeAllocation()
// - GmmResGetSizeAllocation()/ pResInfo->GetSizeMainSurface()
//---------------------------------------------------------------------------
// Usage :
// UMD client use this enum to request the surface size.
//===========================================================================
typedef enum
{
GMM_INVALID_PARAM, // Leave 0 as invalid to force client to explictly set
GMM_MAIN_SURF, // Main surface size(w/o aux data)
GMM_MAIN_PLUS_AUX_SURF, // Main surface plus auxilary data, includes ccs, cc, zcs, mcs metadata. Renderable portion of the surface.
GMM_TOTAL_SURF, // Main+Aux with additional padding based on hardware PageSize.
GMM_MAPGPUVA_SIZE = GMM_TOTAL_SURF,// To be used for mapping gpu virtual address space.
GMM_TOTAL_SURF_PHYSICAL,
GMM_MAIN_SURF_PHYSICAL,
} GMM_SIZE_PARAM;
//===========================================================================
// typedef:
// GMM_RES_COPY_BLT
//
// Description:
// Describes a GmmResCpuBlt operation.
//---------------------------------------------------------------------------
typedef struct GMM_RES_COPY_BLT_REC
{
struct // GPU Surface Description...
{
void *pData; // Pointer to base of the mapped resource data (e.g. D3DDDICB_LOCK.pData).
uint32_t Slice; // Array/Volume Slice or Cube Face; zero if N/A.
uint32_t MipLevel; // Index of applicable MIP, or zero if N/A.
//uint32_t MsaaSample; // Index of applicable MSAA sample, or zero if N/A.
uint32_t OffsetX; // Pixel offset from left-edge of specified (Slice/MipLevel) subresource.
uint32_t OffsetY; // Pixel row offset from top of specified subresource.
uint32_t OffsetSubpixel; // Byte offset into the surface pixel of the applicable subpixel.
} Gpu; // Surface description of GPU resource involved in BLT.
struct // System Surface Description...
{
void *pData; // Pointer to system memory surface.
uint32_t RowPitch; // Row pitch in bytes of pData surface.
uint32_t SlicePitch; // Slice pitch in bytes of pData surface; ignored if Blt.Slices <= 1.
uint32_t PixelPitch; // Number of bytes from one pData pixel to its horizontal neighbor; 0 = "Same as GPU Resource".
//uint32_t MsaaSamplePitch;// Number of bytes from one pData MSAA sample to the next; ignored if Blt.MsaaSamples <= 1.
uint32_t BufferSize; // Number of bytes at pData. (Value used only in asserts to catch overuns.)
} Sys; // Description of system memory surface being BLT'ed to/from the GPU surface.
struct // BLT Description...
{
uint32_t Width; // Copy width in pixels; 0 = "Full Width" of specified subresource.
uint32_t Height; // Copy height in pixel rows; 0 = "Full Height" of specified subresource.
uint32_t Slices; // Number of slices being copied; 0 = 1 = "N/A or single slice".
uint32_t BytesPerPixel; // Number of bytes to copy, per pixel; 0 = "Same as Sys.PixelPitch".
//uint32_t MsaaSamples; // Number of samples to copy per pixel; 0 = 1 = "N/A or single sample".
uint8_t Upload; // true = Sys-->Gpu; false = Gpu-->Sys.
} Blt; // Description of the BLT being performed.
} GMM_RES_COPY_BLT;
//===========================================================================
// typedef:
// GMM_GET_MAPPING
//
// Description:
// GmmResGetMappingSpanDesc interface and inter-call state.
//---------------------------------------------------------------------------
typedef enum
{
GMM_MAPPING_NULL = 0,
GMM_MAPPING_LEGACY_Y_TO_STDSWIZZLE_SHAPE,
GMM_MAPPING_GEN9_YS_TO_STDSWIZZLE,
GMM_MAPPING_YUVPLANAR,
GMM_MAPPING_YUVPLANAR_AUX,
} GMM_GET_MAPPING_TYPE;
typedef struct GMM_GET_MAPPING_REC
{
GMM_GET_MAPPING_TYPE Type;
struct
{
GMM_GFX_SIZE_T VirtualOffset;
GMM_GFX_SIZE_T PhysicalOffset;
GMM_GFX_SIZE_T Size;
} Span, __NextSpan;
struct
{
struct
{
uint32_t Width, Height, Depth; // in Uncompressed Pixels
} Element, Tile;
struct
{
GMM_GFX_SIZE_T Physical, Virtual;
} Slice0MipOffset, SlicePitch;
uint32_t EffectiveLodMax, Lod, Row, RowPitchVirtual, Rows, Slice, Slices;
GMM_YUV_PLANE Plane, LastPlane;
} Scratch; // Zero on initial call to GmmResGetMappingSpanDesc and then let persist.
} GMM_GET_MAPPING;
//***************************************************************************
//
// GMM_RESOURCE_INFO API
//
//***************************************************************************
uint8_t GMM_STDCALL GmmIsPlanar(GMM_RESOURCE_FORMAT Format);
uint8_t GMM_STDCALL GmmIsP0xx(GMM_RESOURCE_FORMAT Format);
uint8_t GMM_STDCALL GmmIsUVPacked(GMM_RESOURCE_FORMAT Format);
bool GMM_STDCALL GmmIsYUVFormatLCUAligned(GMM_RESOURCE_FORMAT Format);
#define GmmIsYUVPlanar GmmIsPlanar // TODO(Benign): Support old name until we have a chance to correct in UMD(s) using this. No longer YUV since there are now RGB planar formats.
uint8_t GMM_STDCALL GmmIsReconstructableSurface(GMM_RESOURCE_FORMAT Format);
uint8_t GMM_STDCALL GmmIsCompressed(void *pLibContext, GMM_RESOURCE_FORMAT Format);
uint8_t GMM_STDCALL GmmIsYUVPacked(GMM_RESOURCE_FORMAT Format);
uint8_t GMM_STDCALL GmmIsRedecribedPlanes(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResApplyExistingSysMem(GMM_RESOURCE_INFO *pGmmResource, void *pExistingSysMem, GMM_GFX_SIZE_T ExistingSysMemSize);
uint8_t GMM_STDCALL GmmGetLosslessCompressionType(void *pLibContext, GMM_RESOURCE_FORMAT Format);
GMM_RESOURCE_INFO* GMM_STDCALL GmmResCopy(GMM_RESOURCE_INFO *pGmmResource);
void GMM_STDCALL GmmResMemcpy(void *pDst, void *pSrc);
uint8_t GMM_STDCALL GmmResCpuBlt(GMM_RESOURCE_INFO *pGmmResource, GMM_RES_COPY_BLT *pBlt);
GMM_RESOURCE_INFO *GMM_STDCALL GmmResCreate(GMM_RESCREATE_PARAMS *pCreateParams, GMM_LIB_CONTEXT *pLibContext);
void GMM_STDCALL GmmResFree(GMM_RESOURCE_INFO *pGmmResource);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeMainSurface(const GMM_RESOURCE_INFO *pResourceInfo);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeSurface(GMM_RESOURCE_INFO *pResourceInfo);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeAllocation(GMM_RESOURCE_INFO *pResourceInfo);
uint32_t GMM_STDCALL GmmResGetArraySize(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetAuxBitsPerPixel(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetAuxPitch(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetAuxQPitch(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResIs64KBPageSuitable(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetAuxSurfaceOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetAuxSurfaceOffset64(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeAuxSurface(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType);
uint32_t GMM_STDCALL GmmResGetAuxHAlign(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetAuxVAlign(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetBaseAlignment(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetBaseHeight(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetBaseWidth(GMM_RESOURCE_INFO *pGmmResource);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetBaseWidth64(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetBitsPerPixel(GMM_RESOURCE_INFO *pGmmResource);
#define GmmResGetBufferStructSize GmmResGetBaseWidth // See GMM_RESCREATE_PARAMS.BufferStructSize comment.
uint32_t GMM_STDCALL GmmResGetCompressionBlockDepth(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetCompressionBlockHeight(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetCompressionBlockWidth(GMM_RESOURCE_INFO *pGmmResource);
GMM_CPU_CACHE_TYPE GMM_STDCALL GmmResGetCpuCacheType(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetDepth(GMM_RESOURCE_INFO *pGmmResource);
void GMM_STDCALL GmmResGetFlags(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_FLAG *pFlags /*output*/); //TODO: Remove after changing all UMDs
GMM_RESOURCE_FLAG GMM_STDCALL GmmResGetResourceFlags(const GMM_RESOURCE_INFO *pGmmResource);
GMM_GFX_ADDRESS GMM_STDCALL GmmResGetGfxAddress(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetHAlign(GMM_RESOURCE_INFO *pGmmResource);
#define GmmResGetLockPitch GmmResGetRenderPitch // Support old name until UMDs drop use.
uint8_t GMM_STDCALL GmmResGetMappingSpanDesc(GMM_RESOURCE_INFO *pGmmResource, GMM_GET_MAPPING *pMapping);
uint32_t GMM_STDCALL GmmResGetMaxLod(GMM_RESOURCE_INFO *pGmmResource);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetStdLayoutSize(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetSurfaceStateMipTailStartLod(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetSurfaceStateTileAddressMappingMode(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetSurfaceStateStdTilingModeExt(GMM_RESOURCE_INFO *pGmmResource);
GMM_RESOURCE_MMC_INFO GMM_STDCALL GmmResGetMmcMode(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex);
uint32_t GMM_STDCALL GmmResGetNumSamples(GMM_RESOURCE_INFO *pGmmResource);
GMM_STATUS GMM_STDCALL GmmResGetOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_REQ_OFFSET_INFO *pReqInfo);
GMM_STATUS GMM_STDCALL GmmResGetOffsetFor64KBTiles(GMM_RESOURCE_INFO *pGmmResource, GMM_REQ_OFFSET_INFO *pReqInfo);
uint32_t GMM_STDCALL GmmResGetPaddedHeight(GMM_RESOURCE_INFO *pGmmResource, uint32_t MipLevel);
uint32_t GMM_STDCALL GmmResGetPaddedWidth(GMM_RESOURCE_INFO *pGmmResource, uint32_t MipLevel);
uint32_t GMM_STDCALL GmmResGetPaddedPitch(GMM_RESOURCE_INFO *pGmmResource, uint32_t MipLevel);
void* GMM_STDCALL GmmResGetPrivateData(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetQPitch(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetQPitchPlanar(GMM_RESOURCE_INFO *pGmmResource, GMM_YUV_PLANE Plane);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetQPitchInBytes(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetRenderAuxPitchTiles(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetRenderPitch(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetRenderPitchIn64KBTiles(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetRenderPitchTiles(GMM_RESOURCE_INFO *pGmmResource);
GMM_RESOURCE_FORMAT GMM_STDCALL GmmResGetResourceFormat(GMM_RESOURCE_INFO *pGmmResource);
GMM_RESOURCE_TYPE GMM_STDCALL GmmResGetResourceType(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetRotateInfo(GMM_RESOURCE_INFO *pGmmResource);
GMM_MSAA_SAMPLE_PATTERN GMM_STDCALL GmmResGetSamplePattern(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetSizeOfStruct(void);
GMM_SURFACESTATE_FORMAT GMM_STDCALL GmmResGetSurfaceStateFormat(GMM_RESOURCE_INFO *pGmmResource);
GMM_SURFACESTATE_FORMAT GMM_STDCALL GmmGetSurfaceStateFormat(GMM_RESOURCE_FORMAT Format,GMM_LIB_CONTEXT* pGmmLibContext);
uint32_t GMM_STDCALL GmmResGetSurfaceStateHAlign(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetSurfaceStateVAlign(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetSurfaceStateTiledResourceMode(GMM_RESOURCE_INFO *pGmmResource);
void* GMM_STDCALL GmmResGetSystemMemPointer(GMM_RESOURCE_INFO *pGmmResource, uint8_t IsD3DDdiAllocation);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSystemMemSize( GMM_RESOURCE_INFO* pRes );
uint32_t GMM_STDCALL GmmResGetTallBufferHeight(GMM_RESOURCE_INFO *pResourceInfo);
uint32_t GMM_STDCALL GmmResGetMipHeight(GMM_RESOURCE_INFO *pResourceInfo, uint32_t MipLevel);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetMipWidth(GMM_RESOURCE_INFO *pResourceInfo, uint32_t MipLevel);
uint32_t GMM_STDCALL GmmResGetMipDepth(GMM_RESOURCE_INFO *pResourceInfo, uint32_t MipLevel);
uint8_t GMM_STDCALL GmmResGetCornerTexelMode(GMM_RESOURCE_INFO *pGmmResource);
GMM_TEXTURE_LAYOUT GMM_STDCALL GmmResGetTextureLayout(GMM_RESOURCE_INFO *pGmmResource);
GMM_TILE_TYPE GMM_STDCALL GmmResGetTileType(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetVAlign(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResIsArraySpacingSingleLod(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResIsASTC(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResIsLockDiscardCompatible(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResIsMediaMemoryCompressed(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex);
uint8_t GMM_STDCALL GmmResIsMsaaFormatDepthStencil(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResIsSvm(GMM_RESOURCE_INFO *pGmmResource);
void GMM_STDCALL GmmResSetMmcMode(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_MMC_INFO Mode, uint32_t ArrayIndex);
void GMM_STDCALL GmmResSetMmcHint(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_MMC_HINT Hint, uint32_t ArrayIndex);
GMM_RESOURCE_MMC_HINT GMM_STDCALL GmmResGetMmcHint(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex);
uint8_t GMM_STDCALL GmmResIsColorSeparation(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResTranslateColorSeparationX(GMM_RESOURCE_INFO *pGmmResource, uint32_t x);
uint32_t GMM_STDCALL GmmResGetColorSeparationArraySize(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetColorSeparationPhysicalWidth(GMM_RESOURCE_INFO *pGmmResource);
uint8_t GMM_STDCALL GmmResGetSetHardwareProtection(GMM_RESOURCE_INFO *pGmmResource, uint8_t GetIsEncrypted, uint8_t SetIsEncrypted);
uint32_t GMM_STDCALL GmmResGetMaxGpuVirtualAddressBits(GMM_RESOURCE_INFO *pGmmResource, GMM_LIB_CONTEXT* pGmmLibContext);
uint8_t GMM_STDCALL GmmIsSurfaceFaultable(GMM_RESOURCE_INFO *pGmmResource);
uint32_t GMM_STDCALL GmmResGetMaximumRenamingListLength(GMM_RESOURCE_INFO* pGmmResource);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetPlanarGetXOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_YUV_PLANE Plane);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetPlanarGetYOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_YUV_PLANE Plane);
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetPlanarAuxOffset(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex, GMM_UNIFIED_AUX_TYPE Plane);
void GMM_STDCALL GmmResSetLibContext(GMM_RESOURCE_INFO *pGmmResource, void *pLibContext);
uint32_t GMM_STDCALL GmmResIsMappedCompressible(GMM_RESOURCE_INFO *pGmmResource);
// Remove when client moves to new interface
uint32_t GMM_STDCALL GmmResGetRenderSize(GMM_RESOURCE_INFO *pResourceInfo);
uint8_t GMM_STDCALL GmmGetCompressionFormat(GMM_RESOURCE_FORMAT Format, GMM_LIB_CONTEXT *pGmmLibContext);
//=====================================================================================================
//forward declarations
struct GMM_TEXTURE_INFO_REC;
// Hack to define and undefine typedef name to avoid redefinition of the
// typedef. Part 1.
// typedef struct GMM_TEXTURE_INFO_REC GMM_TEXTURE_INFO;
#define GMM_TEXTURE_INFO struct GMM_TEXTURE_INFO_REC
// TODO: Allows UMD to override some parameters. Remove these functions once GMM comprehends UMD usage model and
// can support them properly.
void GMM_STDCALL GmmResOverrideAllocationSize(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T Size);
void GMM_STDCALL GmmResOverrideAllocationPitch(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T Pitch);
void GMM_STDCALL GmmResOverrideAuxAllocationPitch(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T Pitch);
void GMM_STDCALL GmmResOverrideAllocationFlags(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_FLAG *pFlags);
void GMM_STDCALL GmmResOverrideAllocationHAlign(GMM_RESOURCE_INFO *pGmmResource, uint32_t HAlign);
void GMM_STDCALL GmmResOverrideAllocationBaseAlignment(GMM_RESOURCE_INFO *pGmmResource, uint32_t Alignment);
void GMM_STDCALL GmmResOverrideAllocationBaseWidth(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T BaseWidth);
void GMM_STDCALL GmmResOverrideAllocationBaseHeight(GMM_RESOURCE_INFO *pGmmResource, uint32_t BaseHeight);
void GMM_STDCALL GmmResOverrideAllocationDepth(GMM_RESOURCE_INFO *pGmmResource, uint32_t Depth);
void GMM_STDCALL GmmResOverrideResourceTiling(GMM_RESOURCE_INFO *pGmmResource, uint32_t TileMode);
void GMM_STDCALL GmmResOverrideAuxResourceTiling(GMM_RESOURCE_INFO *pGmmResource, uint32_t TileMode);
void GMM_STDCALL GmmResOverrideAllocationTextureInfo(GMM_RESOURCE_INFO *pGmmResource, GMM_CLIENT Client, const GMM_TEXTURE_INFO *pTexInfo);
void GMM_STDCALL GmmResOverrideAllocationFormat(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_FORMAT Format);
void GMM_STDCALL GmmResOverrideSurfaceType(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_TYPE ResourceType);
void GMM_STDCALL GmmResOverrideSvmGfxAddress(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_ADDRESS SvmGfxAddress);
void GMM_STDCALL GmmResOverrideAllocationArraySize(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArraySize);
void GMM_STDCALL GmmResOverrideAllocationMaxLod(GMM_RESOURCE_INFO *pGmmResource, uint32_t MaxLod);
//////////////////////////////////////////////////////////////////////////////////////
// GmmCachePolicy.c
//////////////////////////////////////////////////////////////////////////////////////
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL GmmCachePolicyGetMemoryObject(void *pLibContext,
GMM_RESOURCE_INFO *pResInfo,
GMM_RESOURCE_USAGE_TYPE Usage);
GMM_PTE_CACHE_CONTROL_BITS GMM_STDCALL GmmCachePolicyGetPteType(void *pLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
GMM_RESOURCE_USAGE_TYPE GMM_STDCALL GmmCachePolicyGetResourceUsage(GMM_RESOURCE_INFO *pResInfo );
MEMORY_OBJECT_CONTROL_STATE GMM_STDCALL GmmCachePolicyGetOriginalMemoryObject(void *pLibContext, GMM_RESOURCE_INFO *pResInfo);
uint8_t GMM_STDCALL GmmCachePolicyIsUsagePTECached(void *pLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
uint8_t GMM_STDCALL GmmGetSurfaceStateL1CachePolicy(void *pLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
void GMM_STDCALL GmmCachePolicyOverrideResourceUsage(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE Usage);
uint32_t GMM_STDCALL GmmCachePolicyGetMaxMocsIndex(void *pLibContext);
uint32_t GMM_STDCALL GmmCachePolicyGetMaxL1HdcMocsIndex(void *pLibContext);
uint32_t GMM_STDCALL GmmCachePolicyGetMaxSpecialMocsIndex(void *pLibContext);
void GMM_STDCALL GmmResSetPrivateData(GMM_RESOURCE_INFO *pGmmResource, void *pPrivateData);
uint32_t GMM_STDCALL GmmCachePolicyGetPATIndex(void *pLibContext, GMM_RESOURCE_USAGE_TYPE Usage, bool *pCompressionEnable, bool IsCpuCacheable);
uint8_t GMM_STDCALL GmmGetSurfaceStateL2CachePolicy(void *pLibContext, GMM_RESOURCE_USAGE_TYPE Usage);
#if (!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper functions for UMD clients Translation layer from OLD GMM APIs to New
/// unified GMM Lib APIs
/////////////////////////////////////////////////////////////////////////////////////
GMM_STATUS GmmCreateGlobalClientContext(GMM_CLIENT ClientType);
void GmmDestroyGlobalClientContext();
GMM_RESOURCE_INFO* GmmResCreateThroughClientCtxt(GMM_RESCREATE_PARAMS *pCreateParams);
void GmmResFreeThroughClientCtxt(GMM_RESOURCE_INFO *pRes);
GMM_RESOURCE_INFO* GmmResCopyThroughClientCtxt(GMM_RESOURCE_INFO* pSrcRes);
void GmmResMemcpyThroughClientCtxt(void *pDst, void *pSrc);
#endif
// Hack to define and undefine typedef name to avoid redefinition of the
// typedef. Part 2.
#undef GMM_TEXTURE_INFO
// Reset packing alignment to project default
#pragma pack(pop)
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,251 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
// Set packing alignment
#pragma pack(push, 8)
#define GMM_MAX_MIPMAP 15
#define GMM_MAX_MMC_INDEX 64
//===========================================================================
// typedef:
// GMM_PLANAR_OFFSET_INFO
//
// Description:
// This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_PLANAR_OFFSET_INFO_REC
{
GMM_GFX_SIZE_T ArrayQPitch;
GMM_GFX_SIZE_T X[GMM_MAX_PLANE];
GMM_GFX_SIZE_T Y[GMM_MAX_PLANE];
struct
{
GMM_GFX_SIZE_T Height[GMM_MAX_PLANE];
} UnAligned, Aligned;
uint32_t NoOfPlanes;
bool IsTileAlignedPlanes;
}GMM_PLANAR_OFFSET_INFO;
//===========================================================================
// typedef:
// GMM_PLANAR_OFFSET_INFO
//
// Description:
// This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_PLANAR_OFFSET_INFO_V2_REC
{
GMM_GFX_SIZE_T ArrayQPitch;
GMM_GFX_SIZE_T X[GMM_MAX_PLANE];
GMM_GFX_SIZE_T Y[GMM_MAX_PLANE];
struct
{
uint32_t Height[GMM_MAX_PLANE];
} UnAligned, Aligned, Physical;
uint32_t NoOfPlanes;
bool IsTileAlignedPlanes;
bool Is1MBAuxTAlignedPlanes;
GMM_GFX_SIZE_T PhysicalPitch;
} GMM_PLANAR_OFFSET_INFO_V2;
//===========================================================================
// typedef:
// GMM_2D_TEXTURE_OFFSET_INFO
//
// Description:
// This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_2D_TEXTURE_OFFSET_INFO_REC
{
GMM_GFX_SIZE_T ArrayQPitchLock;
GMM_GFX_SIZE_T ArrayQPitchRender;
GMM_GFX_SIZE_T Offset[GMM_MAX_MIPMAP];
}GMM_2D_TEXTURE_OFFSET_INFO_T;
//===========================================================================
// typedef:
// GMM_3D_TEXTURE_OFFSET_INFO
//
// Description:
// This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_3D_TEXTURE_OFFSET_INFO_REC
{
GMM_GFX_SIZE_T Mip0SlicePitch;
GMM_GFX_SIZE_T Offset[GMM_MAX_MIPMAP];
}GMM_3D_TEXTURE_OFFSET_INFO_T;
//===========================================================================
// typedef:
// GMM_OFFSET_INFO
//
// Description:
// This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_OFFSET_INFO_REC
{
union
{
GMM_3D_TEXTURE_OFFSET_INFO_T Texture3DOffsetInfo;
GMM_2D_TEXTURE_OFFSET_INFO_T Texture2DOffsetInfo;
GMM_PLANAR_OFFSET_INFO Plane;
GMM_PLANAR_OFFSET_INFO_V2 PlaneXe_LPG;
};
}GMM_OFFSET_INFO, GMM_OFFSET_INFO_T;
//===========================================================================
// typedef:
// GMM_TEXTURE_CALC
//
// Description:
// This struct is used to texture calculator.
// Forward Declaration: Defined in GmmGenXXTextureCalc*.h
//---------------------------------------------------------------------------
#ifdef __cplusplus
namespace GmmLib
{
class GmmTextureCalc;
}
typedef GmmLib::GmmTextureCalc GMM_TEXTURE_CALC;
#else
struct GmmTextureCalc;
typedef struct GmmTextureCalc GMM_TEXTURE_CALC;
#endif
//===========================================================================
// typedef:
// GMM_TEXTURE_INFO_REC
//
// Description:
// This structure used to request mipmap offset information
//---------------------------------------------------------------------------
typedef struct GMM_TEXTURE_INFO_REC
{
// Input ----------------------------------
GMM_RESOURCE_TYPE Type;
GMM_RESOURCE_FORMAT Format;
uint32_t BitsPerPixel;
GMM_RESOURCE_FLAG Flags;
uint64_t BaseWidth;
uint32_t BaseHeight;
uint32_t Depth;
uint32_t MaxLod;
uint32_t ArraySize;
uint32_t CpTag;
struct{
GMM_RESOURCE_USAGE_TYPE Usage;
} CachePolicy;
GMM_RESOURCE_MSAA_INFO MSAA;
// Output ---------------------------------
GMM_RESOURCE_ALIGNMENT Alignment;
uint8_t MmcMode[GMM_MAX_MMC_INDEX];
uint8_t MmcHint[GMM_MAX_MMC_INDEX];
GMM_GFX_SIZE_T Pitch;
GMM_GFX_SIZE_T OverridePitch; // VirtualPadding
GMM_GFX_SIZE_T Size; // For AuxSurf Size = CCS + CC + Padding
GMM_GFX_SIZE_T CCSize; // 4kb => 128 bit Float + 32bit Native RT + Padding. Usage : Gpu.IndirectClearColor
GMM_GFX_SIZE_T UnpaddedSize; // Unpadded CCS Size for Flags.Gpu.UnifiedAuxSurface only
GMM_GFX_SIZE_T SizeReportToOS; // For Non-aligned ESM
GMM_OFFSET_INFO OffsetInfo; // (X,Y) offsets to each mipmap/plane
GMM_TILE_MODE TileMode;
uint32_t CCSModeAlign; // For AUX_CCS, TexAlign.CCSEx index derived from main surface tiling
uint32_t LegacyFlags;
GMM_S3D_INFO S3d;
#if(LHDM)
D3DDDIFORMAT MsFormat;
#endif
struct{
uint32_t Seg1 : 8;
uint32_t Evict : 8;
} SegmentOverride; // Used for tuning the Vista driver
uint32_t MaximumRenamingListLength;
#if(_DEBUG || _RELEASE_INTERNAL)
PLATFORM Platform;
#else
PLATFORM __Platform; // Do not use--For size preservation only.
#endif
struct{
uint8_t IsGmmAllocated;
uint8_t IsPageAligned;
} ExistingSysMem;
}GMM_TEXTURE_INFO;
//***************************************************************************
//
// GMM_TEXTURE API
//
//***************************************************************************
#if(defined(__GMM_KMD__))
GMM_STATUS GmmTexAlloc(GMM_LIB_CONTEXT *pGmmLibContext, GMM_TEXTURE_INFO* pTexInfo);
GMM_STATUS GmmTexLinearCCS(GMM_LIB_CONTEXT *pGmmLibContext, GMM_TEXTURE_INFO* pTexInfo, GMM_TEXTURE_INFO *pAuxTexInfo);
#endif
GMM_STATUS GmmTexGetMipMapOffset(GMM_TEXTURE_INFO* pTexInfo, GMM_REQ_OFFSET_INFO* pReqInfo , GMM_LIB_CONTEXT* pGmmLibContext);
#define GMM_ISNOT_TILED(TileInfo) ((TileInfo).LogicalSize == 0)
#define GMM_IS_TILED(TileInfo) ((TileInfo).LogicalSize > 0)
#define GMM_CLEAR_TILEINFO(TileInfo) \
{ \
(TileInfo).LogicalSize = 0; \
(TileInfo).LogicalTileHeight = 0; \
(TileInfo).LogicalTileWidth = 0; \
(TileInfo).MaxPitch = 0; \
}
#define GMM_IS_4KB_TILE(Flags) ((Flags).Info.TiledY || (Flags).Info.Tile4)
#define GMM_IS_64KB_TILE(Flags) (Flags.Info.TiledYs || Flags.Info.Tile64)
#define GMM_IS_SUPPORTED_BPP_ON_TILE_64_YF_YS(bpp) ((bpp == 8) || (bpp == 16) || (bpp == 32) || (bpp == 64) || (bpp == 128))
#define GMM_SET_4KB_TILE(Flags, Value,pGmmLibContext) if (pGmmLibContext->GetSkuTable().FtrTileY) ((Flags).Info.TiledY = (Value)); else ((Flags).Info.Tile4 = (Value))
#define GMM_SET_64KB_TILE(Flags, Value,pGmmLibContext) if (pGmmLibContext->GetSkuTable().FtrTileY) ((Flags).Info.TiledYs = (Value)); else ((Flags).Info.Tile64 = (Value))
#define GMM_SET_4KB_TILE_MODE(TileMode,pGmmLibContext) if (pGmmLibContext->GetSkuTable().FtrTileY) (TileMode = LEGACY_TILE_Y); else (TileMode = TILE4)
#define GMM_IS_TILEY(pGmmLibContext) (((GmmClientContext*)pClientContext)->GetSkuTable().FtrTileY)
// Reset packing alignment to project default
#pragma pack(pop)
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,109 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
//------------------------------------------------------------------------
// Size macros
//------------------------------------------------------------------------
#define GMM_BITS(a) (a)
#define GMM_BYTES(a) (a)
#define GMM_KBYTE(a) ((a) * 1024)
#define GMM_MBYTE(a) ((a) * 1024 * 1024)
#define GMM_GBYTE(a) (((uint64_t) 1024) * 1024 * 1024 * (a))
#define GMM_TBYTE(a) (((uint64_t) 1024) * 1024 * 1024 * 1024 * (a))
#define GMM_SCANLINES(a) (a)
#define GMM_DEPTH(a) (a)
#define GMM_PIXELS(a) (a)
#define GMM_BYTES_TO_MBYTES(a) ((a) / (1024*1024))
#define GMM_BYTES_TO_KBYTES(a) ((a) / 1024)
//------------------------------------------------------------------------
// Bit manipulation macros
//------------------------------------------------------------------------
#define __GMM_IS_ALIGN(A, B) (((A) % (B)) == 0)
#define __BIT(x) (1UL << (x))
#define __MASKED_BIT(x) (__BIT(x) | (__BIT(x) << 16))
#define __BIT64(x) ((uint64_t)1 << (x))
#define __GMM_SET_BIT(A, b) (A |= __BIT(b))
#define __GMM_CLEAR_BIT(A, b) (A &= ~__BIT(b))
#define __GMM_SET_BIT64(A, b) (A |= __BIT64(b))
#define __GMM_CLEAR_BIT64(A, b) (A &= ~__BIT64(b))
#define __GMM_IS_BIT_SET(A, b) (A & __BIT(b))
#define __GMM_IS_BIT_CLEAR(A, b) ((A & __BIT(b)) == 0)
#define __SET_VALUE(editDst, editMask, editShift, editValue) \
(editDst) = (((editDst) & ~(editMask)) |\
(((editValue) << (editShift)) & (editMask)))
#define GMM_UNREFERENCED_PARAMETER(param) ((void)(param))
#define GMM_UNREFERENCED_LOCAL_VARIABLE(debug_var) ((void)(debug_var))
//------------------------------------------------------------------------
// Escape macros
//------------------------------------------------------------------------
#define GMM_ESCAPE_D3D_SET_DEV_CTX(Escape, AdapterHandle, DeviceHandle) \
{ \
Escape.hContext = NULL; \
Escape.hDevice = DeviceHandle; \
}
#define GMM_CALL_D3D_ESCAPE(pfnEscape, hAdapter, Escape) (pfnEscape(hAdapter, &Escape))
#define GMM_ESCAPE_OGL_SET_DEV_CTX(Escape, AdapterHandle, DeviceHandle) \
{ \
Escape.hAdapter = (D3DKMT_HANDLE)(uintptr_t)AdapterHandle; \
Escape.hContext = (D3DKMT_HANDLE)(uintptr_t)NULL; \
Escape.hDevice = (D3DKMT_HANDLE)(uintptr_t)DeviceHandle; \
Escape.Type = D3DKMT_ESCAPE_DRIVERPRIVATE; \
}
#define GMM_CALL_OGL_ESCAPE(pfnEscape, hAdapter, Escape) (pfnEscape(&Escape))
#define __GMM_RANGE_IN_GMADR(RangeBase, RangeSize,pGmmLibContext) \
(((RangeBase) >= GmmGetGttContext(pGmmLibContext)->GfxAddrRange.Global.Base) && \
(((RangeBase) + (RangeSize)) <= \
(GmmGetGttContext(pGmmLibContext)->GfxAddrRange.Global.Base + \
GmmGetGttContext(pGmmLibContext)->GlobalGfxApertureSize)))
#define __GMM_RANGE_IN_GLOBAL_GTT_SPACE(RangeBase, RangeSize,pGmmLibContext) \
(((RangeBase) >= GmmGetGttContext(pGmmLibContext)->GfxAddrRange.Global.Base) && \
(((RangeBase) + (RangeSize)) <= \
(GmmGetGttContext(pGmmLibContext)->GfxAddrRange.Global.Base + \
GmmGetGttContext(pGmmLibContext)->GfxAddrRange.Global.Size)))
#define __GMM_RANGE_IN_PPGTT_SPACE(RangeBase, RangeSize,pGmmLibContext) \
(((RangeBase) >= GmmGetGttContext(pGmmLibContext)->GfxAddrRange.PP.Base) && \
(((RangeBase) + (RangeSize)) <= \
(GmmGetGttContext(pGmmLibContext)->GfxAddrRange.PP.Base + \
GmmGetGttContext(pGmmLibContext)->GfxAddrRange.PP.Size)))
#define GMM_INLINE __inline
#if(defined(__GMM_KMD__))
#define GMM_OVERRIDE_SIZE_64KB_ALLOC(pGmmLibContext) if(GmmGetSkuTable(pGmmLibContext)->FtrPpgtt64KBWalkOptimization){ return (this->GetSizeAllocation());}
#else
#define GMM_OVERRIDE_SIZE_64KB_ALLOC(pGmmLibContext) if(((GmmClientContext*)pClientContext)->GetSkuTable().FtrPpgtt64KBWalkOptimization){ return (this->GetSizeAllocation());}
#endif
#define ONE_WAY_COHERENT_COMPRESSION_MODE(Platform, WaNoCpuCoherentCompression) ((Platform >= IGFX_PTL) && (!WaNoCpuCoherentCompression))

View File

@ -0,0 +1,62 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
#include "../Common/GmmResourceInfoCommon.h"
/////////////////////////////////////////////////////////////////////////////////////
/// @file GmmResourceInfoLin.h
/// @brief This file contains the functions and members of GmmResourceInfo that is
/// Linux specific.
///
/////////////////////////////////////////////////////////////////////////////////////
namespace GmmLib
{
class GMM_LIB_API NON_PAGED_SECTION GmmResourceInfoLin:
public GmmResourceInfoCommon
{
public:
/* Constructors */
GmmResourceInfoLin()
{
}
#ifndef __GMM_KMD__
GmmResourceInfoLin(GmmClientContext *pClientContextIn) : GmmResourceInfoCommon(pClientContextIn)
{
}
#endif
virtual ~GmmResourceInfoLin()
{
}
};
typedef GmmResourceInfoLin GmmResourceInfo;
} // namespace GmmLib
#else
typedef struct GmmResourceInfo GmmResourceInfo;
#endif // #ifdef __cplusplus

View File

@ -0,0 +1,96 @@
/*==============================================================================
Copyright(c) 2019 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __linux__
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
typedef struct {
int(*pfnAllocate)(void *bufMgr, size_t size, size_t alignment, void **bo, void **cpuAddr, uint64_t *gpuAddr);
void(*pfnDeallocate)(void *bo);
void(*pfnWaitFromCpu)(void *bo);;
} GMM_DEVICE_CB_PTRS;
typedef struct _GMM_DEVICE_CALLBACKS_INT
{
void *pBufMgr;
GMM_DEVICE_CB_PTRS DevCbPtrs_;
} GMM_DEVICE_CALLBACKS_INT;
// Add the definition to compatible.
typedef struct GMM_TRANSLATIONTABLE_CALLBACKS_REC
{
int (*pfPrologTranslationTable)(void *pDeviceHandle);
int (*pfWriteL1Entries)(void *pDeviceHandle,
const uint32_t NumEntries,
GMM_GFX_ADDRESS GfxAddress,
uint32_t *Data);
int (*pfWriteL2L3Entry)(void *pDeviceHandle,
GMM_GFX_ADDRESS GfxAddress,
uint64_t Data);
int (*pfWriteFenceID)(void *pDeviceHandle,
GMM_GFX_ADDRESS GfxAddress,
uint64_t Data);
int (*pfEpilogTranslationTable)(void *pDeviceHandle,
uint8_t ForceFlush);
int (*pfCopyL1Entry)(void *pDeviceHandle,
GMM_GFX_ADDRESS DstGfxAddress,
GMM_GFX_ADDRESS SrcGfxAddress);
int (*pfWriteL3Adr)(void *pDeviceHandle,
GMM_GFX_ADDRESS L3GfxAddress,
uint64_t RegOffset);
} GMM_TRANSLATIONTABLE_CALLBACKS;
typedef struct _GMM_DEVICE_CALLBACKS
{
void *pBufferMgr;
int FuncDevice;
int(*pfnAllocate)(void *bufMgr, size_t size, size_t alignment, void **bo, void **cpuAddr, uint64_t *gpuAddr);
void(*pfnDeallocate)(void *bo);
void(*pfnWaitFromCpu)(void *bo);;
} GMM_DEVICE_CALLBACKS;
// This definition is only for code sharing.
typedef struct GMM_UMD_SYNCCONTEXT_REC
{
void *pCommandQueueHandle; // pointer to command queue handle
void *pUpdateGpuVaInfo;
HANDLE BBFenceObj; // BatchBuffer Last Fence, for CPU to wait on before destroying TT pages
uint64_t BBLastFence; // BatchBuffer Last Fence for TT
} GMM_UMD_SYNCCONTEXT;
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*__linux__*/

View File

@ -0,0 +1,68 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
#ifndef _WIN32
#include <portable_compiler.h>
#endif
#if defined(LHDM) && !defined(__GMM_KMD__) && defined(_WIN32)
#include <WINDOWS.h>
#include <d3d9Types.h>
#include <WTypesbase.h>
#include <d3dumddi.h>
#else
// Since we are compiled not for WinOS, we don't want to include later any Visual Studio specific files.
#define VER_H
#endif // LHDM
#include "../../inc/umKmInc/sharedata.h"
// GMM Lib Client Exports
#include "External/Common/GmmCommonExt.h"
#include "External/Common/GmmUtil.h"
#include "External/Common/GmmResourceFlags.h"
#include "External/Common/GmmCachePolicy.h"
#include "External/Common/GmmCachePolicyExt.h"
#include "External/Common/GmmResourceInfoExt.h"
#include "External/Common/GmmPlatformExt.h"
#include "External/Common/GmmTextureExt.h"
#include "External/Common/GmmInfoExt.h"
#include "External/Common/GmmResourceInfo.h"
#include "External/Common/GmmInfo.h"
#include "External/Common/GmmClientContext.h"
#include "External/Common/GmmPageTableMgr.h"
#include "External/Common/GmmLibDll.h"
#include "External/Common/GmmLibDllName.h"
#ifdef __cplusplus
}
#endif /*__cplusplus*/

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2018, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
#ifndef IGDGMM_H
#define IGDGMM_H
#define GMM_UMD_DLL "libigdgmm.so"
#endif /* IGDGMM_H */

View File

@ -0,0 +1,417 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#ifndef __GFXMACRO_H__
#define __GFXMACRO_H__
#include <limits.h>
#include <string.h> // for memcpy
#include <stdint.h>
// ### __GFXMACRO_ASSERT ######################################################
// Since an "always-callable" GFX_ASSERT/etc. is no longer really in-place,
// this file will define its own assert statement...
#if DBG
#define __GFXMACRO_ASSERT(Expression) \
{ \
if(!(Expression)) \
{ \
__debugbreak(); \
} \
} // __GFXMACRO_ASSERT ##################
#else // Release Build
#define __GFXMACRO_ASSERT(Expression)
#endif
//------------------------------------------------------------------------
// Useful constants.
#define GFX_ZERO (0.0f)
#define GFX_HALF (0.5f)
#define GFX_PI ((float) 3.14159265358979323846)
#define GFX_SQR_ROOT_OF_TWO ((float) 1.41421356237309504880)
#define GFX_E ((float) 2.7182818284590452354)
//------------------------------------------------------------------------
// !!! Many of these are macros (instead of functions) so 64-bit friendly (even on 32-bit builds)!!!
#define GFX_IS_ALIGNED(A, B) (((B) > 0) && (((A) % (B)) == 0))
#define GFX_ALIGN(x, a) (((x) + ((a) - 1)) - (((x) + ((a) - 1)) & ((a) - 1))) // Alt implementation with bitwise not (~) has issue with uint32 align used with 64-bit value, since ~'ed value will remain 32-bit.
#define GFX_ALIGN_FLOOR(x, a) ((x) - ((x) & ((a) - 1)))
#define GFX_ALIGN_NP2(x, a) (((a) > 0) ? ((x) + (((a) - 1) - (((x) + ((a) - 1)) % (a)))) : (x))
#define GFX_ALIGN_FLOOR_NP2(x, a) (((a) > 0) ? ((x) - ((x) % (a))) : (x))
#define GFX_MASK(lo,hi) ((1UL << (hi)) | \
((1UL << (hi)) - \
(1UL << (lo))))
#define GFX_MASK_LARGE(lo,hi) (((uint64_t)1 << (hi)) | \
(((uint64_t)1 << (hi)) - \
((uint64_t)1 << (lo))))
#define GFX_IS_POWER_OF_2(a) (((a) > 0) && !((a) & ((a) - 1)))
#define GFX_SWAP_VAR(a,b,t) (t=a, a=b, b=t)
#define GFX_SWAP_VAR3(a,b,c,t) (t=a, a=b, b=c, c=t)
#define GFX_UF_ROUND(a) ((uint32_t) ((a) + 0.5F))
#define GFX_F_ROUND(a) ((int32_t) ((a) + ((a) < 0 ? -0.5F : 0.5F)))
#define GFX_ABS(a) (((a) < 0) ? -(a) : (a))
#define GFX_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define GFX_MAX(a,b) (((a) > (b)) ? (a) : (b))
#define GFX_MIN3(a,b,c) (((a) < (b)) ? GFX_MIN((a), (c)) : GFX_MIN((b), (c)))
#define GFX_MAX3(a,b,c) (((a) > (b)) ? GFX_MAX((a), (c)) : GFX_MAX((b), (c)))
#define GFX_CEIL_DIV(a,b) (((b) > 0) ? (((a) + ((b) - 1)) / (b)) : (a))
#define GFX_SQ(a) ((a) * (a))
#define GFX_CLAMP_MIN_MAX(a,min,max) ((a) < (min) ? (min) : GFX_MIN ((a), (max)))
#define GFX_KB(k) ((k) * 1024)
#define GFX_MB(m) ((m) * 1024 * 1024)
//------------ Macros for setting and removing bits.
#define GFX_BIT(n) (1UL << (n))
#define GFX_BIT_ON(a,bit) ((a) |= (bit))
#define GFX_BIT_OFF(a,bit) ((a) &= ~(bit))
#define GFX_IS_BIT_SET(a,bit) ((a) & (bit))
//*****************************************************************************
// MACRO: GFX_BIT_RANGE
// PURPOSE: Calculates the number of bits between the startbit and the endbit
// and count is inclusive of both bits. The bits are 0 based.
//*****************************************************************************
#define GFX_BIT_RANGE(endbit, startbit) ((endbit)-(startbit)+1)
//------------ Macros for dealing with void pointers
#define GFX_VOID_PTR_INC(p,n) ((void *) ((char *)(p) + (n)))
#define GFX_VOID_PTR_DEC(p,n) ((void *) ((char *)(p) - (n)))
// While the difference of two pointers on a 64-bit machine can exceed
// 32-bits, it is mostly limited to 32-bits for the graphics driver. In
// order to avoid compilation warnings arising from assigning a 64-bit
// quantity to a 32-bit lvalue, we have two separate macros for obtaining
// pointer difference of two pointers.
#define GFX_VOID_PTR_DIFF(a,b) (int32_t) ((char *) (a) - (char *) (b))
#define GFX_VOID_PTR_DIFF_LARGE(a,b) ((char *) (a) - (char *) (b))
//------------ Bytes to page conversion
#define GFX_BYTES_TO_PAGES(b) (((b) + PAGE_SIZE - 1) / PAGE_SIZE)
#define GFX_PAGES_TO_BYTES(p) ((p) * PAGE_SIZE)
#define GFX_MEMSET(p,d,s) (memset(p, d, s))
#if DBG
#define GFX_ULONG_CAST(x) \
( \
((x) <= 0xffffffff) ? \
1 : __debugbreak(), \
(uint32_t)(x) \
)
#else // Release Build
#define GFX_ULONG_CAST(x) ((uint32_t)(x))
#endif
// Since hardware addresses are still 32 bits, we need a safe way
// to convert 64 bit pointers into 32 bit hardware addresses.
// ASSERT that the upper 32 bits are 0 before truncating address.
#define GFX_VOID_PTR_TO_ULONG(ptr) ((uint32_t)(ptr))
//------------------------------------------------------------------------
// FAST FLOAT-TO_LONG CONVERSION
//
// We can convert floats to integers quickly by adding a floating-point
// constant to an IEEE float so that the integer value of the IEEE float is
// found in the least significant bits of the sum. We add 2^23 + 2^22, and
// thus the number is represented in IEEE single-precision as
// 2^23*(1.1xxxxxxx), where the first 1 is the implied one, the second is 1 .
//
// This technique has several limitations:
// 1. It only works on values in the range [0,2^22-1].
// 2. It is subject to the processor rounding mode, which we assume to be
// "round to nearest (even)". In this rounding mode, the conversion
// yields round(x), not floor(x) as called for in C.
//
// It can be made to work on negative values with a little fixed point
// trickery by:
// result = ((LONG) (result ^ 0x00800000) << 8) >> 8,
//
// However, when the result is masked to a byte or a short and directly
// assigned to the right type, no sign extension is required.
//
// The macros for -ve numbers since we use a constant of "1100" in binary
// representation. The msb 1 is force it to be the implicit bit. The next
// 1 is used for -ve numbers which will force other bits to be FFF..
//
// which flips and then smears the sign bit into the rest of the number. The
// intermediate values must be signed, so we do an arithmetic (fill with sign
// bit) instead of logical shift.
//
// We approximate the floor operation by subtracting off 0.5 before doing the
// round. This would work perfectly except that the processor breaks ties in
// rounding be selecting the even value. Thus, we compute floor(1.0) as
// round(0.5) = 0! Not good -- the caller must be careful to use
// __GL_FLOAT_TO_LONG_TRUNC only in cases where he can live with this
// behavior.
#define GFX_FLOAT_TO_LONG_ROUND(ux,x,mask) \
{ \
float fx; \
\
fx = x; \
fx += 0x00C00000; \
ux = mask & *(uint32_t *) &fx; \
}
#define GFX_FLOAT_TO_LONG_TRUNC(ux,x,mask) \
{ \
float fx; \
\
fx = x - GFX_HALF; \
fx += 0x00C00000; \
ux = mask & *(uint32_t *) &fx; \
}
// Note: Double has 1 sign bit, 11 exponent and 52 mantissa bits.
// We need to add the following constant for fast conversion
//
// fx += (__LONG64) 0x18000000000000;
//
// This is done in a portable/decipherable manner through
// multiplications which are collapsed by the compiler at compile time.
#define GFX_DOUBLE_TO_LONG_ROUND(ux,x,mask) \
{ \
double fx; \
\
fx = x; \
fx += 24.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 256; \
ux = mask & *(uint32_t *) &fx; \
}
#define GFX_DOUBLE_TO_LONG_TRUNC(ux,x,mask) \
{ \
double fx; \
\
fx = x - GFX_HALF; \
fx += 24.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 256; \
ux = mask & *(uint32_t *) &fx; \
}
#if __DEFINE_PROTO || defined __GFX_MACRO_C__
extern uint32_t GFX_LOG2 (uint32_t a);
extern uint32_t GFX_REAL_TO_UBYTE (float a);
extern int64_t GFX_POW2_SIZE (int64_t x);
extern uint32_t GFX_2_TO_POWER_OF (uint32_t w);
extern uint32_t GFX_MEMCPY_S(void *d, int dn, const void *s, int n);
extern void* GFX_MEMCPY_S_INC(void *d, int dn, const void *s, int n);
#endif // __DEFINE_PROTO
#ifndef __S_INLINE
#define __S_INLINE __inline
#endif
#if __DEFINE_MACRO || defined __GFX_MACRO_C__
//------------------------------------------------------------------------
__S_INLINE uint32_t GFX_LOG2 (uint32_t a)
{
long i = 1;
while ((a >> i) > 0) {
i++;
}
return (i - 1);
}
// Round-up to next power-of-2
__S_INLINE int64_t GFX_POW2_SIZE (int64_t x)
{ //-- Signed instead of unsigned since 64-bit is large enough that we don't need unsigned's range extension.
int64_t Pow2Size;
/* Algorithm:
If there are no bits lit beneath the highest bit lit (HBL), the value
is already a power-of-2 and needs no further rounding but if there are
additional bits lit beneath the highest, the next higher power-of-2 is
(1 << (HBL + 1)). To determine if there are bits lit beneath the HBL,
we will subtract 1 from the given value before scanning for the HBL,
and only if there are no lower bits lit will the subtraction reduce the
HBL but in both cases, (1 << (HBL + 1)) will then produce the
appropriately rounded-up (or not) power-of-2.
*/
if(x > 1) // <-- Since we bit-scan for (x - 1) and can't bit-scan zero.
{
#define MSB (sizeof(x) * CHAR_BIT - 1)
uint32_t HighBit;
{ // HighBit = HighestBitLit(x - 1)...
#if defined(__GNUC__) || defined(__clang__)
{
HighBit = MSB - __builtin_clzll(x - 1);
}
#else // Windows
{
#ifdef __CT__
{
_BitScanReverse64((DWORD *)&HighBit, x - 1);
}
#else // Break into separate Upper/Lower scans...
{
#define UDW_1 ((int64_t) _UI32_MAX + 1) // <-- UpperDW Value of 1 (i.e. 0x00000001`00000000).
if(x < UDW_1)
{
_BitScanReverse((DWORD *)&HighBit, GFX_ULONG_CAST(x - 1));
}
else if(x > UDW_1)
{
_BitScanReverse((DWORD *)&HighBit, GFX_ULONG_CAST((x - 1) >> 32));
HighBit += 32;
}
else
{
HighBit = 31;
}
#undef UDW_1
}
#endif
}
#endif
}
if(HighBit < (MSB - 1)) // <-- -1 since operating on signed type.
{
Pow2Size = (int64_t) 1 << (HighBit + 1);
}
else
{
__GFXMACRO_ASSERT(0); // Overflow!
Pow2Size = 0;
}
#undef MSB
}
else
{
Pow2Size = 1;
}
return(Pow2Size);
} // GFX_POW2_SIZE
// Find 2 to the power of w
__S_INLINE uint32_t GFX_2_TO_POWER_OF (uint32_t w)
{
__GFXMACRO_ASSERT(w < (sizeof(w) * CHAR_BIT)); // Assert no overflow.
return(1UL << w);
}
__S_INLINE uint32_t GFX_REAL_TO_UBYTE (float a)
{
uint32_t x;
GFX_FLOAT_TO_LONG_ROUND(x, a, 0xFF);
return x;
}
__S_INLINE uint32_t GFX_MEMCPY_S(void *d, int dn, const void *s, int n)
{
uint32_t Error;
// Check for the size, overlapping, etc.
// Calling code responsibility to avoid overlap regions
__GFXMACRO_ASSERT(n >= 0);
__GFXMACRO_ASSERT(
(((char*) d >= (char*) s) && ((ULONG_PTR)((char*) d - (char*) s) >= (ULONG_PTR) n) ) ||
(((char*) s >= (char*) d) && ((ULONG_PTR)((char*) s - (char*) d) >= (ULONG_PTR) n) ));
#ifndef _WIN32
Error = 0;
if(n <= dn)
{
memcpy(d, s, n);
}
else
{
Error = !Error;
}
#else
Error = (uint32_t) memcpy_s(d, dn, s, n);
#endif
__GFXMACRO_ASSERT(!Error);
return(Error);
}
__S_INLINE void* GFX_MEMCPY_S_INC(void *d, int dn, const void *s, int n)
{
GFX_MEMCPY_S(d, dn, s, n);
return GFX_VOID_PTR_INC(d, n);
}
__S_INLINE uint32_t GFX_GET_NONZERO_BIT_COUNT(uint32_t bitMask)
{
uint32_t bitCount = 0;
while(bitMask)
{
bitCount += bitMask & 0x1;
bitMask >>= 1;
}
return bitCount;
}
#endif
//#include <intrin.h>
// __readmsr should not be called for vGT cases, use __try __except to handle the
// exception and assign it with hard coded values
// isVGT flag will be set if it's being called from vGT.
#define GFX_READ_MSR(pHwDevExt, value, reg, retParam) \
if(!gfx_read_msr((pHwDevExt), &(value), (reg))) return retParam;
#define GFX_WRITE_MSR(pHwDevExt, reg, value, retParam)\
if(!gfx_write_msr((pHwDevExt), (value), (reg))) return retParam;
#define GFX_READ_MSR_GOTO_LABEL_ON_ERROR(pHwDevExt, value, reg, label) \
if(!gfx_read_msr((pHwDevExt), &(value), (reg))) goto label;
#define GFX_WRITE_MSR_GOTO_LABEL_ON_ERROR(pHwDevExt, reg, value, label)\
if(!gfx_write_msr((pHwDevExt), (value), (reg))) goto label;
#endif // __GFXMACRO_H__

View File

@ -0,0 +1,82 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#ifndef __GFXPLATFORM_H__
#define __GFXPLATFORM_H__
////////////////////////////////////////////////////////////////////////
// ABSTRACT:
// Platform-specific constants, #defines, and
// #includes. For the purposes of this header file,
// a platform is defined as the combination of:
//
// - CPU Architecture
// - C/C++ Compiler
////////////////////////////////////////////////////////////////////////
#if _MSC_VER
#pragma inline_depth (255)
#endif // _MSC_VER
#ifndef __S_INLINE
#define __S_INLINE __inline
#endif
#ifndef __F_INLINE
#ifdef _DEBUG
#define __F_INLINE static
#else
#define __F_INLINE static __inline
#endif
#endif
// Component definitions for ASSERT.
#define GFX_GMM (uint32_t)0x00000020
#ifdef _DEBUG
#define GFX_ASSERT(component,expr) \
{if (!(expr)) {__debugbreak();}}
#else
#define GFX_ASSERT(component,expr)
#endif
//========================================================================
// From winnt.h
//
// C_ASSERT() can be used to perform many COMPILE-TIME assertions:
// type sizes, field offsets, etc.
//
// An assertion failure results in error C2118: negative subscript.
//
// When this assertion is to be used in the middle of a code block,
// use it within {} - e.g. {GFX_C_ASSERT (GFX_NUM == 0);}
#ifndef GFX_C_ASSERT
#define GFX_C_ASSERT(e) typedef char GFX_C_ASSERT__[(e)?1:-1]
#endif
//========================================================================
// GFX_MMX_ALIGN: Alignment boundary (in bytes) for optimal use of
// the MMX instruction set on IA32.
#define GFX_MMX_ALIGN 8
#endif // #ifndef __GFXPLATFORM_H__

View File

@ -0,0 +1,291 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
// This header file describes the GT system info data structure and associated
// types and constants. It is for use by both producers and consumers of GT
// system info on all OS.
#ifndef __GT_SYS_INFO_H__
#define __GT_SYS_INFO_H__
#include <stdbool.h>
#include <stdint.h>
#pragma pack(push,1)
// Maximums which bound all supported GT
#define GT_MAX_SLICE (8)
#define GT_MAX_SUBSLICE_PER_SLICE (8)
#define GT_MAX_SUBSLICE_PER_DSS (2) // Currently max value based on Gen12
#define GT_MAX_DUALSUBSLICE_PER_SLICE (6) // Currently max value based on Gen12LP
typedef struct GT_SUBSLICE_INFO
{
bool Enabled; // determine if this SS is enabled.
uint32_t EuEnabledCount; // Total Count of EU enabled on this SubSlice
uint32_t EuEnabledMask; // Mask of EUs enabled on this SubSlice
} GT_SUBSLICE_INFO;
typedef struct GT_DUALSUBSLICE_INFO
{
bool Enabled; // Bool to determine if this SS is enabled.
GT_SUBSLICE_INFO SubSlice[GT_MAX_SUBSLICE_PER_DSS]; // SS details that belong to this DualSubSlice.
} GT_DUALSUBSLICE_INFO;
typedef struct GT_SLICE_INFO
{
bool Enabled; // determine if this slice is enabled.
GT_SUBSLICE_INFO SubSliceInfo[GT_MAX_SUBSLICE_PER_SLICE]; // SS details that belong to this slice.
GT_DUALSUBSLICE_INFO DSSInfo[GT_MAX_DUALSUBSLICE_PER_SLICE]; // DSS details that belong to this slice.
uint32_t SubSliceEnabledCount; // No. of SS enabled in this slice
uint32_t DualSubSliceEnabledCount; // No. of DSS enabled in this slice
} GT_SLICE_INFO;
typedef struct GT_VEBOX_INFO
{
union VEBoxInstances
{
struct VEBitStruct
{
uint32_t VEBox0Enabled : 1; // To determine if VEBox0 is enabled
uint32_t VEBox1Enabled : 1; // To determine if VEBox1 is enabled
uint32_t VEBox2Enabled : 1; // To determine if VEBox2 is enabled
uint32_t VEBox3Enabled : 1; // To determine if VEBox3 is enabled
uint32_t Reserved : 28; // Reserved bits
} Bits;
uint32_t VEBoxEnableMask; // Union for all VEBox instances. It can be used to know if any of the VEBOX is enabled.
} Instances;
union
{
struct
{
uint32_t VEBox0 : 1; // Set if VEBox0 supports SFC
uint32_t VEBox1 : 1; // Set if VEBox1 supports SFC
uint32_t VEBox2 : 1; // Set if VEBox2 supports SFC
uint32_t VEBox3 : 1; // Set if VEBox3 supports SFC
uint32_t Reserved : 28; // Reserved bits
}SfcSupportedBits;
uint32_t Value;
} SFCSupport; // VEBOX support of Scalar & Format Converter;
uint32_t NumberOfVEBoxEnabled; // Number of bits set among bit 0-3 of VEBoxEnableMask; used on CNL
bool IsValid; // flag to check if VEBoxInfo is valid.
} GT_VEBOX_INFO;
typedef struct GT_VDBOX_INFO
{
union VDBoxInstances
{
struct VDBitStruct
{
uint32_t VDBox0Enabled : 1; // To determine if VDBox0 is enabled
uint32_t VDBox1Enabled : 1; // To determine if VDBox1 is enabled
uint32_t VDBox2Enabled : 1; // To determine if VDBox2 is enabled
uint32_t VDBox3Enabled : 1; // To determine if VDBox3 is enabled
uint32_t VDBox4Enabled : 1; // To determine if VDBox4 is enabled
uint32_t VDBox5Enabled : 1; // To determine if VDBox5 is enabled
uint32_t VDBox6Enabled : 1; // To determine if VDBox6 is enabled
uint32_t VDBox7Enabled : 1; // To determine if VDBox7 is enabled
uint32_t Reserved : 24; // Reserved bits
} Bits;
uint32_t VDBoxEnableMask; // Union for all VDBox instances. It can be used to know if any of the VDBOX is enabled.
} Instances;
union
{
struct
{
uint32_t VDBox0 : 1; // Set if VDBox0 supports SFC
uint32_t VDBox1 : 1; // Set if VDBox1 supports SFC
uint32_t VDBox2 : 1; // Set if VDBox2 supports SFC
uint32_t VDBox3 : 1; // Set if VDBox3 supports SFC
uint32_t VDBox4 : 1; // Set if VDBox4 supports SFC
uint32_t VDBox5 : 1; // Set if VDBox5 supports SFC
uint32_t VDBox6 : 1; // Set if VDBox6 supports SFC
uint32_t VDBox7 : 1; // Set if VDBox7 supports SFC
uint32_t Reserved : 24; // Reserved bits
}SfcSupportedBits;
uint32_t Value;
} SFCSupport; // VDBOX support of Scalar & Format Converter;
uint32_t NumberOfVDBoxEnabled; // Number of bits set among bit 0-7 of VDBoxEnableMask;
bool IsValid; // flag to check if VDBoxInfo is valid.
} GT_VDBOX_INFO;
typedef struct GT_CCS_INFO
{
union CCSInstances
{
struct CCSBitStruct
{
uint32_t CCS0Enabled : 1; // To determine if CCS0 is enabled
uint32_t CCS1Enabled : 1;
uint32_t CCS2Enabled : 1;
uint32_t CCS3Enabled : 1;
uint32_t Reserved : 28; // Reserved bits
} Bits;
uint32_t CCSEnableMask; // Union for all CCS instances. It can be used to know which CCS is enabled.
} Instances;
uint32_t NumberOfCCSEnabled; // Number of bits set among bit 0-3 of CCSEnableMask;
bool IsValid; // flag to check if CCSInfo is valid.
} GT_CCS_INFO;
typedef struct GT_MULTI_TILE_ARCH_INFO
{
// Total Count of Tiles enabled
uint8_t TileCount;
// Mask of all enabled Tiles
union
{
struct
{
uint8_t Tile0 : 1;
uint8_t Tile1 : 1;
uint8_t Tile2 : 1;
uint8_t Tile3 : 1;
uint8_t Reserved : 4;
};
uint8_t TileMask;
};
// flag to check if MultiTileArchInfo has valid data or not
bool IsValid;
} GT_MULTI_TILE_ARCH_INFO;
typedef struct GT_SQIDI_INFO
{
uint32_t NumberofSQIDI; // Total no. of enabled SQIDIs.
uint32_t NumberofDoorbellPerSQIDI; // Total no. of doorbells available per SQIDI unit
}GT_SQIDI_INFO;
typedef union _GT_CACHE_TYPES
{
struct
{
uint32_t L3 : 1;
uint32_t LLC : 1;
uint32_t eDRAM : 1;
uint32_t Reserved : 29;
};
uint32_t CacheTypeMask;
} GT_CACHE_TYPES;
typedef struct GT_SYSTEM_INFO
{
// These fields should always hold valid values
uint32_t EUCount; // Total no. of enabled EUs
uint32_t ThreadCount; // total no of system threads available
uint32_t SliceCount; // Total no. of enabled slices
uint32_t SubSliceCount; // Total no. of enabled subslices
uint32_t DualSubSliceCount; // Total no. of enabled dualsubslices
uint64_t L3CacheSizeInKb; // Total L3 cache size in kilo bytes
uint64_t LLCCacheSizeInKb; // Total LLC cache size in kilo bytes
uint64_t EdramSizeInKb; // Total EDRAM size in kilo bytes
uint32_t L3BankCount; // Total L3 banks across all slices. This is not bank count per slice.
uint32_t MaxFillRate; // Fillrate with Alphablend (in Pix/Clk)
uint32_t EuCountPerPoolMax; // Max EU count per pool
uint32_t EuCountPerPoolMin; // Min EU count per pool
uint32_t TotalVsThreads; // Total threads in VS
uint32_t TotalHsThreads; // Total threads in HS
uint32_t TotalDsThreads; // Total threads in DS
uint32_t TotalGsThreads; // Total threads in GS
uint32_t TotalPsThreadsWindowerRange; // Total threads in PS Windower Range
uint32_t TotalVsThreads_Pocs; // Total threads in VS for POCS
// Note: The CSR size requirement is not clear at this moment. Till then the driver will set
// the maximum size that should be sufficient for all platform SKUs.
uint32_t CsrSizeInMb; // Total size that driver needs to allocate for CSR.
/*------------------------------------*/
// Below fields are required for proper allocation of scratch/private space for threads execution.
// Threads scratch space has to be allocated based on native die config. So allocation has to be
// done even for unfused or non-enabled slices/subslices/EUs. Since H/W doesn't provide us a way to know
// about the native die config S/W will allocate based on max EU/S/SS.
uint32_t MaxEuPerSubSlice; // Max available EUs per sub-slice.
uint32_t MaxSlicesSupported; // Max slices this platfrom can have.
uint32_t MaxSubSlicesSupported; // Max total sub-slices this platform can have (not per slice)
uint32_t MaxDualSubSlicesSupported; // Max total dual sub-slices this platform can have (not per slice)
/*------------------------------------*/
// Flag to determine if hashing is enabled. If enabled then one of the L3 banks will be disabled.
// As a result 'L3BankCount' will be reduced by 1 bank during system info derivation routine.
// Note: Only expected only in CNL (limited SKUs).
bool IsL3HashModeEnabled;
// VEBox/VDBox info
GT_VDBOX_INFO VDBoxInfo; // VDBoxInfo provides details(enabled/disabled) of all VDBox instances.
GT_VEBOX_INFO VEBoxInfo; // VEBoxInfo provides details(enabled/disabled) of all VEBox instances.
// SliceInfo provides the detailed breakdown of the Slice/Subslice/EU configuration. It is useful
// for various WA that depend on the specific SSEU components enabled or disabled, but it is not
// considered critically important to driver function at this time and may not be validly populated
// on all platforms. IsDynamicallyPopulated indicates if SliceInfo has been validly populated.
// IsDynamicallyPopulated only applies to SliceInfo.
// TODO: Rename IsDynamicallyPopulated to something like SliceInfoIsValid to help clarify its
// purpose. At the moment we are constrained by USC not to make any changes to the GT System
// Info interface which require USC changes. USC currently references IsDynamicallyPopulated.
GT_SLICE_INFO SliceInfo[GT_MAX_SLICE];
bool IsDynamicallyPopulated;
//SqidiInfo provides the detailed information for number of SQIDIs supported in GT.
//It also provides total no. of doorbells available per SQIDI unit.
GT_SQIDI_INFO SqidiInfo;
uint32_t ReservedCCSWays; // Reserved CCS ways provides value of reserved L3 ways for CCS when CCS is enabled.
// This is a hardcoded value as suggested by HW. No MMIO read is needed for same.
GT_CCS_INFO CCSInfo; // CCSInfo provides details(enabled/disabled) of all CCS instances.
GT_MULTI_TILE_ARCH_INFO MultiTileArchInfo; // MultiTileArchInfo provides details(enabled/disabled) of GT Tiles in case of Multi Tile Architecture SKUs
uint32_t NumThreadsPerEu; // Number of threads per EU.
GT_CACHE_TYPES CacheTypes; // Types of caches available on system (L3/LLC/eDRAM).
uint32_t MaxVECS; // Max VECS instances.
uint32_t MemoryType; // GT_MEMORY_TYPES - type of memory supported in current platform
uint32_t SLMSizeInKb; // SLM Size
} GT_SYSTEM_INFO, *PGT_SYSTEM_INFO;
#pragma pack(pop)
#endif //__GT_SYS_INFO_H__

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,621 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
/*
File Name: sku_wa.h
Description:
Common hardware sku and workaround information structures.
This file is commented in a manner allowing automated parsing of WA information.
Each entry inside WA table should include comments in form of:
@WorkaroundName <name-mandatory> //this field is mandatory
@Description <short description (can be multiline)
@PerfImpact <performance impact>
@BugType <hang,crash etc.>
@Component <Gmm>
\*****************************************************************************/
#ifndef __SKU_WA_H__
#define __SKU_WA_H__
// Prevent the following...
// warning: ISO C++ prohibits anonymous structs [-pedantic]
// warning: ISO C90 doesn't support unnamed structs/unions [-pedantic]
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpedantic" // clang only recognizes -Wpedantic
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#if __GNUC__ >= 6
#pragma GCC diagnostic ignored "-Wpedantic"
#else
#pragma GCC diagnostic ignored "-pedantic" // gcc <= 4.7.4 only recognizes -pedantic
#endif
#endif
//********************************** SKU ****************************************
// Sku Table structure to abstract sku based hw feature availability
// For any Sku based feature, add a field in this structure
typedef struct _SKU_FEATURE_TABLE
{
// flags 1 = available, 0 = not available
struct //_sku_Core
{
unsigned int FtrULT : 1; // Indicates ULT SKU
unsigned int FtrVERing : 1; // Separate Ring for VideoEnhancement commands
unsigned int FtrVcs2 : 1; // Second VCS engine supported on Gen8 to Gen10 (in some configurations);
unsigned int FtrLCIA : 1; // Indicates Atom (Low Cost Intel Architecture)
unsigned int FtrCCSRing : 1; // To indicate if CCS hardware ring support is present.
unsigned int FtrCCSNode : 1; // To indicate if CCS Node support is present.
unsigned int FtrTileY : 1; // Identifies Legacy tiles TileY/Yf/Ys on the platform
unsigned int FtrCCSMultiInstance : 1; // To indicate if driver supports MultiContext mode on RCS and more than 1 CCS.
unsigned int FtrL3TransientDataFlush : 1; // Transient data flush from L3 cache
};
struct //_sku_KMD_render
{ // MI commends are capable to set
unsigned int FtrPPGTT : 1; // Per-Process GTT
unsigned int FtrIA32eGfxPTEs : 1; // GTT/PPGTT's use 64-bit IA-32e PTE format.
unsigned int FtrMemTypeMocsDeferPAT : 1; // Pre-Gen12 MOCS can defers to PAT, e.g. eLLC Target Cache for MOCS
unsigned int FtrPml4Support : 1; // PML4-based gfx page tables are supported (in addition to PD-based tables).
unsigned int FtrSVM : 1; // Shared Virtual Memory (i.e. support for SVM buffers which can be accessed by both the CPU and GPU at numerically equivalent addresses.)
unsigned int FtrTileMappedResource : 1; // Tiled Resource support aka Sparse Textures.
unsigned int FtrTranslationTable : 1; // Translation Table support for Tiled Resources.
unsigned int FtrUserModeTranslationTable : 1; // User mode managed Translation Table support for Tiled Resources.
unsigned int FtrNullPages : 1; // Support for PTE-based Null pages for Sparse/Tiled Resources).
unsigned int FtrEDram : 1; // embedded DRAM enable
unsigned int FtrLLCBypass : 1; // Partial tunneling of UC memory traffic via CCF (LLC Bypass)
unsigned int FtrCrystalwell : 1; // Crystalwell Sku
unsigned int FtrCentralCachePolicy : 1; // Centralized Cache Policy
unsigned int FtrWddm2GpuMmu : 1; // WDDMv2 GpuMmu Model (Set in platform SKU files, but disabled by GMM as appropriate for given system.)
unsigned int FtrWddm2Svm : 1; // WDDMv2 SVM Model (Set in platform SKU files, but disabled by GMM as appropriate for given system.)
unsigned int FtrStandardMipTailFormat : 1; // Dx Standard MipTail Format for TileYf/Ys
unsigned int FtrWddm2_1_64kbPages : 1; // WDDMv2.1 64KB page support
unsigned int FtrE2ECompression : 1; // E2E Compression ie Aux Table support
unsigned int FtrLinearCCS : 1; // Linear Aux surface is supported
unsigned int FtrFrameBufferLLC : 1; // Displayable Frame buffers cached in LLC
unsigned int FtrDriverFLR : 1; // Enable Function Level Reset (Gen11+)
unsigned int FtrLocalMemory : 1;
unsigned int FtrCameraCaptureCaching : 1;
unsigned int FtrLocalMemoryAllows4KB : 1;
unsigned int FtrPpgtt64KBWalkOptimization : 1; // XeHP 64KB Page table walk optimization on PPGTT.
unsigned int FtrFlatPhysCCS : 1; // XeHP compression ie flat physical CCS
unsigned int FtrDisplayXTiling : 1; // Fallback to Legacy TileX Display, used for Pre-SI platforms.
unsigned int FtrMultiTileArch : 1;
unsigned int FtrDisplayPageTables : 1; // Display Page Tables: 2-Level Page walk for Displayable Frame buffers in GGTT.
unsigned int Ftr57bGPUAddressing : 1; // 57b GPUVA support eg: PVC
unsigned int FtrUnified3DMediaCompressionFormats : 1; // DG2 has unified Render/media compression(versus TGLLP/XeHP_SDV 's multiple instances) and requires changes to RC format h/w encodings.
unsigned int FtrForceTile4 : 1; // Flag to force Tile4 usage as default in Tile64 supported platforms.
unsigned int FtrTile64Optimization : 1;
unsigned int FtrDiscrete : 1; // Discrete-gfx
unsigned int FtrXe2Compression : 1; // Xe2 Stateless Compression
unsigned int FtrXe2PlusTiling : 1; // Tile64 MSAA Layout
unsigned int FtrL4Cache : 1; // L4 cache support
unsigned int FtrPml5Support : 1; // xe2 page tables
unsigned int Ftr3DSamplerRemoved : 1;
unsigned int FtrEfficient64BitAddressing : 1; // Efficient 64bit addressing (Xe3P) feature.
unsigned int FtrPATCentricCachePolicy : 1; // Flag to enable the PAT centric cache policy.
unsigned int FtrAppTransientCaching : 1; // App-Transient Attribute
};
struct //_sku_3d
{
unsigned int FtrAstcLdr2D : 1; // ASTC 2D LDR Mode Support (mutually exclusive from other ASTC Ftr's)
unsigned int FtrAstcHdr2D : 1; // ASTC 2D HDR Mode Support (mutually exclusive from other ASTC Ftr's)
unsigned int FtrAstc3D : 1; // ASTC 3D LDR/HDR Mode Support (mutually exclusive from other ASTC Ftr's)
};
struct //_sku_PwrCons
{
//FBC
unsigned int FtrFbc : 1; // Frame Buffer Compression
};
struct //_sku_Display
{
unsigned int FtrRendComp : 1; // For Render Compression Feature on Gen9+
unsigned int FtrDisplayYTiling : 1; // For Y Tile Feature on Gen9+
unsigned int FtrDisplayDisabled : 1; // Server skus with Display
};
struct
{
unsigned int FtrS3D : 1; // Stereoscopic 3D
unsigned int FtrDisplayEngineS3d : 1; // Display Engine Stereoscopic 3D
};
struct // Virtualization features
{
unsigned int FtrVgt : 1;
};
struct // For MultiTileArch, KMD reports default tile assignment to UMD-GmmLib - via __KmQueryDriverPrivateInfo
{
unsigned int FtrAssignedGpuTile : 3; // Indicates Gpu Tile number assigned to a process for Naive apps.
};
} SKU_FEATURE_TABLE, *PSKU_FEATURE_TABLE;
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
//********************************** WA ****************************************
#define WA_DECLARE( wa, wa_comment, wa_bugType, wa_impact, wa_component) unsigned int wa : 1;
enum WA_BUG_TYPE
{
WA_BUG_TYPE_UNKNOWN = 0,
WA_BUG_TYPE_CORRUPTION = 1,
WA_BUG_TYPE_HANG = 2,
WA_BUG_TYPE_PERF = 4,
WA_BUG_TYPE_FUNCTIONAL = 8,
WA_BUG_TYPE_SPEC = 16,
WA_BUG_TYPE_FAIL = 32
};
#define WA_BUG_PERF_IMPACT(f) f
#define WA_BUG_PERF_IMPACT_UNKNOWN -1
enum WA_COMPONENT
{
WA_COMPONENT_UNKNOWN = 0,
WA_COMPONENT_GMM = 0x1,
WA_COMPONENT_MEDIA = 0x2,
WA_COMPONENT_OCL = 0x3,
};
// Workaround Table structure to abstract WA based on hw and rev id
typedef struct _WA_TABLE
{
// struct wa_3d
WA_DECLARE(
WaAlignIndexBuffer,
"Force the end of the index buffer to be cacheline-aligned to work around a hardware bug that performs no bounds checking on accesses past the end of the index buffer when it only partially fills a cacheline.",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
// struct _wa_Gmm
unsigned int Reserved0: 31; // Handle 4bytes alignment boundary to maintain ABI
WA_DECLARE(
WaValign2ForR8G8B8UINTFormat,
"sampler format decoding error in HW for this particular format double fetching is happening, WA is to use VALIGN_2 instead of VALIGN_4",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT(0), WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaValign2For96bppFormats,
"VALIGN_2 only for 96bpp formats.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaCursor16K,
"Cursor memory need to be mapped in GTT",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa8kAlignforAsyncFlip,
"Enable 8k pitch alignment for Asynchronous Flips in rotated mode. (!) Unconventional use! When used, set each XP mode-change (not in platform WA file)!",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa29BitDisplayAddrLimit,
"Sprite/Overlay/Display addresses limited to 29 bits (512MB)",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaAlignContextImage,
"WA for context alignment",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaForceGlobalGTT,
"WA for cmds requiring memory address to come from global GTT, not PPGTT.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaReportPerfCountForceGlobalGTT,
"WA for MI_REPORT_PERF_COUNT cmd requiring memory address to come from global GTT, not PPGTT.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaOaAddressTranslation,
"WA for STDW and PIPE_CONTROL cmd requiring memory address to come from global GTT, not PPGTT.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa2RowVerticalAlignment,
"WA to set VALIGN of sample and rt buffers.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaPpgttAliasGlobalGttSpace,
"Disallow independent PPGTT space--i.e. the PPGTT must simply alias global GTT space. (N/A without FtrPageDirectory set.)",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaClearFenceRegistersAtDriverInit,
"WA to clear all fence registers at driver init time.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaRestrictPitch128KB,
"Restrict max surface pitch to 128KB.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaAvoidLLC,
"Avoid LLC use. (Intended for debug purposes only.)",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaAvoidL3,
"Avoid L3 use (but don't reconfigure; and naturally URB/etc. still need L3). (Intended for debug purposes only.)",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa16TileFencesOnly,
"Limit to 16 tiling fences --Set at run-time by GMM.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa16MBOABufferAlignment,
"WA align the base address of the OA buffer to 16mb",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaTranslationTableUnavailable,
"WA for BXT and SKL skus without Tiled-Resource Translation-Table (TR-TT)",
WA_BUG_TYPE_SPEC,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaNoMinimizedTrivialSurfacePadding,
"(Not actual HW WA.) On BDW:B0+ trivial surfaces (single-LOD, non-arrayed, non-MSAA, 1D/2D/Buffers) are exempt from the samplers large padding requirements. This WA identifies platforms that dont yet support that.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaNoBufferSamplerPadding,
"Client agreeing to take responsibility for flushing L3 after sampling/etc.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaSurfaceStatePlanarYOffsetAlignBy2,
"WA to align SURFACE_STATE Y Offset for UV Plane by 2",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaGttCachingOffByDefault,
"WA to enable the caching if off by defaultboth at driver init and Resume",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaTouchAllSvmMemory,
"When in WDDM2 / SVM mode, all VA memory buffers/surfaces/etc need to be touched to ensure proper PTE mapping",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaIOBAddressMustBeValidInHwContext,
"IndirectObjectBase address (of SBA cmd) in HW Context needs to be valid because it gets used every Context load",
WA_BUG_TYPE_HANG,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaFlushTlbAfterCpuGgttWrites,
"WA to flush TLB after CPU GTT writes because TLB entry invalidations on GTT writes use wrong address for look-up",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaMsaa8xTileYDepthPitchAlignment,
"WA to use 256B pitch alignment for MSAA 8x + TileY depth surfaces.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaDisableNullPageAsDummy,
"WA to disable use of NULL bit in dummy PTE",
WA_BUG_TYPE_HANG | WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaUseVAlign16OnTileXYBpp816,
"WA to make VAlign = 16, when bpp == 8 or 16 for both TileX and TileY on BDW",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaNoMocsEllcOnly,
"WA to get eLLC Target Cache for MOCS surfaces, when MOCS defers to PAT",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT, WA_COMPONENT_GMM)
WA_DECLARE(
WaGttPat0,
"GTT accesses hardwired to PAT0",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT, WA_COMPONENT_GMM)
WA_DECLARE(
WaGttPat0WB,
"WA to set WB cache for GTT accessess on PAT0",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT, WA_COMPONENT_GMM)
WA_DECLARE(
WaMemTypeIsMaxOfPatAndMocs,
"WA to set PAT.MT = UC. Since TGLLP uses MAX function to resolve PAT vs MOCS MemType So unless PTE.PAT says UC, MOCS won't be able to set UC!",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT, WA_COMPONENT_GMM)
WA_DECLARE(
WaGttPat0GttWbOverOsIommuEllcOnly,
"WA to set PAT0 to full cacheable (LLC+eLLC) for GTT access over eLLC only usage for OS based SVM",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT, WA_COMPONENT_GMM)
WA_DECLARE(
WaAddDummyPageForDisplayPrefetch,
"WA to add dummy page row after display surfaces to avoid issues with display pre-fetch",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaLLCCachingUnsupported,
"There is no H/w support for LLC in VLV or VLV Plus",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaEncryptedEdramOnlyPartials,
"Disable Edram only caching for encrypted usage",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaDisableEdramForDisplayRT,
"WA to disable EDRAM cacheability of Displayable Render Targets on SKL Steppings until I0",
WA_BUG_TYPE_PERF,
WA_BUG_PERF_IMPACT, WA_COMPONENT_GMM)
WA_DECLARE(
WaAstcCorruptionForOddCompressedBlockSizeX,
"Enable CHV D0+ WA for ASTC HW bug: sampling from mip levels 2+ returns wrong texels. WA adds XOffset to mip2+, requires D0 HW ECO fix.",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaLosslessCompressionSurfaceStride,
"WA to align surface stride for unified aux surfaces",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa4kAlignUVOffsetNV12LinearSurface,
"WA to align UV plane offset at 4k page for NV12 Linear FlipChain surfaces",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaFbcLinearSurfaceStride,
"WA to align surface stride for linear primary surfaces",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaDoubleFastClearWidthAlignment,
"For all HSW GT3 skus and for all HSW GT E0+ skus, must double the width alignment when performing fast clears.",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaCompressedResourceRequiresConstVA21,
"3D and Media compressed resources should not have addresses that change within bit range [20:0]",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaDisregardPlatformChecks,
"Disable plarform checks to surface allocation.",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaAlignYUVResourceToLCU,
"source and recon surfaces need to be aligned to the LCU size",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa32bppTileY2DColorNoHAlign4,
"Wa to defeature HALIGN_4 for 2D 32bpp RT surfaces, due to bug introduced from daprsc changes to help RCPB generate correct offsets to deal with cam match",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaAuxTable16KGranular,
"AuxTable map granularity changed to 16K ",
WA_BUG_TYPE_PERF,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaAuxTable64KGranular,
"AuxTable map granularity changed to 64K ..Remove once Neo switches reference to WaAuxTable16KGranular",
WA_BUG_TYPE_PERF,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaLimit128BMediaCompr,
"WA to limit media decompression on Render pipe to 128B (2CLs) 4:n.",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaUntypedBufferCompression,
"WA to allow untyped raw buffer AuxTable mapping",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa64kbMappingAt2mbGranularity,
"WA to force 2MB alignment for 64KB-LMEM pages",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
WaDefaultTile4,
"[XeHP] Keep Tile4 as default on XeHP till B stepping",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_1606955757,
"[GPSSCLT] [XeHP] Multicontext (LB) : out-of-order write-read access to scratch space from hdctlbunit",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_OGL)
WA_DECLARE(
WaTile64Optimization,
"Tile64 wastge a lot of memory so WA provides optimization to fall back to Tile4 when waste is relatively higher",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_15010089951,
"[DG2][Silicon][Perf]DG2 VESFC performance when Compression feature is enabled.",
WA_BUG_TYPE_PERF,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_22016140776,
"[PVC] operation unexpectedly results in NAN",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa_14018443005,
"[Xe2] - Incorrect handling of compression when changing cached PA usage from compression OFF and another client does partial sector compression ON on W with UC",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_14018976079,
"[LNL] CPU-GPU False sharing broken for 1-way coherent pages",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_14018984349,
"[LNL] CPU-GPU False sharing broken for non-coherent pages",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_14020040029,
"Misalignment on Depth buffer for Zplanes",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_EmuMufasaSupportOnBmg,
"WA for supporting failure seen in BMG with Mufasa",
WA_BUG_TYPE_FUNCTIONAL,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
WaNoCpuCoherentCompression,
"Deny compression for coherent surfaces",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_UNKNOWN)
WA_DECLARE(
Wa_22015614752,
"[DG2] - Handle tile4 when Compressed surface not aligned to 64Kb",
WA_BUG_TYPE_CORRUPTION,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
WA_DECLARE(
Wa_14022942107,
"[Xe3p][NVL-P] JPEGXS gt timing increasd",
WA_BUG_TYPE_UNKNOWN,
WA_BUG_PERF_IMPACT_UNKNOWN, WA_COMPONENT_GMM)
} WA_TABLE, *PWA_TABLE;
//********************************** SKU/WA Macros *************************************
#if (defined(__MINIPORT) || defined(__KCH) || defined(__SOFTBIOS) || defined(__GRM) || defined(__PWRCONS))
#if LHDM || LINUX
#define GFX_IS_SKU(s, f) ((s)->SkuTable.f)
#define GFX_IS_WA(s, w) ((s)->WaTable.w)
#define GFX_WRITE_WA(x, y, z) ((x)->WaTable.y = z)
//No checking is done in the GFX_WRITE_SKU macro that z actually fits into y.
// It is up to the user to know the size of y and to pass in z accordingly.
#define GFX_WRITE_SKU(x, y, z) ((x)->SkuTable.y = z)
#else
#define GFX_IS_SKU(h, f) (((PHW_DEVICE_EXTENSION)(h))->pHWStatusPage->pSkuTable->f)
#define GFX_IS_WA(h, w) (((PHW_DEVICE_EXTENSION)(h))->pHWStatusPage->pWaTable->w)
#define GFX_WRITE_WA(x, y, z) (((HW_DEVICE_EXTENSION *)(x))->pHWStatusPage->pWaTable->y = z)
//No checking is done in the GFX_WRITE_SKU macro that z actually fits into y.
// It is up to the user to know the size of y and to pass in z accordingly.
#define GFX_WRITE_SKU(x, y, z) (((HW_DEVICE_EXTENSION *)(x))->pHWStatusPage->pSkuTable->y = z)
#endif // end LHDM
#else
#define GFX_IS_SKU(s, f) ((s)->SkuTable.f)
#define GFX_IS_WA(s, w) ((s)->WaTable.w)
#endif
#define GRAPHICS_IS_SKU(s, f) ((s)->f)
#define GRAPHICS_IS_WA(s, w) ((s)->w)
#endif //__SKU_WA_H__

View File

@ -0,0 +1,80 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#ifndef UFO_PORTABLE_COMPILER_H
#define UFO_PORTABLE_COMPILER_H
#if __GNUC__
#if __GNUC__ < 4
#error "Unsupported GCC version. Please use 4.0+"
#endif
#define __noop
#define __fastcall
#if defined __x86_64__
#define __stdcall // deprecated for x86-64
#define __cdecl // deprecated for x86-64
#elif defined(__ARM_ARCH)
#define __stdcall
#define __cdecl
#else
#define __cdecl __attribute__((__cdecl__))
#define __stdcall __attribute__((__stdcall__))
#endif
#define __declspec(x) __declspec_##x
#define __declspec_align(y) __attribute__((aligned(y)))
#define __declspec_deprecated __attribute__((deprecated))
#define __declspec_dllexport
#define __declspec_dllimport
#define __declspec_noinline __attribute__((__noinline__))
#define __declspec_nothrow __attribute__((nothrow))
#define __declspec_novtable
#define __declspec_thread __thread
#define __forceinline inline __attribute__((__always_inline__))
#define __debugbreak() do { asm volatile ("int3;"); } while (0)
#define __popcnt __builtin_popcount
#else
#pragma message "unknown compiler!"
#endif
/* compile-time ASSERT */
#ifndef C_ASSERT
#define __CONCATING( a1, a2 ) a1 ## a2
#define __UNIQUENAME( a1, a2 ) __CONCATING( a1, a2 )
#define UNIQUENAME( __text ) __UNIQUENAME( __text, __COUNTER__ )
#define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1]
#endif
#endif // UFO_PORTABLE_COMPILER_H

View File

@ -0,0 +1,395 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================
**
** File Name: UmKmDmaPerfTimer.h
**
** Description:
** Contains perftag class and subtype codes used by km dma timer.
**
==============================================================================*/
#pragma once
#if defined (LHDM) || defined(KM_PERF_CONTROLLER_BUILD) || defined(_PERF_REPORT)
#include "UmKmEnum.h"
#endif
#include <stdint.h>
// Set packing alignment
#pragma pack(push, 1)
#ifdef __cplusplus
extern "C" {
#endif
//===========================================================================
// typedef:
// PERF_DATA
//
// Description:
//
//---------------------------------------------------------------------------
typedef struct _PERF_DATA
{
union
{
struct
{
uint32_t dmaBufID : 16;
uint32_t frameID : 8;
uint32_t bufferID : 4;
uint32_t batchBufID : 4;
};
uint32_t PerfTag;
};
} PERF_DATA;
//===========================================================================
// enum:
// PERFTAG_CLASS_ENUM
//
// Description:
// PerfTag class cmd buffer classification.
//
//---------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// IMPORTANT NOTE: Please DONOT change the existing perftag values in below enum.
// If adding a new perf tag, assign a new value
//--------------------------------------------------------------------------------
typedef enum PERFTAG_CLASS_ENUM
{
PERFTAG_ALL = 0x0000, // Used for capturing all (perfcontroller)
PERFTAG_KMD = 0x1000,
PERFTAG_3D = 0x2000,
PERFTAG_DECODE = 0x3000, // Media Decoding
PERFTAG_DXVA2 = 0x4000,
PERFTAG_LIBVA = 0x5000,
PERFTAG_ENCODE = 0x6000, // Media Encoding
PERFTAG_DXVAHD = 0x7000,
PERFTAG_DXVA1 = 0x8000,
PERFTAG_VPREP = 0x9000,
PERFTAG_CM = 0xA000, // C for media
PERFTAG_WIDI = 0xB000,
PERFTAG_OCL = 0xC000, // OpenCL
PERFTAG_PXP = 0xD000, // PXP
PERFTAG_DXVA11 = 0xE000, // DX11 Video
PERFTAG_FRAME_CAPTURE = 0xF000, // Gfx Frame Capture
PERFTAG_FRAME_CAPTURE_NV12 = 0xF100, // Gfx Frame Capture with NV12 output
PERFTAG_FRAME_CAPTURE_RGB8 = 0xF200, // Gfx Frame Capture with RGB8 output
PERFTAG_UNKNOWN = 0x0FFF
}PERFTAG_CLASS;
#define PERFTAG_SUBTYPE(PerfTag) ( PerfTag & (ULONG)0x00000FFF ) // Bits[0,11] Usage component specific
#define GET_PERFTAG_CLASS(PerfTag) ( PerfTag & (ULONG)0x0000F000 ) // Bits[12,15]
#define PERFTAG_CLASS_AND_SUBTYPE(PerfTag) ( PerfTag & (ULONG)0x0000FFFF ) // Bits[0,15]
#define PERFTAG_UNKNOWN_BITS(PerfTag) ( PerfTag & (ULONG)0xFFFF0000 ) // Bits[16,31] Usage component specific
#define PERFTAG_FRAMEID(PerfTag) ( PerfTag & (ULONG)0x00FF0000 ) // Bits[16,23] Media Specific - frame id
#define PERFTAG_BUFFERID(PerfTag) ( PerfTag & (ULONG)0x0F000000 ) // Bits[24,27] Media Specific - buffer id
#define PERFTAG_BATCHBUFFERID(PerfTag) ( PerfTag & (ULONG)0xF0000000 ) // Bits[28,31] Media Specific - batch buffer id
#define PERFTAG_FRAMEID_SHIFT 16
#define PERFTAG_BUFFERID_SHIFT 24
#define PERFTAG_BATCHBUFFERID_SHIFT 28
//===========================================================================
// enum:
// VPHAL_PERFTAG
//
// Description:
// Video Postprocessing perftag sub type.
// NOTE:
// Please follow instructions in below enum when adding new perf tag values.
// Sub Tags (bits 11:0).
// When adding new perf tag values, please update
// Source\miniport\LHDM\KmPerfTools\PerfController\PerfReportGenerator.h
// with the string.
//---------------------------------------------------------------------------
typedef enum _VPHAL_PERFTAG
{
// No pri video
VPHAL_NONE = 0x0,
VPHAL_1LAYER ,
VPHAL_2LAYERS,
VPHAL_3LAYERS,
VPHAL_4LAYERS,
VPHAL_5LAYERS,
VPHAL_6LAYERS,
VPHAL_7LAYERS,
VPHAL_8LAYERS,
// ADD NEW TAGS FOR NO PRI-VIDEO CASE HERE
// pri video present
VPHAL_PRI = 0x10,
VPHAL_PRI_1LAYER,
VPHAL_PRI_2LAYERS,
VPHAL_PRI_3LAYERS,
VPHAL_PRI_4LAYERS,
VPHAL_PRI_5LAYERS,
VPHAL_PRI_6LAYERS,
VPHAL_PRI_7LAYERS,
VPHAL_PRI_8LAYERS,
// ADD NEW TAGS FOR PRI-VIDEO CASE HERE
// video rotation present
VPHAL_ROT = 0x20,
VPHAL_ROT_1LAYER,
VPHAL_ROT_2LAYERS,
VPHAL_ROT_3LAYERS,
VPHAL_ROT_4LAYERS,
VPHAL_ROT_5LAYERS,
VPHAL_ROT_6LAYERS,
VPHAL_ROT_7LAYERS,
VPHAL_ROT_8LAYERS,
// PERFTAGs for AdvProc using VEBOX
VPHAL_PA_DI_PA = 0x100,
VPHAL_PA_DN_PA,
VPHAL_PA_DNUV_PA,
VPHAL_PA_DNDI_PA,
VPHAL_PA_DI_422CP,
VPHAL_PA_DN_422CP,
VPHAL_PA_DNDI_422CP,
VPHAL_PA_422CP,
VPHAL_PA_DN_420CP,
VPHAL_PA_420CP,
VPHAL_PA_DN_RGB32CP,
VPHAL_PA_RGB32CP,
VPHAL_PL_DI_PA,
VPHAL_PL_DI_422CP,
VPHAL_NV12_DN_NV12,
VPHAL_NV12_DNUV_NV12,
VPHAL_NV12_DNDI_PA,
VPHAL_NV12_DN_420CP,
VPHAL_NV12_DN_422CP,
VPHAL_NV12_DNDI_422CP,
VPHAL_NV12_420CP,
VPHAL_NV12_422CP,
VPHAL_NV12_DN_RGB32CP,
VPHAL_NV12_RGB32CP,
VPHAL_PL3_DN_PL3,
VPHAL_PL3_DNUV_PL3,
VPHAL_PL3_DNDI_PA,
VPHAL_PL3_DN_422CP,
VPHAL_PL3_DNDI_422CP,
VPHAL_PL3_422CP,
VPHAL_VEBOX_RESERVED1,
VPHAL_VEBOX_UPDATE_DN_STATE,
VPHAL_VEBOX_ACE,
VPHAL_VEBOX_FMD_VAR,
VPHAL_VEBOX_P010,
VPHAL_VEBOX_P016,
VPHAL_VEBOX_P210,
VPHAL_VEBOX_P216,
VPHAL_VEBOX_Y210,
VPHAL_VEBOX_Y216,
VPHAL_VEBOX_Y410,
VPHAL_VEBOX_Y416,
VPHAL_VEBOX_AYUV,
VPHAL_VEBOX_RGB32,
VPHAL_VEBOX_RGB64,
// PERFTAGs for AdvProc using Render
VPHAL_ISTAB_PH1_PLY_PLY = 0x200,
VPHAL_ISTAB_PH1_PA_PLY,
VPHAL_ISTAB_PH2_ME_BS_ATOMIC,
VPHAL_ISTAB_PH3_GMC_BS_ATOMIC,
VPHAL_ISTAB_PH4_NV12_NV12_BS,
VPHAL_ISTAB_PH4_PA_PA_BS,
VPHAL_FRC_COPY,
VPHAL_FRC_WIDE_SCREEN_DETECTION,
VPHAL_FRC_PYRAMIDAL_SCALING,
VPHAL_FRC_MOTION_ESTIMATION_L3,
VPHAL_FRC_MV_VOTING_L3,
VPHAL_FRC_MOTION_ESTIMATION_L2,
VPHAL_FRC_MV_VOTING_L2,
VPHAL_FRC_MOTION_ESTIMATION_L1,
VPHAL_FRC_MV_VOTING_L1,
VPHAL_FRC_GMV,
VPHAL_FRC_MV_SANITY_CHECK,
VPHAL_FRC_GRADIENT_Y,
VPHAL_FRC_GRADIENT_UV,
VPHAL_FRC_TEMPORAL_DIFF,
VPHAL_FRC_SPD_MAP,
VPHAL_FRC_CLEAN_MAP,
VPHAL_FRC_MOTION_COMP,
VPHAL_DRDB_NV12_DERING_NV12,
VPHAL_DRDB_NV12_HDEBLOCK_NV12,
VPHAL_DRDB_NV12_VDEBLOCK_NV12,
VPHAL_3P,
VPHAL_DPROTATION_NV12_NV12,
VPHAL_DPROTATION_NV12_AVG,
VPHAL_DPROTATION_NV12_REP,
VPHAL_LACE_HIST_SUM,
VPHAL_LACE_STD,
VPHAL_LACE_PWLF,
VPHAL_LACE_LUT,
VPHAL_EU3DLUT,
// Capture pipe present
VPHAL_CP = 0x300,
VPHAL_CP_BAYER8,
VPHAL_CP_BAYER16,
VPHAL_CP_LGCA_PH1_CALCPARAMS,
VPHAL_CP_LGCA_PH2_GEOCORRECTION,
// Hdr
VPHAL_HDR_GENERIC = 0x400,
VPHAL_HDR_1LAYER,
VPHAL_HDR_2LAYERS,
VPHAL_HDR_3LAYERS,
VPHAL_HDR_4LAYERS,
VPHAL_HDR_5LAYERS,
VPHAL_HDR_6LAYERS,
VPHAL_HDR_7LAYERS,
VPHAL_HDR_8LAYERS,
VPHAL_HDR_AUTO_PER_FRAME_STATE,
// Fdfb - FD
VPHAL_FDFB_FD_DOWNSCALE = 0x500,
VPHAL_FDFB_FD_MLBP,
VPHAL_FDFB_FD_CASCADE,
VPHAL_FDFB_FD_CASCADE1,
VPHAL_FDFB_FD_DOWNSCALE_NOT_FULLY_ENQUEUE,
VPHAL_FDFB_FD_MLBP_NOT_FULLY_ENQUEUE,
VPHAL_FDFB_FD_CASCADE_NOT_FULLY_ENQUEUE,
VPHAL_FDFB_FD_CASCADE1_NOT_FULLY_ENQUEUE,
VPHAL_FDFB_FD_MERGE,
VPHAL_FDFB_FD_MERGE1,
// Fdfb - FLD
VPHAL_FDFB_FLD_CAL_GAUSSIAN_WEIGHT = 0x510,
VPHAL_FDFB_FLD_PREPROCESSING,
VPHAL_FDFB_FLD_RESIZE,
VPHAL_FDFB_FLD_EXTRACT_FEATURE_GET_LANDMARK,
VPHAL_FDFB_FLD_POST_PROCESSING,
VPHAL_FDFB_FLD_VALIDATOR,
VPHAL_FDFB_ELD_PREPROCESSING,
VPHAL_FDFB_ELD_GET_LANDMARK,
VPHAL_FDFB_ELD_POST_PROCESSING,
VPHAL_FDFB_ELD_FILTERING,
// Fdfb - FB
VPHAL_FDFB_FB_VEBOX_SKIN_MAP = 0x520,
VPHAL_FDFB_FB_CMK_AVERAGE_FILTER,
VPHAL_FDFB_FB_CMK_PROCESSING,
VPHAL_FDFB_FB_SMOOTHER,
VPHAL_FDFB_FB_SKIN_BLENDER,
VPHAL_FDFB_FB_CMK_FOUNDATION,
VPHAL_FDFB_FB_CAL_REGIONS,
VPHAL_FDFB_FB_CMK_BLUSH_MAP,
VPHAL_FDFB_FB_CMK_EYE_CIRCLES,
VPHAL_FDFB_FB_SMOOTHER_SKIN_ROI_BLENDER_0,
VPHAL_FDFB_FB_SMOOTHER_SKIN_ROI_BLENDER_1,
VPHAL_FDFB_FB_RED_LIP_CURVE_1,
VPHAL_FDFB_FB_RED_LIP_CURVE_2,
VPHAL_FDFB_FB_RED_LIP_CURVE_3,
VPHAL_FDFB_FB_RED_LIP_CURVE_4,
VPHAL_FDFB_FB_REFINE_LIP_MASK_1,
VPHAL_FDFB_FB_REFINE_LIP_MASK_2,
VPHAL_FDFB_FB_CMK_COLOR_LIP,
VPHAL_FDFB_FB_CMK_BWD_WARP_SCALING,
VPHAL_FDFB_FB_CMK_DATA_MOVE,
VPHAL_FDFB_FB_CMK_BWD_WARP,
VPHAL_FDFB_FB_MDF_SURFACE_COPY,
VPHAL_FDFB_FB_RED_LIP,
VPHAL_FDFB_FB_STD_GEN,
VPHAL_FDFB_FB_CAL_EYECURVE,
VPHAL_FDFB_FB_EYE_BRIGHT_PARAM_GEN,
VPHAL_FDFB_FB_EYE_BRIGHT,
VPHAL_FDFB_FB_EYE_LASH,
VPHAL_FDFB_FB_EYE_LINE,
VPHAL_FDFB_FB_TEETH_WHITEN,
VPHAL_FDFB_FB_EYE_SAHDOW_MASK,
VPHAL_FDFB_FB_EYE_SAHDOW,
VPHAL_FDFB_FB_EYE_COLOR,
// SR
VPHAL_SR_CONV_1X1_32_5,
VPHAL_SR_CONV_1X1_5_32,
VPHAL_SR_CONV_3X3,
VPHAL_SR_SUBPIXEL_CONV_2X2,
VPHAL_SR_CONV_5X5_Y8,
//Media Copy
VPHAL_MCP_VEBOX_COPY,
VPHAL_MCP_RENDER_COPY,
VPHAL_MCP_BLT_COPY,
//OCL FC
VPHAL_OCL_FC_0LAYER,
VPHAL_OCL_FC_1LAYER,
VPHAL_OCL_FC_2LAYER,
VPHAL_OCL_FC_3LAYER,
VPHAL_OCL_FC_4LAYER,
VPHAL_OCL_FC_5LAYER,
VPHAL_OCL_FC_6LAYER,
VPHAL_OCL_FC_7LAYER,
VPHAL_OCL_FC_8LAYER,
//OCL FC w/ Primary Layer
VPHAL_OCL_FC_PRI_1LAYER,
VPHAL_OCL_FC_PRI_2LAYER,
VPHAL_OCL_FC_PRI_3LAYER,
VPHAL_OCL_FC_PRI_4LAYER,
VPHAL_OCL_FC_PRI_5LAYER,
VPHAL_OCL_FC_PRI_6LAYER,
VPHAL_OCL_FC_PRI_7LAYER,
VPHAL_OCL_FC_PRI_8LAYER,
//OCL FC w/ Rotation
VPHAL_OCL_FC_ROT_1LAYER,
VPHAL_OCL_FC_ROT_2LAYER,
VPHAL_OCL_FC_ROT_3LAYER,
VPHAL_OCL_FC_ROT_4LAYER,
VPHAL_OCL_FC_ROT_5LAYER,
VPHAL_OCL_FC_ROT_6LAYER,
VPHAL_OCL_FC_ROT_7LAYER,
VPHAL_OCL_FC_ROT_8LAYER,
//OCL FC FastExpress
VPHAL_OCL_FC_FP,
VPHAL_OCL_FC_FP_ROT,
//OCL 3DLut
VPHAL_OCL_3DLUT,
// ADD TAGS FOR NEW ADVPROC KRNS HERE
VPHAL_PERFTAG_MAX
} VPHAL_PERFTAG, *PVPHAL_PERFTAG;
#ifdef __cplusplus
}
#endif
// Reset packing alignment to project default
#pragma pack(pop)

View File

@ -0,0 +1,95 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================*/
#ifndef _UMKMENUM_H_
#define _UMKMENUM_H_
#ifdef __cplusplus
extern "C" {
#endif
// PROCESSOR_FAMILY
typedef enum PROCESSOR_FAMILY_REC
{
UNKNOWN_PROCESSOR,
P3_PROCESSOR,
P4_PROCESSOR,
MAX_NUM_PROCESSOR
} PROCESSOR_FAMILY;
// GPU Engine
typedef enum GPUENGINE_REC
{
GPUENGINE_1 = 0,
GPUENGINE_2 = 1, // Dual GT Case
GPUENGINE_MAX
} GPUENGINE_ORDINAL;
// GPUNODE
// NOTE: the GPUNODE_*** enums that represent real nodes and have rings must
// stay in sync with the corresponding ones defined in IGFX_GEN6_RING_TYPE
typedef enum GPUNODE_REC
{
GPUNODE_3D = 0, // available by default on all platform
GPUNODE_VIDEO = 1, // available on CTG+, Virtual node
GPUNODE_BLT = 2, // available on GT
GPUNODE_VE = 3, // available on HSW+ (VideoEnhancement), virtual node
GPUNODE_VCS2 = 4, // available on BDW/SKL/KBL GT3+ and CNL,
GPUNODE_CCS0 = 5, //
GPUNODE_REAL_MAX, // all nodes beyond this are virtual nodes - they don't have an actual GPU engine
GPUNODE_PICS = 6, // available on CNL+. Real node but only for KMD internal use. Hence kept after GPUNODE_REAL_MAX (Note: We need to keep it before overlay node)
GPUNODE_OVERLAY = 7,
GPUNODE_GDI2D = 8, // GT virtual node for GDI/Present 2D blt/colorfill
GPUNODE_VXD = 9, // available on BYT
GPUNODE_MAX
} GPUNODE_ORDINAL;
// UMD_DMA_TYPE
typedef enum UMD_DMA_TYPE_REC
{
UMD_UNKNOWN = 0,
UMD_MEDIA = 1,
UMD_DX9 = 2,
UMD_DX10 = 3,
UMD_OGL = 4,
UMD_OCL = 5,
UMD_DX_COMPUTE = 6,
UMD_DX12 = 7,
UMD_TYPE_MAX // this should always be the last one
} UMD_DMA_TYPE;
typedef enum DXVA_OPERATION_ENUM
{
DXVA_OPERATION_NONE = 0,
DXVA_OPERATION_DECODE, // Decode
DXVA_OPERATION_ENCODE, // Encode
} DXVA_OPERATION;
extern char *UmdTypeStr[];
#ifdef __cplusplus
}
#endif
#endif // _UMKMENUM_H_

View File

@ -0,0 +1,280 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================
**
** File Name: sharedata.h
**
** Description: These are data structures that are shared between the KMD
** and the UMD
**
==============================================================================*/
#ifndef _SHAREDATA_H_
#define _SHAREDATA_H_
#include "../common/gtsysinfo.h"
#include "../common/sku_wa.h"
#include "../common/igfxfmid.h"
#include "UmKmEnum.h"
#include "UmKmDmaPerfTimer.h"
#define ADAPTER_STRING_SIZE 250
#ifdef __cplusplus
extern "C" {
#endif
#define UMD_KMD_MAX_REGISTRY_PATH_LENGTH (512)
//===========================================================================
// typedef:
// DRIVER_VERION_INFO
//
// Description:
// This structure is used to communicate Driver Build version between
// KMD and UMD
//
//---------------------------------------------------------------------------
typedef struct __DRIVER_VERSION_INFO
{
unsigned :16;
unsigned DriverBuildNumber :16;
}DRIVER_VERSION_INFO;
// BIT field, '1' (i.e. Set) means cap is supported by KMD
typedef struct __KMD_CAPS_INFO
{
unsigned Gamma_Rgb256x3x16 :1;
unsigned GDIAcceleration :1;
unsigned OsManagedHwContext :1; // wddm1.2+
unsigned GraphicsPreemptionGranularity :3; // wddm1.2+
unsigned ComputePreemptionGranularity :3; // wddm1.2+
unsigned InstrumentationIsEnabled :1; // KMD instrumentation state
unsigned DriverStoreEnabled :1; // wddm2.1+
unsigned :21;
} KMD_CAPS_INFO;
// Programmatically override overlay caps for testing
typedef struct __KMD_OVERLAY_OVERRIDE
{
uint32_t OverrideOverlayCaps : 1; // Override request
uint32_t RGBOverlay : 1; // RGB overlay override
uint32_t YUY2Overlay : 1; // YUY2 overlay override
uint32_t Reserved :29;
} KMD_OVERLAY_OVERRIDE;
// Overlay caps info needed by WDDM 1.1 Changes
typedef struct __KMD_OVERLAY_CAPS_INFO
{
union
{
struct
{
uint32_t FullRangeRGB : 1; // 0x00000001
uint32_t LimitedRangeRGB : 1; // 0x00000002
uint32_t YCbCr_BT601 : 1; // 0x00000004
uint32_t YCbCr_BT709 : 1; // 0x00000008
uint32_t YCbCr_BT601_xvYCC : 1; // 0x00000010
uint32_t YCbCr_BT709_xvYCC : 1; // 0x00000020
uint32_t StretchX : 1; // 0x00000040
uint32_t StretchY : 1; // 0x00000080
uint32_t Reserved :24; // 0xFFFFFF00
} Caps;
uint32_t CapsValue;
};
KMD_OVERLAY_OVERRIDE OVOverride;
uint32_t MaxOverlayDisplayWidth;
uint32_t MaxOverlayDisplayHeight;
uint8_t HWScalerExists;
uint32_t MaxHWScalerStride;
} KMD_OVERLAY_CAPS_INFO;
// Frame Rate
typedef struct
{
uint32_t uiNumerator;
uint32_t uiDenominator;
} FRAME_RATE;
typedef struct __KM_SYSTEM_INFO
{
GT_SYSTEM_INFO SystemInfo;
// ShadowReg 119 caluclated value required for WA <WaProgramMgsrForCorrectSliceSpecificMmioReads>
uint32_t ShadowRegValue;
uint32_t ShadowRegValueforL3SpecificRegReads; // Shadow reg value for L3 bank specific MMIO reads.
uint32_t GfxDevId; // DeviceID
}KM_SYSTEM_INFO;
typedef struct _KM_DEFERRED_WAIT_INFO
{
uint32_t FeatureSupported;
uint32_t ActiveDisplay;
} KM_DEFERRED_WAIT_INFO;
// struct to hold Adapter's BDF
typedef struct _ADAPTER_BDF_
{
union
{
struct
{
uint32_t Bus : 8;
uint32_t Device : 8;
uint32_t Function : 8;
uint32_t Reserved : 8;
};
uint32_t Data;
};
}ADAPTER_BDF;
// Private data structure for D3D callback QueryAdapterInfoCB
//===========================================================================
// typedef:
// _ADAPTER_INFO
//
// Description:
// This structure is private data structure that get passed by UMD to
// KMD during QueryAdapterInfoCB
//
// Note: Structure will be filled by KMD.
//---------------------------------------------------------------------------
#pragma pack (push,1)
typedef struct _ADAPTER_INFO
{
uint32_t KmdVersionInfo; // Version ID
DRIVER_VERSION_INFO DriverVersionInfo; //
PLATFORM GfxPlatform; // Chipset Gfx family, product, render core, display core, etc
SKU_FEATURE_TABLE SkuTable; // SKU feature table
WA_TABLE WaTable; // WA table
uint32_t GfxTimeStampFreq; // In Hz (No. of clock ticks per second). So timestamp base = 1 / GfxTimeStampFreq
uint32_t GfxCoreFrequency; // In MHz.
uint32_t FSBFrequency; // In MHz.
uint32_t MinRenderFreq; // In MHz.
uint32_t MaxRenderFreq; // In MHz.
uint32_t PackageTdp; // TDP Power for the platform (In Watt)
uint32_t MaxFillRate; // Fillrate with Alphablend (In Pix/Clk)
uint32_t NumberOfEUs; // Number of EUs in GT
// NOTE: Name is kept same so that we don't have to change PC_TARGET macro and usage
// of that.
uint32_t dwReleaseTarget; // PC Release Target Information supplied by INF
// Following member can be use by UMD for optimal use of DMA and
// command buffer
uint32_t SizeOfDmaBuffer; // Size of DMA buffer set (In Bytes)
uint32_t PatchLocationListSize; // Size of Patch Location List (In number of entries)
uint32_t AllocationListSize; // Size of Patch Location List (In number of entries)
uint32_t SmallPatchLocationListSize; // Size of Patch Location List for UMD context that needs a small Patch Location List,
// currently only used by media context (In number of entries)
uint32_t DefaultCmdBufferSize; // Size of Cmd buffer default location
// Following Members can be use for any UMD optimization (like Size of vertex buffer to allocate)
// any cacheline related read/write, etc
int64_t GfxMemorySize; // Total GFX memory (In MBytes)
uint32_t SystemMemorySize; // Total System Memory (In MBytes)
uint32_t CacheLineSize; // Processor CacheLine size
PROCESSOR_FAMILY ProcessorFamily; // Processor Family
uint8_t IsHTSupported; // Is Hyper Threaded CPU
uint8_t IsMutiCoreCpu; // Is Multi Core CPU
uint8_t IsVTDSupported; // Is Chipset VT is supported
char DeviceRegistryPath[UMD_KMD_MAX_REGISTRY_PATH_LENGTH]; // Array that contains the device registry path
uint32_t RegistryPathLength; // Actual chars (not including any trailing NULL) in the array set by the KMD
int64_t DedicatedVideoMemory; // Dedicated Video Memory
int64_t SystemSharedMemory; // System Shared Memory
int64_t SystemVideoMemory; // SystemVideoMemory
FRAME_RATE OutputFrameRate; // Output Frame Rate
FRAME_RATE InputFrameRate; // Input Frame Rate
KMD_CAPS_INFO Caps; // List of capabilities supported by the KMD
KMD_OVERLAY_CAPS_INFO OverlayCaps; // List of overlay capabilities supported
GT_SYSTEM_INFO SystemInfo; // List of system details
KM_DEFERRED_WAIT_INFO DeferredWaitInfo; // Indicates if DeferredWait feature is enabled and value of active display
#ifdef _WIN32
ADAPTER_BDF stAdapterBDF; // Adapter BDF
#endif
} ADAPTER_INFO, *PADAPTER_INFO;
#pragma pack (pop)
#define MAX_ENGINE_INSTANCE_PER_CLASS 4
// GEN11 Media Scalability 2.0: context based scheduling
typedef struct MEDIA_CONTEXT_REQUIREMENT_REC
{
union
{
struct
{
uint32_t UsingSFC : 1; // Use SFC or not
uint32_t HWRestrictedEngine : 1;
#if (_DEBUG || _RELEASE_INTERNAL || __KMDULT)
uint32_t Reserved : 29;
uint32_t DebugOverride : 1; // Debug & validation usage
#else
uint32_t Reserved : 30;
#endif
};
uint32_t Flags;
};
uint32_t LRCACount;
// Logical engine instances used by this context; valid only if flag DebugOverride is set.
uint8_t EngineInstance[MAX_ENGINE_INSTANCE_PER_CLASS];
} MEDIA_CONTEXT_REQUIREMENT, *PMEDIA_CONTEXT_REQUIREMENT;
// Bit-Struct for Driver's Use of D3DDDI_PATCHLOCATIONLIST.DriverId
typedef union __D3DDDI_PATCHLOCATIONLIST_DRIVERID
{
struct
{
uint32_t UseGlobalGtt : 1; // Indicates patch is to use global GTT space address (instead of PPGTT space).
uint32_t HasDecryptBits : 1;
uint32_t RenderTargetEnable : 1; // Indicates this is an output surface that may need to be encrypted
int32_t DecryptBitDwordOffset : 8; // signed offset (in # of DWORDS) from the patch location to where the cmd's decrypt bit is
uint32_t DecryptBitNumber : 5; // which bit to set in the dword specified by DecryptBitDwordOffset (0 - 31)
uint32_t GpGpuCsrBaseAddress : 1; // this patch location is for the GPGPU Preempt buffer
uint32_t SurfaceStateBaseAddress : 1; // Indicates this is patch for SBA.SurfaceStateBaseAddress
uint32_t PreemptPatchType : 3; // Contains list of addresses that may need patching due to Preemption/Resubmit.
uint32_t PatchLowDword : 1; // 32-bit patch despite 64-bit platform--Low DWORD.
uint32_t PatchHighDword : 1; // 32-bit patch despite 64-bit platform--High DWORD.
uint32_t StateSip : 1; // STATE_SIP address that needs to be patched in the context image (for thread-level preemption)
uint32_t GpGpuWSDIBegin : 1; // The start of the SDI command seq before GPGPU_WALKER (for restarting thread-level workload)
uint32_t GpGpuWSDIEnd : 1; // The end of the SDI command seq before GPGPU_WALKER (for restarting thread-level workload)
uint32_t NullPatch : 1; // Don't perform KMD patching (used for SVM, Tiled/Sparse Resources and ExistingSysMem Virtual Padding).
uint32_t UpperBoundsPatch : 1; // Indicates the patch is for an UpperBounds/"out-of-bounds" address
uint32_t BindingTablePoolPatch : 1; // Indicates the patch is for Binding Table Pool. Needed for bindless head testing. Remove later.
};
uint32_t Value;
} D3DDDI_PATCHLOCATIONLIST_DRIVERID;
#ifdef __cplusplus
}
#endif
#endif // _SHAREDATA_H_

View File

@ -0,0 +1,206 @@
//=================================================================================/
//Copyright (c) 2017 Intel Corporation /
// /
//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, sublicense, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL THE /
//AUTHORS OR COPYRIGHT HOLDERS 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. /
//---------------------------------------------------------------------------------
#ifndef _G_GFXDEBUG_H_
#define _G_GFXDEBUG_H_
//===================== Debug Message Levels========================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#define GFXDBG_OFF (0x00000000)
#define GFXDBG_CRITICAL (0x00000001)
#define GFXDBG_NORMAL (0x00000002)
#define GFXDBG_VERBOSE (0x00000004)
#define GFXDBG_FUNCTION (0x80000000)
#define GFXDBG_NONCRITICAL (0x00000010)
#define GFXDBG_CRITICAL_DEBUG (0x00000020)
#define GFXDBG_VERBOSE_VERBOSITY (0x00000040)
#define GFXDBG_PROTOCAL (0x00000100)
#define GFXDBG_FUNCTION_ENTRY (0x80000000)
#define GFXDBG_FUNCTION_EXIT (0x80000000)
#define GFXDBG_FUNCTION_ENTRY_VERBOSE (0x20000000)
#define GFXDBG_FUNCTION_EXIT_VERBOSE (0x20000000)
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#define DBG_OFF GFXDBG_OFF
#define DBG_CRITICAL GFXDBG_CRITICAL
#define DBG_NORMAL GFXDBG_NORMAL
#define DBG_VERBOSE GFXDBG_VERBOSE
#define DBG_FUNCTION GFXDBG_FUNCTION
#define DBG_NONCRITICAL GFXDBG_NONCRITICAL
#define DBG_CRITICAL_DEBUG GFXDBG_CRITICAL_DEBUG
#define DBG_VERBOSE_VERBOSITY GFXDBG_VERBOSE_VERBOSITY
#define DBG_PROTOCAL GFXDBG_PROTOCAL
#define DBG_FUNCTION_ENTRY GFXDBG_FUNCTION_ENTRY
#define DBG_FUNCTION_EXIT GFXDBG_FUNCTION_EXIT
#define DBG_FUNCTION_ENTRY_VERBOSE GFXDBG_FUNCTION_ENTRY_VERBOSE
#define DBG_FUNCTION_EXIT_VERBOSE GFXDBG_FUNCTION_EXIT_VERBOSE
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
// This enum is used by DebugControlUI
// Use #define GFXDBG_<LEVEL> to specify debug level in driver code.
enum
{
GFXDBG_ML_OFF = 0,
GFXDBG_ML_CRITICAL = 1,
GFXDBG_ML_NORMAL = 2,
GFXDBG_ML_VERBOSE = 3,
GFXDBG_ML_FUNCTION = 4,
GFXDBG_ML_COUNT = 5,
};
//===================== Component ID's =============================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
enum
{
GFX_COMPONENT_GMM = 2,
GFX_COMPONENT_COUNT = 12,
};
//===================== Component Masks ============================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
enum
{
GFX_GMM_MASK = (1 << GFX_COMPONENT_GMM),
};
//================= Component Memory Allocation Tags ===============
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
//
// Tags are 4 byte ASCII character codes in the range 0-127 decimal.
// The leading @ character is to provide Intel unique tags.
// Passed in calls to ExAllocatePoolWithTag/ExFreePoolWithTag.
// Useful for pool tracking.
//
#define GFX_COMPONENT_GMM_TAG 'MMG@'
#define GFX_DEFAULT_TAG 'CTNI'
//======================= Component ALLOC_TAG ======================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#ifdef __MINIPORT
#define REG_ASSERT_ENABLE_MASK L"z AssertEnableMask"
#define REG_DEBUG_ENABLE_MASK L"z DebugEnableMask"
#define REG_RINGBUF_DEBUG_MASK L"z RingBufDbgMask"
#define REG_REPORT_ASSERT_ENABLE L"z ReportAssertEnable"
#define REG_ASSERT_BREAK_DISABLE L"z AssertBreakDisable"
#define REG_GFX_COMPONENT_GMM L"z GMM_Debug_Lvl"
#endif
//======================= Component ALLOC_TAG ======================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#if defined(__MINIPORT)
#define ALLOC_TAG GFX_COMPONENT_MINIPORT_TAG
#elif defined(__SOFTBIOS)
#define ALLOC_TAG GFX_COMPONENT_SOFTBIOS_TAG
#elif defined(__KCH)
#define ALLOC_TAG GFX_COMPONENT_KCH_TAG
#elif defined(__AIM)
#define ALLOC_TAG GFX_COMPONENT_AIM_TAG
#else
#define ALLOC_TAG GFX_DEFAULT_TAG
#endif
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#ifdef __GFXDEBUG_C__ // Only to be defined by "gfxDebug.c" file.
// Define the array of component ID strings. Note that the sequence
// of these strings must match the component ID's listed above.
char *ComponentIdStrings[] = {
"INTC GMM: ",
};
#endif /* __GFXDEBUG_C__ */
//================ Prototype for print routines ====================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#ifdef __cplusplus
extern "C" {
#endif
void GMMPrintMessage(unsigned long DebugLevel, const char *DebugMessageFmt, ...);
#ifdef __cplusplus
}
#endif
//==================== Generate debug routines =====================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
//
// Debug routines either map into the base PrintMessage
// routine or they map into nothing. A code segment such as
// 'DebugPrint(args)' gets converted to '(args)' which
// is converted to nothing by the C compiler.
#if __DEBUG_MESSAGE
#define GMMDebugMessage GMMPrintMessage
#define GMMDebugMessage(...)
#else
#define GMMDebugMessage(...)
#endif /* __DEBUG_MESSSAGE */
//=================== Generate release routines ====================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
//
// Release routines either map into the base PrintMessage
// routine or they map into nothing. A code segment such as
// 'ReleasePrint(args)' gets converted to '(args)' which
// is converted to nothing by the C compiler.
#if __RELEASE_MESSAGE
#define GMMReleaseMessage GMMPrintMessage
#else
#define GMMReleaseMessage(...)
#endif /* __RELEASE_MESSSAGE */
//=================== Generate ASSERT macros ======================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#define GMMASSERT(expr) __ASSERT(pDebugControl, GFX_COMPONENT_GMM, GFX_GMM_MASK, expr)
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#define GMMASSERTPTR(expr, ret) __ASSERTPTR(pDebugControl, GFX_COMPONENT_GMM, GFX_GMM_MASK, expr, ret)
//=========== void return value for ASSERPTR macros ==========================
#define VOIDRETURN
//============= Generate Message printing routines =================
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#ifdef __GFXDEBUG_C__ // Only to be defined by "gfxDebug.c" file.
#ifdef __GMM
MESSAGE_FUNCTION(GMMPrintMessage, GFX_COMPONENT_GMM);
#endif /* __GMM */
// WARNING!!! DO NOT MODIFY this file - see detail above copyright.
#endif /* __GFXDEBUG_C__ */
#endif //_G_GFXDEBUG_H_

View File

@ -0,0 +1,378 @@
/*==============================================================================
Copyright(c) 2017 Intel Corporation
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, sublicense,
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 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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
============================================================================
**
** File Name: gfxDebug.h
**
** Description:
**
** Environment:
**
** Notes:
**
============================================================================*/
#pragma once
#ifndef _GFXDEBUG_H_
#define _GFXDEBUG_H_
#include <stdint.h>
#if defined(D3D) && !defined (USERMODE_DRIVER)
// The D3D XP Kernel Mode driver will continue to use the old scheme until it
// has been updated.
#else
// This portion is used by new stile debug scheme.
// NOTE: There is some overlap between defines.
//========================================================================
// Controlling Debug Messages: There are two types of output messages -
// debug or release output message. These are controlled through the two
// flags listed below.
#ifdef _DEBUG
#define __DEBUG_MESSAGE 1
#define __RELEASE_MESSAGE 1
#else
#define __DEBUG_MESSAGE 0
#define __RELEASE_MESSAGE 1
#endif
// !!! HAVE TO FIGURE OOUT HOW TO INCLUDE THIS CORRECTLY
// #include "video.h"
//==== Define global debug message routine ===================
#if __DEBUG_MESSAGE || __RELEASE_MESSAGE
#ifdef __UMD
#include "stdlib.h"
#define MESSAGE_FUNCTION(FUNCTION_NAME,COMPONENT_ID) \
\
void FUNCTION_NAME(unsigned long MessageLevel, const char *MessageFmt, ...) \
{ \
uint32_t Length = 0; \
char *PrintBuffer = NULL; \
char *Prefix = NULL; \
va_list ArgList; \
\
unsigned long ComponentId = COMPONENT_ID; \
unsigned long ComponentMask = 1 << COMPONENT_ID; \
\
/* Ensure that CRITICAL messages are printed if the setting of the */ \
/* global debug variables flag is NORMAL or VERBOSE. Similarly, if */ \
/* the setting of the debug variables flag is NORMAL, ensure that */ \
/* the VERBOSE message are printed out too! */ \
\
if (MessageLevel & GFXDBG_CRITICAL) \
{ \
MessageLevel |= GFXDBG_NORMAL | GFXDBG_VERBOSE; \
} \
else if (MessageLevel & GFXDBG_NORMAL) \
{ \
MessageLevel |= GFXDBG_VERBOSE; \
} \
\
/* Some of routines need to call the debug message functionality */ \
/* before the DebugControl variable has been initialized. Hence, if */ \
/* pDebugControl is NULL, unconditionally print the debug message. */ \
\
if ((pDebugControl == NULL) || \
((pDebugControl->DebugEnableMask & ComponentMask) && \
(MessageLevel & pDebugControl->DebugLevel[ComponentId]))) \
{ \
va_start (ArgList, MessageFmt); \
Length = _vscprintf(MessageFmt, ArgList) + 1; \
PrintBuffer = malloc(Length * sizeof(char)); \
if (PrintBuffer) \
{ \
vsprintf_s(PrintBuffer, Length, MessageFmt, ArgList); \
Prefix = ComponentIdStrings[ComponentId]; \
__MESSAGE_PRINT(Prefix, PrintBuffer); \
free(PrintBuffer); \
} \
else \
{ \
__MESSAGE_PRINT("INTC DEBUG: ", \
"Can not allocate print buffer\n"); \
__debugbreak(); \
} \
va_end(ArgList); \
} \
}
#else
#ifndef __linux__
#include "igdKrnlEtwMacros.h"
#endif
#define MESSAGE_FUNCTION(FUNCTION_NAME,COMPONENT_ID) \
\
void FUNCTION_NAME(unsigned long MessageLevel, const char *MessageFmt, ...) \
{ \
int32_t Length = 0; \
char PrintBuffer[GFX_MAX_MESSAGE_LENGTH]; \
char *Prefix = NULL; \
va_list ArgList; \
unsigned long GfxDbgLvl = MessageLevel; \
unsigned long ComponentId = COMPONENT_ID; \
unsigned long ComponentMask = 1 << COMPONENT_ID; \
\
/* Ensure that CRITICAL messages are printed if the setting of the */ \
/* global debug variables flag is NORMAL or VERBOSE. Similarly, if */ \
/* the setting of the debug variables flag is NORMAL, ensure that */ \
/* the VERBOSE message are printed out too! */ \
\
if (MessageLevel & GFXDBG_CRITICAL) \
{ \
MessageLevel |= GFXDBG_NORMAL | GFXDBG_VERBOSE; \
} \
else if (MessageLevel & GFXDBG_NORMAL) \
{ \
MessageLevel |= GFXDBG_VERBOSE; \
} \
\
/* Some of routines need to call the debug message functionality */ \
/* before the DebugControl variable has been initialized. Hence, if */ \
/* pDebugControl is NULL, unconditionally print the debug message. */ \
\
va_start(ArgList, MessageFmt); \
Length = _vsnprintf_s(PrintBuffer, GFX_MAX_MESSAGE_LENGTH, \
sizeof(PrintBuffer), \
MessageFmt, ArgList); \
if (Length >= 0) \
{ \
EtwDebugPrint((uint16_t)GfxDbgLvl, (uint16_t)ComponentId, PrintBuffer); \
\
if ((pDebugControl == NULL) || \
((pDebugControl->DebugEnableMask & ComponentMask) && \
(MessageLevel & pDebugControl->DebugLevel[ComponentId]))) \
{ \
Prefix = ComponentIdStrings[ComponentId]; \
__MESSAGE_PRINT(Prefix, PrintBuffer); \
} \
} \
else \
{ \
__MESSAGE_PRINT("INTC DEBUG: ", \
"The print buffer is to small\n"); \
__debugbreak(); \
} \
va_end(ArgList); \
} \
#endif
#endif // __DEBUG_MESSAGE || __RELEASE_MESSAGE
// Define a max size for the intermediate buffer for storing the
// debug error message string.
#define GFX_MAX_MESSAGE_LENGTH (512)
//==============================================================================
// From winnt.h
//
// C_ASSERT() can be used to perform many COMPILE-TIME assertions:
// type sizes, field offsets, etc.
//
// An assertion failure results in error C2118: negative subscript.
//
// When this assertion is to be used in the middle of a code block,
// use it within {} - e.g. {__GL_C_ASSERT (__GL_NUM == 0);}
//
// Since all components may not want to include "winnt.h", define a
// C_ASSERT that can be used by all components.
#ifndef GFX_C_ASSERT
#define GFX_C_ASSERT(e) typedef char __GFX_C_ASSERT__[(e)?1:-1]
#endif
// Unfortunately, we cannot include "g_debug.h" before this structure
// definition since it needs this structure - but then this structure
// requires the number of components. We get around this by using a
// large enough number for the component count.
#define MAX_COMPONENT_COUNT_DONOTUSE (20)
//------------------------------------------------------------------------------
// Debug and assert control structure. Note that each component has
// a separate variable to control its debug level.
//------------------------------------------------------------------------------
typedef struct GFX_DEBUG_CONTROL_REC
{
unsigned long Version;
unsigned long Size;
unsigned long AssertEnableMask;
unsigned long EnableDebugFileDump;
unsigned long DebugEnableMask;
unsigned long RingBufDbgMask;
unsigned long ReportAssertEnable;
unsigned long AssertBreakDisable;
#ifndef __UMD
unsigned long DebugLevel[MAX_COMPONENT_COUNT_DONOTUSE];
#endif
} GFX_DEBUG_CONTROL, *PGFX_DEBUG_CONTROL;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GFXDEBUG_C__ // Only to be defined by "gfxDebug.c" file.
GFX_DEBUG_CONTROL *pDebugControl = NULL;
#else
extern GFX_DEBUG_CONTROL *pDebugControl;
#endif
#ifdef __cplusplus
}
#endif
void InitializeDebugVariables(PGFX_DEBUG_CONTROL pDebugControl);
#if (defined(_DEBUG) || defined( _RELEASE_INTERNAL ))
#if ( !defined(REPORT_ASSERT) || !defined(REPORT_ASSERT_ETW)) && defined( _WIN32 )
#include "AssertTracer.h"
#elif !defined(REPORT_ASSERT)
#define REPORT_ASSERT( expr )
#define REPORT_ASSERT_ETW(compId, componentMask, expr)
#endif
#endif
#ifdef _DEBUG
// This function doesn't do anything, it exists so you can put
// a break point at the XXX_ASSERT and when you step into it
// you will step into this function and then you can
// disable/enable the assert by setting AssertOn to FALSE/TRUE.
#ifdef _MSC_VER
static __inline int ToggleAssert(int AssertOn)
#else
static inline int ToggleAssert(int AssertOn)
#endif
{
return AssertOn;
};
#define __ASSERT(pDebugControl, compId, componentMask, expr) \
{ \
static int __assertOn = TRUE; \
__assertOn = ToggleAssert(__assertOn); \
REPORT_ASSERT_ETW(compId, componentMask, expr); \
if (__assertOn) \
{ \
if(!(pDebugControl)) \
{ \
if(!(expr)) \
{ \
REPORT_ASSERT(expr); \
__debugbreak(); \
} \
} \
else \
{ \
if (((componentMask) & pDebugControl->AssertEnableMask) && \
!(expr)) \
{ \
if(pDebugControl->ReportAssertEnable) \
{ \
REPORT_ASSERT(expr); \
} \
if(!pDebugControl->AssertBreakDisable) \
{ \
__debugbreak(); \
} \
} \
\
} \
} \
}
#define __ASSERTPTR(pDebugControl, compId, componentMask, expr, ret) \
{ \
__ASSERT(pDebugControl, compId, componentMask, expr); \
if (!expr) \
{ \
return ret; \
} \
}
#elif defined(_RELEASE_INTERNAL)
#define __ASSERT(pDebugControl, compId, compMask, expr) \
{ \
REPORT_ASSERT_ETW(compId, compMask, expr); \
}
#define __ASSERTPTR(pDebugControl, compId, compMask, expr, ret) \
{ \
__ASSERT(pDebugControl, compId, compMask, expr); \
if (!expr) \
{ \
return ret; \
} \
}
#else
#define __ASSERT(pDebugControl, compId, compMask, expr)
#define __ASSERTPTR(pDebugControl, compId, compMask ,expr, ret)
#endif // _DEBUG
#define __RELEASEASSERT(pDebugControl, componentMask, expr) \
{ \
if (((componentMask) & pDebugControl->AssertEnableMask) && !(expr)) \
{ \
__debugbreak(); \
} \
}
// The common code may use a macro such as "GFXASSERT". This is defined
// to be UMD or KMD ASSERT based on the component being compiled.
#ifdef __UMD
#define GFXASSERT UMDASSERT
#else
#define GFXASSERT KM_ASSERT
#endif
#include <stdint.h>
#include "g_gfxDebug.h" // Include automatically generated component
// specific macros etc.
GFX_C_ASSERT(MAX_COMPONENT_COUNT_DONOTUSE >= GFX_COMPONENT_COUNT);
// !!! WE MIGHT BE ABLE TO DELETE THE FOLLOWING, DOUBLE CHECK FIRST
// Ring buffer proxy
#define ENABLE_RINGBUF_PROXY_IN_RELEASE_BUILD 0
#endif // D3D not defined
#endif // _GFXDEBUG_H_

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,220 @@
/*
* Copyright (c) 2017, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
//!
//! \file cm_rt_api_os.h
//! \brief Contains Linux Specific APIs and Definitions for CM
//!
#ifndef __CM_RT_API_OS_H__
#define __CM_RT_API_OS_H__
class CmSurface2D
{
public:
CM_RT_API virtual INT GetIndex( SurfaceIndex*& pIndex ) = 0;
CM_RT_API virtual INT ReadSurface( unsigned char* pSysMem, CmEvent* pEvent, UINT64 sysMemSize = 0xFFFFFFFFFFFFFFFFULL ) = 0;
CM_RT_API virtual INT WriteSurface( const unsigned char* pSysMem, CmEvent* pEvent, UINT64 sysMemSize = 0xFFFFFFFFFFFFFFFFULL ) = 0;
CM_RT_API virtual INT ReadSurfaceStride( unsigned char* pSysMem, CmEvent* pEvent, const UINT stride, UINT64 sysMemSize = 0xFFFFFFFFFFFFFFFFULL ) = 0;
CM_RT_API virtual INT WriteSurfaceStride( const unsigned char* pSysMem, CmEvent* pEvent, const UINT stride, UINT64 sysMemSize = 0xFFFFFFFFFFFFFFFFULL ) = 0;
CM_RT_API virtual INT InitSurface(const DWORD initValue, CmEvent* pEvent, unsigned int useGPU = 0 ) = 0;
CM_RT_API virtual INT GetVaSurfaceID( VASurfaceID &iVASurface) = 0;
CM_RT_API virtual INT ReadSurfaceHybridStrides( unsigned char* pSysMem, CmEvent* pEvent, const UINT iWidthStride, const UINT iHeightStride, UINT64 sysMemSize = 0xFFFFFFFFFFFFFFFFULL, UINT uiOption = 0 ) = 0;
CM_RT_API virtual INT WriteSurfaceHybridStrides( const unsigned char* pSysMem, CmEvent* pEvent, const UINT iWidthStride, const UINT iHeightStride, UINT64 sysMemSize = 0xFFFFFFFFFFFFFFFFULL, UINT uiOption = 0 ) = 0;
CM_RT_API virtual INT SelectMemoryObjectControlSetting(MEMORY_OBJECT_CONTROL option) = 0;
CM_RT_API virtual INT SetProperty(CM_FRAME_TYPE frameType) = 0;
CM_RT_API virtual INT SetSurfaceStateParam( SurfaceIndex *pSurfIndex, const CM_SURFACE2D_STATE_PARAM *pSSParam ) = 0;
protected:
~CmSurface2D(){}
};
class CmDevice
{
public:
CM_RT_API virtual INT CreateBuffer(UINT size, CmBuffer* & pSurface )=0;
CM_RT_API virtual INT CreateSurface2D(UINT width, UINT height, CM_SURFACE_FORMAT format, CmSurface2D* & pSurface ) = 0;
CM_RT_API virtual INT CreateSurface3D(UINT width, UINT height, UINT depth, CM_SURFACE_FORMAT format, CmSurface3D* & pSurface ) = 0;
CM_RT_API virtual INT CreateSurface2D( VASurfaceID iVASurface, CmSurface2D* & pSurface ) = 0;
CM_RT_API virtual INT CreateSurface2D( VASurfaceID* iVASurface, const UINT surfaceCount, CmSurface2D** pSurface ) = 0;
CM_RT_API virtual INT DestroySurface( CmBuffer* & pSurface) = 0;
CM_RT_API virtual INT DestroySurface( CmSurface2D* & pSurface) = 0;
CM_RT_API virtual INT DestroySurface( CmSurface3D* & pSurface) = 0;
CM_RT_API virtual INT CreateQueue( CmQueue* & pQueue) = 0;
CM_RT_API virtual INT LoadProgram( void* pCommonISACode, const UINT size, CmProgram*& pProgram, const char* options = nullptr ) = 0;
CM_RT_API virtual INT CreateKernel( CmProgram* pProgram, const char* kernelName, CmKernel* & pKernel, const char* options = nullptr) = 0;
CM_RT_API virtual INT CreateKernel( CmProgram* pProgram, const char* kernelName, const void * fncPnt, CmKernel* & pKernel, const char* options = nullptr) = 0;
CM_RT_API virtual INT CreateSampler( const CM_SAMPLER_STATE & sampleState, CmSampler* & pSampler ) = 0;
CM_RT_API virtual INT DestroyKernel( CmKernel*& pKernel) = 0;
CM_RT_API virtual INT DestroySampler( CmSampler*& pSampler ) = 0;
CM_RT_API virtual INT DestroyProgram( CmProgram*& pProgram ) = 0;
CM_RT_API virtual INT DestroyThreadSpace( CmThreadSpace* & pTS ) = 0;
CM_RT_API virtual INT CreateTask(CmTask *& pTask)=0;
CM_RT_API virtual INT DestroyTask(CmTask*& pTask)=0;
CM_RT_API virtual INT GetCaps(CM_DEVICE_CAP_NAME capName, size_t& capValueSize, void* pCapValue ) = 0;
CM_RT_API virtual INT CreateThreadSpace( UINT width, UINT height, CmThreadSpace* & pTS ) = 0;
CM_RT_API virtual INT CreateBufferUP(UINT size, void* pSystMem, CmBufferUP* & pSurface )=0;
CM_RT_API virtual INT DestroyBufferUP( CmBufferUP* & pSurface) = 0;
CM_RT_API virtual INT GetSurface2DInfo( UINT width, UINT height, CM_SURFACE_FORMAT format, UINT & pitch, UINT & physicalSize)= 0;
CM_RT_API virtual INT CreateSurface2DUP( UINT width, UINT height, CM_SURFACE_FORMAT format, void* pSysMem, CmSurface2DUP* & pSurface )= 0;
CM_RT_API virtual INT DestroySurface2DUP( CmSurface2DUP* & pSurface) = 0;
CM_RT_API virtual INT CreateVmeSurfaceG7_5 ( CmSurface2D* pCurSurface, CmSurface2D** pForwardSurface, CmSurface2D** pBackwardSurface, const UINT surfaceCountForward, const UINT surfaceCountBackward, SurfaceIndex* & pVmeIndex )=0;
CM_RT_API virtual INT DestroyVmeSurfaceG7_5( SurfaceIndex* & pVmeIndex ) = 0;
CM_RT_API virtual INT CreateSampler8x8(const CM_SAMPLER_8X8_DESCR & smplDescr, CmSampler8x8*& psmplrState)=0;
CM_RT_API virtual INT DestroySampler8x8( CmSampler8x8*& pSampler )=0;
CM_RT_API virtual INT CreateSampler8x8Surface(CmSurface2D* p2DSurface, SurfaceIndex* & pDIIndex, CM_SAMPLER8x8_SURFACE surf_type = CM_VA_SURFACE, CM_SURFACE_ADDRESS_CONTROL_MODE address_mode = CM_SURFACE_CLAMP )=0;
CM_RT_API virtual INT DestroySampler8x8Surface(SurfaceIndex* & pDIIndex)=0;
CM_RT_API virtual INT CreateThreadGroupSpace( UINT thrdSpaceWidth, UINT thrdSpaceHeight, UINT grpSpaceWidth, UINT grpSpaceHeight, CmThreadGroupSpace*& pTGS ) = 0;
CM_RT_API virtual INT DestroyThreadGroupSpace(CmThreadGroupSpace*& pTGS) = 0;
CM_RT_API virtual INT SetL3Config(const L3ConfigRegisterValues *l3_c) = 0;
CM_RT_API virtual INT SetSuggestedL3Config( L3_SUGGEST_CONFIG l3_s_c) = 0;
CM_RT_API virtual INT SetCaps(CM_DEVICE_CAP_NAME capName, size_t capValueSize, void* pCapValue) = 0;
CM_RT_API virtual INT CreateSamplerSurface2D(CmSurface2D* p2DSurface, SurfaceIndex* & pSamplerSurfaceIndex) = 0;
CM_RT_API virtual INT CreateSamplerSurface3D(CmSurface3D* p3DSurface, SurfaceIndex* & pSamplerSurfaceIndex) = 0;
CM_RT_API virtual INT DestroySamplerSurface(SurfaceIndex* & pSamplerSurfaceIndex) = 0;
CM_RT_API virtual INT InitPrintBuffer(size_t printbufsize = 1048576) = 0;
CM_RT_API virtual INT FlushPrintBuffer() = 0;
CM_RT_API virtual INT CreateVebox( CmVebox* & pVebox ) = 0;
CM_RT_API virtual INT DestroyVebox( CmVebox* & pVebox ) = 0;
CM_RT_API virtual INT GetVaDpy(VADisplay* & pva_dpy) = 0;
CM_RT_API virtual INT CreateVaSurface2D( UINT width, UINT height, CM_SURFACE_FORMAT format, VASurfaceID & iVASurface, CmSurface2D* & pSurface) = 0;
CM_RT_API virtual INT CreateBufferSVM(UINT size, void* & pSystMem, uint32_t accessFlag, CmBufferSVM* & pSurface ) = 0;
CM_RT_API virtual INT DestroyBufferSVM( CmBufferSVM* & pSurface) = 0;
CM_RT_API virtual INT CreateSamplerSurface2DUP(CmSurface2DUP* p2DUPSurface, SurfaceIndex* & pSamplerSurfaceIndex) = 0;
CM_RT_API virtual INT CloneKernel( CmKernel * &pKernelDest, CmKernel * pKernelSrc ) = 0;
CM_RT_API virtual INT CreateSurface2DAlias(CmSurface2D* p2DSurface, SurfaceIndex* &aliasSurfaceIndex) = 0;
CM_RT_API virtual INT CreateHevcVmeSurfaceG10 ( CmSurface2D* pCurSurface, CmSurface2D** pForwardSurface, CmSurface2D** pBackwardSurface, const UINT surfaceCountForward, const UINT surfaceCountBackward, SurfaceIndex* & pVmeIndex )=0;
CM_RT_API virtual INT DestroyHevcVmeSurfaceG10( SurfaceIndex* & pVmeIndex )=0;
CM_RT_API virtual INT CreateSamplerEx( const CM_SAMPLER_STATE_EX & sampleState, CmSampler* & pSampler ) = 0;
CM_RT_API virtual INT FlushPrintBufferIntoFile(const char *filename) = 0;
CM_RT_API virtual INT CreateThreadGroupSpaceEx(UINT thrdSpaceWidth, UINT thrdSpaceHeight, UINT thrdSpaceDepth, UINT grpSpaceWidth, UINT grpSpaceHeight, UINT grpSpaceDepth, CmThreadGroupSpace*& pTGS) = 0;
CM_RT_API virtual INT CreateSampler8x8SurfaceEx(CmSurface2D* p2DSurface, SurfaceIndex* & pDIIndex, CM_SAMPLER8x8_SURFACE surf_type = CM_VA_SURFACE, CM_SURFACE_ADDRESS_CONTROL_MODE address_mode = CM_SURFACE_CLAMP, CM_FLAG* pFlag = nullptr) = 0;
CM_RT_API virtual INT CreateSamplerSurface2DEx(CmSurface2D* p2DSurface, SurfaceIndex* & pSamplerSurfaceIndex, CM_FLAG* pFlag = nullptr) = 0;
CM_RT_API virtual INT CreateBufferAlias(CmBuffer *pBuffer, SurfaceIndex* &pAliasIndex) = 0;
CM_RT_API virtual INT SetVmeSurfaceStateParam(SurfaceIndex* pVmeIndex, CM_VME_SURFACE_STATE_PARAM *pSSParam) = 0;
CM_RT_API virtual int32_t GetVISAVersion(uint32_t& majorVersion, uint32_t& minorVersion) = 0;
CM_RT_API virtual int32_t CreateQueueEx(CmQueue *&pQueue, CM_QUEUE_CREATE_OPTION QueueCreateOption = CM_DEFAULT_QUEUE_CREATE_OPTION) = 0;
CM_RT_API virtual INT CreateBufferStateless(size_t size,
uint32_t option,
void *sysMem,
CmBufferStateless *&pBufferStateless) = 0;
CM_RT_API virtual INT DestroyBufferStateless(CmBufferStateless *&pSurface) = 0;
CM_RT_API virtual int32_t DispatchTask() = 0;
CM_RT_API virtual INT CreateSurface2DStateless(uint32_t width,
uint32_t height,
uint32_t &pitch,
CmSurface2DStateless *&pSurface) = 0;
CM_RT_API virtual int32_t DestroySurface2DStateless(CmSurface2DStateless *&pSurface) = 0;
//adding new functions in the bottom is a must
protected:
~CmDevice(){}
};
#ifndef __SURFACE_SAMPLER_INDEX_DEFINED__
#define __SURFACE_SAMPLER_INDEX_DEFINED__
class SurfaceIndex
{
public:
CM_NOINLINE SurfaceIndex() { index = 0; };
CM_NOINLINE SurfaceIndex(const SurfaceIndex& _src) { index = _src.index; };
CM_NOINLINE SurfaceIndex(const unsigned int& _n) { index = _n; };
CM_NOINLINE SurfaceIndex& operator = (const unsigned int& _n) { this->index = _n; return *this; };
CM_NOINLINE SurfaceIndex& operator + (const unsigned int& _n) { this->index += _n; return *this; };
virtual unsigned int get_data(void) { return index; };
virtual ~SurfaceIndex(){};
private:
unsigned int index;
unsigned char extra_byte; // an extra byte to align the object size among OSes
};
class SamplerIndex
{
public:
CM_NOINLINE SamplerIndex() { index = 0; };
CM_NOINLINE SamplerIndex(SamplerIndex& _src) { index = _src.get_data(); };
CM_NOINLINE SamplerIndex(const unsigned int& _n) { index = _n; };
CM_NOINLINE SamplerIndex& operator = (const unsigned int& _n) { this->index = _n; return *this; };
virtual unsigned int get_data(void) { return index; };
virtual ~SamplerIndex(){};
private:
unsigned int index;
unsigned char extra_byte; // an extra byte to align the object size among OSes
};
#endif /* __SURFACE_SAMPLER_INDEX_DEFINED__ */
typedef enum _AdapterInfoType
{
Description, // char Description[ 256 ];
VendorId, // uint32_t VendorId;
DeviceId, // uint32_t DeviceId;
SubSysId, // uint32_t SubSysId;
Revision, // uint32_t Revision;
DedicatedVideoMemory, // uint32_t DedicatedVideoMemory;
DedicatedSystemMemory, // uint32_t DedicatedSystemMemory;
SharedSystemMemory, // uint32_t SharedSystemMemory;
MaxThread, // uint32_t hardware thread count
EuNumber, // uint32_t EU count
TileNumber, // uint32_t Tile count
Reserved // uint32_t
} AdapterInfoType;
EXTERN_C CM_RT_API int32_t GetCmSupportedAdapters(uint32_t& count);
EXTERN_C CM_RT_API int32_t QueryCmAdapterInfo(uint32_t AdapterIndex, AdapterInfoType infoName, void *info, uint32_t infoSize, uint32_t *OutInfoSize);
EXTERN_C CM_RT_API int32_t CreateCmDeviceFromAdapter(CmDevice* &pCmDev, uint32_t& version, uint32_t AdapterIndex, uint32_t DevCreateOption = 0);
EXTERN_C CM_RT_API INT CreateCmDevice(CmDevice* &device, UINT& version, VADisplay vaDisplay = nullptr);
EXTERN_C CM_RT_API INT CreateCmDeviceEx(CmDevice* &device, UINT& version, VADisplay vaDisplay, UINT DevCreateOption = CM_DEVICE_CREATE_OPTION_DEFAULT);
#endif //__CM_RT_API_OS_H__

View File

@ -0,0 +1,387 @@
/*
* Copyright (c) 2017, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
//!
//! \file cm_rt_def_os.h
//! \brief Contains linux-specific Definitions for CM
//!
#ifndef __CM_RT_DEF_OS_H__
#define __CM_RT_DEF_OS_H__
#include <time.h>
#include <va/va.h>
#define _tmain main
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <malloc.h>
#include <string.h>
#include <sys/time.h>
#include <pthread.h>
#include <x86intrin.h>
#include <iostream>
#ifndef CM_NOINLINE
#define CM_NOINLINE __attribute__((noinline))
#endif
typedef int BOOL;
typedef char byte;
typedef unsigned char BYTE;
typedef unsigned int UINT32;
typedef UINT32 DWORD;
typedef int INT;
typedef unsigned int UINT;
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef signed long long INT64;
typedef unsigned long long UINT64;
typedef enum _VACMTEXTUREADDRESS {
VACMTADDRESS_WRAP = 1,
VACMTADDRESS_MIRROR = 2,
VACMTADDRESS_CLAMP = 3,
VACMTADDRESS_BORDER = 4,
VACMTADDRESS_MIRRORONCE = 5,
VACMTADDRESS_FORCE_DWORD = 0x7fffffff
} VACMTEXTUREADDRESS;
typedef enum _VACMTEXTUREFILTERTYPE {
VACMTEXF_NONE = 0,
VACMTEXF_POINT = 1,
VACMTEXF_LINEAR = 2,
VACMTEXF_ANISOTROPIC = 3,
VACMTEXF_FLATCUBIC = 4,
VACMTEXF_GAUSSIANCUBIC = 5,
VACMTEXF_PYRAMIDALQUAD = 6,
VACMTEXF_GAUSSIANQUAD = 7,
VACMTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures
VACMTEXF_FORCE_DWORD = 0x7fffffff
} VACMTEXTUREFILTERTYPE;
#define CM_ATTRIBUTE(attribute) __attribute__((attribute))
typedef enum _VA_CM_FORMAT {
VA_CM_FMT_UNKNOWN = 0,
VA_CM_FMT_A8R8G8B8 = 21,
VA_CM_FMT_X8R8G8B8 = 22,
VA_CM_FMT_A8 = 28,
VA_CM_FMT_A2B10G10R10 = 31,
VA_CM_FMT_A8B8G8R8 = 32,
VA_CM_FMT_R16G16UN = 35,
VA_CM_FMT_A16B16G16R16 = 36,
VA_CM_FMT_A8P8 = 40,
VA_CM_FMT_P8 = 41,
VA_CM_FMT_R32U = 42,
VA_CM_FMT_R8G8UN = 49,
VA_CM_FMT_L8 = 50,
VA_CM_FMT_A8L8 = 51,
VA_CM_FMT_R16UN = 56,
VA_CM_FMT_R16U = 57,
VA_CM_FMT_V8U8 = 60,
VA_CM_FMT_R8UN = 61,
VA_CM_FMT_R8U = 62,
VA_CM_FMT_R32S = 71,
VA_CM_FMT_D16 = 80,
VA_CM_FMT_L16 = 81,
VA_CM_FMT_R16F = 111,
VA_CM_FMT_IA44 = 112,
VA_CM_FMT_A16B16G16R16F = 113,
VA_CM_FMT_R32F = 114,
VA_CM_FMT_R32G32B32A32F = 115,
VA_CM_FMT_I420 = VA_FOURCC('I','4','2','0'),
VA_CM_FMT_P216 = VA_FOURCC('P','2','1','6'),
VA_CM_FMT_400P = VA_FOURCC('4','0','0','P'),
VA_CM_FMT_Y8UN = VA_FOURCC('Y','8','U','N'),
VA_CM_FMT_NV12 = VA_FOURCC_NV12,
VA_CM_FMT_UYVY = VA_FOURCC_UYVY,
VA_CM_FMT_YUY2 = VA_FOURCC_YUY2,
VA_CM_FMT_444P = VA_FOURCC_444P,
VA_CM_FMT_411P = VA_FOURCC_411P,
VA_CM_FMT_422H = VA_FOURCC_422H,
VA_CM_FMT_422V = VA_FOURCC_422V,
VA_CM_FMT_411R = VA_FOURCC_411R,
VA_CM_FMT_RGBP = VA_FOURCC_RGBP,
VA_CM_FMT_BGRP = VA_FOURCC_BGRP,
VA_CM_FMT_IMC3 = VA_FOURCC_IMC3,
VA_CM_FMT_YV12 = VA_FOURCC_YV12,
VA_CM_FMT_P010 = VA_FOURCC_P010,
VA_CM_FMT_P012 = VA_FOURCC_P012,
VA_CM_FMT_P016 = VA_FOURCC_P016,
VA_CM_FMT_P208 = VA_FOURCC_P208,
VA_CM_FMT_AYUV = VA_FOURCC_AYUV,
#if VA_CHECK_VERSION(1, 13, 0)
VA_CM_FMT_XYUV = VA_FOURCC_XYUV,
#endif
VA_CM_FMT_Y210 = VA_FOURCC_Y210,
#if VA_CHECK_VERSION(1, 9, 0)
VA_CM_FMT_Y212 = VA_FOURCC_Y212,
#endif
VA_CM_FMT_Y410 = VA_FOURCC_Y410,
#if VA_CHECK_VERSION(1, 9, 0)
VA_CM_FMT_Y412 = VA_FOURCC_Y412,
#endif
VA_CM_FMT_Y216 = VA_FOURCC_Y216,
VA_CM_FMT_Y416 = VA_FOURCC_Y416,
VA_CM_FMT_AI44 = VA_FOURCC_AI44,
VA_CM_FMT_MAX = 0xFFFFFFFF
} VA_CM_FORMAT;
template<typename T>
inline const char * CM_TYPE_NAME_UNMANGLED();
template<> inline const char * CM_TYPE_NAME_UNMANGLED<char>() { return "char"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<signed char>() { return "signed char"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<unsigned char>() { return "unsigned char"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<short>() { return "short"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<unsigned short>() { return "unsigned short"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<int>() { return "int"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<unsigned int>() { return "unsigned int"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<long>() { return "long"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<unsigned long>() { return "unsigned long"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<float>() { return "float"; }
template<> inline const char * CM_TYPE_NAME_UNMANGLED<double>() { return "double"; }
#define CM_TYPE_NAME(type) CM_TYPE_NAME_UNMANGLED<type>()
inline void * CM_ALIGNED_MALLOC(size_t size, size_t alignment)
{
return memalign(alignment, size);
}
inline void CM_ALIGNED_FREE(void * memory)
{
free(memory);
}
//multi-thread API:
#define THREAD_HANDLE pthread_t
inline void CM_THREAD_CREATE(THREAD_HANDLE *handle, void * start_routine, void * arg)
{
int err = 0;
err = pthread_create(handle , NULL, (void * (*)(void *))start_routine, arg);
if (err) {
printf(" cm create thread failed! \n");
exit(-1);
}
}
inline void CM_THREAD_EXIT(void * retval)
{
pthread_exit(retval);
}
inline int CM_THREAD_JOIN(THREAD_HANDLE *handle_array, int thread_cnt)
{
void *tret;
for(int i = 0; i < thread_cnt; i++)
{
pthread_join( handle_array[i], &tret);
}
return 0;
}
#define CM_SURFACE_FORMAT VA_CM_FORMAT
#define CM_SURFACE_FORMAT_UNKNOWN VA_CM_FMT_UNKNOWN
#define CM_SURFACE_FORMAT_A8R8G8B8 VA_CM_FMT_A8R8G8B8
#define CM_SURFACE_FORMAT_X8R8G8B8 VA_CM_FMT_X8R8G8B8
#define CM_SURFACE_FORMAT_A8B8G8R8 VA_CM_FMT_A8B8G8R8
#define CM_SURFACE_FORMAT_A8 VA_CM_FMT_A8
#define CM_SURFACE_FORMAT_P8 VA_CM_FMT_P8
#define CM_SURFACE_FORMAT_R32F VA_CM_FMT_R32F
#define CM_SURFACE_FORMAT_NV12 VA_CM_FMT_NV12
#define CM_SURFACE_FORMAT_UYVY VA_CM_FMT_UYVY
#define CM_SURFACE_FORMAT_YUY2 VA_CM_FMT_YUY2
#define CM_SURFACE_FORMAT_V8U8 VA_CM_FMT_V8U8
#define CM_SURFACE_FORMAT_R8_UINT VA_CM_FMT_R8U
#define CM_SURFACE_FORMAT_R16_UINT VA_CM_FMT_R16U
#define CM_SURFACE_FORMAT_R16_SINT VA_CM_FMT_A8L8
#define CM_SURFACE_FORMAT_D16 VA_CM_FMT_D16
#define CM_SURFACE_FORMAT_L16 VA_CM_FMT_L16
#define CM_SURFACE_FORMAT_A16B16G16R16 VA_CM_FMT_A16B16G16R16
#define CM_SURFACE_FORMAT_R10G10B10A2 VA_CM_FMT_A2B10G10R10
#define CM_SURFACE_FORMAT_A16B16G16R16F VA_CM_FMT_A16B16G16R16F
#define CM_SURFACE_FORMAT_R32G32B32A32F VA_CM_FMT_R32G32B32A32F
#define CM_SURFACE_FORMAT_444P VA_CM_FMT_444P
#define CM_SURFACE_FORMAT_422H VA_CM_FMT_422H
#define CM_SURFACE_FORMAT_422V VA_CM_FMT_422V
#define CM_SURFACE_FORMAT_411P VA_CM_FMT_411P
#define CM_SURFACE_FORMAT_411R VA_CM_FMT_411R
#define CM_SURFACE_FORMAT_RGBP VA_CM_FMT_RGBP
#define CM_SURFACE_FORMAT_BGRP VA_CM_FMT_BGRP
#define CM_SURFACE_FORMAT_IMC3 VA_CM_FMT_IMC3
#define CM_SURFACE_FORMAT_YV12 VA_CM_FMT_YV12
#define CM_SURFACE_FORMAT_P010 VA_CM_FMT_P010
#define CM_SURFACE_FORMAT_P016 VA_CM_FMT_P016
#define CM_SURFACE_FORMAT_P208 VA_CM_FMT_P208
#define CM_SURFACE_FORMAT_AYUV VA_CM_FMT_AYUV
#define CM_SURFACE_FORMAT_Y210 VA_CM_FMT_Y210
#define CM_SURFACE_FORMAT_Y410 VA_CM_FMT_Y410
#define CM_SURFACE_FORMAT_Y216 VA_CM_FMT_Y216
#define CM_SURFACE_FORMAT_Y416 VA_CM_FMT_Y416
#define CM_SURFACE_FORMAT_IA44 VA_CM_FMT_IA44
#define CM_SURFACE_FORMAT_AI44 VA_CM_FMT_AI44
#define CM_SURFACE_FORMAT_I420 VA_CM_FMT_I420
#define CM_SURFACE_FORMAT_P216 VA_CM_FMT_P216
#define CM_SURFACE_FORMAT_400P VA_CM_FMT_400P
#define CM_SURFACE_FORMAT_R16_FLOAT VA_CM_FMT_R16F
#define CM_SURFACE_FORMAT_Y8_UNORM VA_CM_FMT_Y8UN
#define CM_SURFACE_FORMAT_A8P8 VA_CM_FMT_A8P8
#define CM_SURFACE_FORMAT_R32_SINT VA_CM_FMT_R32S
#define CM_SURFACE_FORMAT_R32_UINT VA_CM_FMT_R32U
#define CM_SURFACE_FORMAT_R8G8_UNORM VA_CM_FMT_R8G8UN
#define CM_SURFACE_FORMAT_R8_UNORM VA_CM_FMT_R8UN
#define CM_SURFACE_FORMAT_R16G16_UNORM VA_CM_FMT_R16G16UN
#define CM_SURFACE_FORMAT_R16_UNORM VA_CM_FMT_R16UN
#define CM_TEXTURE_ADDRESS_TYPE VACMTEXTUREADDRESS
#define CM_TEXTURE_ADDRESS_WRAP VACMTADDRESS_WRAP
#define CM_TEXTURE_ADDRESS_MIRROR VACMTADDRESS_MIRROR
#define CM_TEXTURE_ADDRESS_CLAMP VACMTADDRESS_CLAMP
#define CM_TEXTURE_ADDRESS_BORDER VACMTADDRESS_BORDER
#define CM_TEXTURE_ADDRESS_MIRRORONCE VACMTADDRESS_MIRRORONCE
#define CM_TEXTURE_FILTER_TYPE VACMTEXTUREFILTERTYPE
#define CM_TEXTURE_FILTER_TYPE_NONE VACMTEXF_NONE
#define CM_TEXTURE_FILTER_TYPE_POINT VACMTEXF_POINT
#define CM_TEXTURE_FILTER_TYPE_LINEAR VACMTEXF_LINEAR
#define CM_TEXTURE_FILTER_TYPE_ANISOTROPIC VACMTEXF_ANISOTROPIC
#define CM_TEXTURE_FILTER_TYPE_FLATCUBIC VACMTEXF_FLATCUBIC
#define CM_TEXTURE_FILTER_TYPE_GAUSSIANCUBIC VACMTEXF_GAUSSIANCUBIC
#define CM_TEXTURE_FILTER_TYPE_PYRAMIDALQUAD VACMTEXF_PYRAMIDALQUAD
#define CM_TEXTURE_FILTER_TYPE_GAUSSIANQUAD VACMTEXF_GAUSSIANQUAD
#define CM_TEXTURE_FILTER_TYPE_CONVOLUTIONMONO VACMTEXF_CONVOLUTIONMONO
/* Surrport for common-used data type */
#define _TCHAR char
#define __cdecl
#ifndef TRUE
#define TRUE 1
#endif
typedef int HKEY;
typedef unsigned int uint;
typedef unsigned int* PUINT;
typedef float FLOAT;
typedef unsigned long long DWORDLONG;
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long
#endif
/* Handle Type */
typedef void *HMODULE;
typedef void *HINSTANCE;
typedef int HANDLE;
typedef void *PVOID;
typedef int WINBOOL;
typedef BOOL *PBOOL;
typedef unsigned long ULONG;
typedef ULONG *PULONG;
typedef unsigned short USHORT;
typedef USHORT *PUSHORT;
typedef unsigned char UCHAR;
typedef UCHAR *PUCHAR;
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
typedef double DOUBLE;
#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long
typedef unsigned short WORD;
typedef float FLOAT;
typedef FLOAT *PFLOAT;
typedef BYTE *PBYTE;
typedef int *PINT;
typedef WORD *PWORD;
typedef DWORD *PDWORD;
typedef unsigned int *PUINT;
typedef LONG HRESULT;
typedef long long LONGLONG;
typedef union _LARGE_INTEGER {
struct {
uint32_t LowPart;
int32_t HighPart;
} u;
int64_t QuadPart;
} LARGE_INTEGER;
//Performance
EXTERN_C INT QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency);
EXTERN_C INT QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount);
struct BITMAPFILEHEADER
{
WORD bfType;
DWORD bfSize;
WORD bfReserved1;
WORD bfReserved2;
DWORD bfOffBits;
} __attribute__((packed)) ;
struct BITMAPINFOHEADER
{
DWORD biSize;
DWORD biWidth;
DWORD biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
DWORD biXPelsPerMeter;
DWORD biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
};
struct RGBQUAD
{
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
BYTE rgbReserved;
};
#define CM_KERNEL_FUNCTION2(...) #__VA_ARGS__
#define _NAME(...) #__VA_ARGS__
#endif //__CM_RT_DEF_OS_H__

View File

@ -0,0 +1 @@
//empty file for future implementation

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2017, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
//!
//! \file cm_rt_g10.h
//! \brief Contains Definitions for CM on Gen 10
//!
#ifndef __CM_RT_G10_H__
#define __CM_RT_G10_H__
#include "cm_hw_vebox_cmd_g10.h"
#define CNL_L3_PLANE_DEFAULT CM_L3_PLANE_DEFAULT
#define CNL_L3_PLANE_1 CM_L3_PLANE_1
#define CNL_L3_PLANE_2 CM_L3_PLANE_2
#define CNL_L3_PLANE_3 CM_L3_PLANE_3
#define CNL_L3_PLANE_4 CM_L3_PLANE_4
#define CNL_L3_PLANE_5 CM_L3_PLANE_5
#define CNL_L3_PLANE_6 CM_L3_PLANE_6
#define CNL_L3_PLANE_7 CM_L3_PLANE_7
#define CNL_L3_PLANE_8 CM_L3_PLANE_8
#define CNL_L3_CONFIG_COUNT 9
static const L3ConfigRegisterValues CNL_L3_PLANES[CNL_L3_CONFIG_COUNT] =
{ // SLM URB Rest DC RO Sum (in KB)
{0, 0, 0, 0x80000080}, // 0 128 128 0 0 256
{0, 0, 0, 0x418080}, // 0 128 0 32 96 256
{0, 0, 0, 0x420060}, // 0 96 0 32 128 256
{0, 0, 0, 0x30040}, // 0 64 0 0 192 256
{0, 0, 0, 0xC0000040}, // 0 64 192 0 0 256
{0, 0, 0, 0x428040}, // 0 64 0 32 160 256
{0, 0, 0, 0xA0000021}, // 32 32 160 0 0 256
{0, 0, 0, 0x1008021}, // 32 32 0 128 32 256
{0, 0, 0, 0xC0000001} // 32 0 192 0 0 256
};
typedef struct __CM_VEBOX_PARAM_G10
{
unsigned char padding1[4024];
unsigned char padding2[3732];
PVEBOX_GAMUT_STATE_G75 pGamutState;
unsigned char padding3[3936];
PVEBOX_VERTEX_TABLE_G75 pVertexTable;
unsigned char padding4[2048];
CmHwVeboxCmdG10::VEBOX_CAPTURE_PIPE_STATE_CMD *pCapturePipe;
CmHwVeboxCmdG10::VEBOX_DNDI_STATE_CMD *pDndiState;
CmHwVeboxCmdG10::VEBOX_IECP_STATE_CMD *pIecpState;
}CM_VEBOX_PARAM_G10, PCM_VEBOX_PARAM_G10;
#endif //__CM_RT_G10_H__

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2017, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
//!
//! \file cm_rt_g11.h
//! \brief Contains Definitions for CM on Gen 11
//!
#ifndef __CM_RT_G11_H__
#define __CM_RT_G11_H__
#define ICL_L3_PLANE_DEFAULT CM_L3_PLANE_DEFAULT
#define ICL_L3_PLANE_1 CM_L3_PLANE_1
#define ICL_L3_PLANE_2 CM_L3_PLANE_2
#define ICL_L3_PLANE_3 CM_L3_PLANE_3
#define ICL_L3_PLANE_4 CM_L3_PLANE_4
#define ICL_L3_PLANE_5 CM_L3_PLANE_5
#define ICL_L3_CONFIG_COUNT 6
#define ICLLP_L3_PLANE_DEFAULT CM_L3_PLANE_DEFAULT
#define ICLLP_L3_PLANE_1 CM_L3_PLANE_1
#define ICLLP_L3_PLANE_2 CM_L3_PLANE_2
#define ICLLP_L3_PLANE_3 CM_L3_PLANE_3
#define ICLLP_L3_PLANE_4 CM_L3_PLANE_4
#define ICLLP_L3_PLANE_5 CM_L3_PLANE_5
#define ICLLP_L3_PLANE_6 CM_L3_PLANE_6
#define ICLLP_L3_PLANE_7 CM_L3_PLANE_7
#define ICLLP_L3_PLANE_8 CM_L3_PLANE_8
#define ICLLP_L3_CONFIG_COUNT 9
static const L3ConfigRegisterValues ICLLP_L3_PLANES[ICLLP_L3_CONFIG_COUNT] =
{ // URB Rest DC RO Z Color UTC CB Sum (in KB)
{0x80000080, 0xD, 0, 0}, // 128 128 0 0 0 0 0 0 256
{0x70000080, 0x40804D, 0, 0}, // 128 112 0 0 64 64 0 16 384
{0x41C060, 0x40804D, 0, 0}, // 96 0 32 112 64 64 0 16 384
{0x2C040, 0x20C04D, 0, 0}, // 64 0 0 176 32 96 0 16 384
{0x30000040, 0x81004D, 0, 0}, // 64 48 0 0 128 128 0 16 384
{0xC040, 0x8000004D, 0, 0}, // 64 0 0 48 0 0 256 16 384
{0xA0000420, 0xD, 0, 0}, // 64 320 0 0 0 0 0 0 384
{0xC0000040, 0x4000000D, 0, 0}, // 64 192 0 0 0 0 128 0 384
{0xB0000040, 0x4000004D, 0, 0}, // 64 176 0 0 0 0 128 16 384
};
#endif //__CM_RT_G11_H__

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2019, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
//!
//! \file cm_rt_g12_dg1.h
//! \brief Contains Definitions for CM on Gen 12 DG1
//!
#ifndef __CM_RT_G12_DG1_H__
#define __CM_RT_G12_DG1_H__
#define DG1_L3_PLANE_DEFAULT CM_L3_PLANE_DEFAULT
#define DG1_L3_PLANE_1 CM_L3_PLANE_1
#define DG1_L3_PLANE_2 CM_L3_PLANE_2
#define DG1_L3_CONFIG_COUNT 3
// 16KB per Way for DG1, two Way per section
static const L3ConfigRegisterValues DG1_L3_PLANES[DG1_L3_CONFIG_COUNT] =
{ // Rest DC RO Z Color UTC CB Sum (in KB)
{0x00000200, 0, 0, 0}, // 2048 0 0 0 0 0 0 2048
{0x80000000, 0x7C000020, 0, 0}, // 1024 0 0 0 0 992 32 2048
{0x0101F000, 0x00000020, 0, 0}, // 0 1024 992 0 0 0 32 2048
};
#endif //__CM_RT_G12_DG1_H__

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2019, Intel Corporation
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*/
//!
//! \file cm_rt_g12_tgl.h
//! \brief Contains Definitions for CM on Gen 12 TGL
//!
#ifndef __CM_RT_G12_TGL_H__
#define __CM_RT_G12_TGL_H__
#define TGL_L3_PLANE_DEFAULT CM_L3_PLANE_DEFAULT
#define TGL_L3_PLANE_1 CM_L3_PLANE_1
#define TGL_L3_PLANE_2 CM_L3_PLANE_2
#define TGL_L3_PLANE_3 CM_L3_PLANE_3
#define TGL_L3_PLANE_4 CM_L3_PLANE_4
#define TGL_L3_PLANE_5 CM_L3_PLANE_5
#define TGL_L3_PLANE_6 CM_L3_PLANE_6
#define TGL_L3_CONFIG_COUNT 7
static const L3ConfigRegisterValues TGL_L3_PLANES[TGL_L3_CONFIG_COUNT] =
{ // URB Rest DC RO Z Color UTC CB Sum (in KB)
{0xD0000020, 0x4, 0, 0}, // 64 416 0 0 0 0 0 0 480
{0x78000040, 0x306044, 0, 0}, // 128 240 0 0 48 48 0 16 480
{0x21E020, 0x408044, 0, 0}, // 64 0 32 240 64 64 0 16 480
{0x48000020, 0x810044, 0, 0}, // 64 144 0 0 128 128 0 16 480
{0x18000020, 0xB0000044, 0, 0}, // 64 48 0 0 0 0 352 16 480
{0x88000020, 0x40000044, 0, 0}, // 64 272 0 0 0 0 128 16 480
{0xC8000020, 0x44, 0, 0}, // 64 400 0 0 0 0 0 16 480
};
#endif //__CM_RT_G12_TGL_H__

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,733 @@
/*
* Copyright (c) 2007 Intel Corporation. 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 PRECISION INSIGHT 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.
*/
/*
* Video Decode Acceleration -Backend API
*/
#ifndef _VA_BACKEND_H_
#define _VA_BACKEND_H_
#include <va/va.h>
typedef struct VADriverContext *VADriverContextP;
typedef struct VADisplayContext *VADisplayContextP;
/** \brief VA display types. */
enum {
/** \brief Mask to major identifier for VA display type. */
VA_DISPLAY_MAJOR_MASK = 0xf0,
/** \brief VA/X11 API is used, through vaGetDisplay() entry-point. */
VA_DISPLAY_X11 = 0x10,
/** \brief VA/GLX API is used, through vaGetDisplayGLX() entry-point. */
VA_DISPLAY_GLX = (VA_DISPLAY_X11 | (1 << 0)),
/** \brief VA/Android API is used, through vaGetDisplay() entry-point. */
VA_DISPLAY_ANDROID va_deprecated_enum = 0x20,
/** \brief VA/DRM API is used, through vaGetDisplayDRM() entry-point. */
VA_DISPLAY_DRM = 0x30,
/** \brief VA/DRM API is used, with a render-node device path */
VA_DISPLAY_DRM_RENDERNODES = (VA_DISPLAY_DRM | (1 << 0)),
/** \brief VA/Wayland API is used, through vaGetDisplayWl() entry-point. */
VA_DISPLAY_WAYLAND = 0x40,
/** \brief VA/Win32 API is used, through vaGetDisplayWin32() entry-point. */
VA_DISPLAY_WIN32 = 0x80,
};
struct VADriverVTable {
VAStatus(*vaTerminate)(VADriverContextP ctx);
VAStatus(*vaQueryConfigProfiles)(
VADriverContextP ctx,
VAProfile *profile_list, /* out */
int *num_profiles /* out */
);
VAStatus(*vaQueryConfigEntrypoints)(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint *entrypoint_list, /* out */
int *num_entrypoints /* out */
);
VAStatus(*vaGetConfigAttributes)(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list, /* in/out */
int num_attribs
);
VAStatus(*vaCreateConfig)(
VADriverContextP ctx,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attrib_list,
int num_attribs,
VAConfigID *config_id /* out */
);
VAStatus(*vaDestroyConfig)(
VADriverContextP ctx,
VAConfigID config_id
);
VAStatus(*vaQueryConfigAttributes)(
VADriverContextP ctx,
VAConfigID config_id,
VAProfile *profile, /* out */
VAEntrypoint *entrypoint, /* out */
VAConfigAttrib *attrib_list, /* out */
int *num_attribs /* out */
);
VAStatus(*vaCreateSurfaces)(
VADriverContextP ctx,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces /* out */
);
VAStatus(*vaDestroySurfaces)(
VADriverContextP ctx,
VASurfaceID *surface_list,
int num_surfaces
);
VAStatus(*vaCreateContext)(
VADriverContextP ctx,
VAConfigID config_id,
int picture_width,
int picture_height,
int flag,
VASurfaceID *render_targets,
int num_render_targets,
VAContextID *context /* out */
);
VAStatus(*vaDestroyContext)(
VADriverContextP ctx,
VAContextID context
);
VAStatus(*vaCreateBuffer)(
VADriverContextP ctx,
VAContextID context, /* in */
VABufferType type, /* in */
unsigned int size, /* in */
unsigned int num_elements, /* in */
void *data, /* in */
VABufferID *buf_id
);
VAStatus(*vaBufferSetNumElements)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
unsigned int num_elements /* in */
);
VAStatus(*vaMapBuffer)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
void **pbuf /* out */
);
VAStatus(*vaUnmapBuffer)(
VADriverContextP ctx,
VABufferID buf_id /* in */
);
VAStatus(*vaDestroyBuffer)(
VADriverContextP ctx,
VABufferID buffer_id
);
VAStatus(*vaBeginPicture)(
VADriverContextP ctx,
VAContextID context,
VASurfaceID render_target
);
VAStatus(*vaRenderPicture)(
VADriverContextP ctx,
VAContextID context,
VABufferID *buffers,
int num_buffers
);
VAStatus(*vaEndPicture)(
VADriverContextP ctx,
VAContextID context
);
VAStatus(*vaSyncSurface)(
VADriverContextP ctx,
VASurfaceID render_target
);
VAStatus(*vaQuerySurfaceStatus)(
VADriverContextP ctx,
VASurfaceID render_target,
VASurfaceStatus *status /* out */
);
VAStatus(*vaQuerySurfaceError)(
VADriverContextP ctx,
VASurfaceID render_target,
VAStatus error_status,
void **error_info /*out*/
);
VAStatus(*vaPutSurface)(
VADriverContextP ctx,
VASurfaceID surface,
void* draw, /* Drawable of window system */
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
VARectangle *cliprects, /* client supplied clip list */
unsigned int number_cliprects, /* number of clip rects in the clip list */
unsigned int flags /* de-interlacing flags */
);
VAStatus(*vaQueryImageFormats)(
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
int *num_formats /* out */
);
VAStatus(*vaCreateImage)(
VADriverContextP ctx,
VAImageFormat *format,
int width,
int height,
VAImage *image /* out */
);
VAStatus(*vaDeriveImage)(
VADriverContextP ctx,
VASurfaceID surface,
VAImage *image /* out */
);
VAStatus(*vaDestroyImage)(
VADriverContextP ctx,
VAImageID image
);
VAStatus(*vaSetImagePalette)(
VADriverContextP ctx,
VAImageID image,
/*
* pointer to an array holding the palette data. The size of the array is
* num_palette_entries * entry_bytes in size. The order of the components
* in the palette is described by the component_order in VAImage struct
*/
unsigned char *palette
);
VAStatus(*vaGetImage)(
VADriverContextP ctx,
VASurfaceID surface,
int x, /* coordinates of the upper left source pixel */
int y,
unsigned int width, /* width and height of the region */
unsigned int height,
VAImageID image
);
VAStatus(*vaPutImage)(
VADriverContextP ctx,
VASurfaceID surface,
VAImageID image,
int src_x,
int src_y,
unsigned int src_width,
unsigned int src_height,
int dest_x,
int dest_y,
unsigned int dest_width,
unsigned int dest_height
);
VAStatus(*vaQuerySubpictureFormats)(
VADriverContextP ctx,
VAImageFormat *format_list, /* out */
unsigned int *flags, /* out */
unsigned int *num_formats /* out */
);
VAStatus(*vaCreateSubpicture)(
VADriverContextP ctx,
VAImageID image,
VASubpictureID *subpicture /* out */
);
VAStatus(*vaDestroySubpicture)(
VADriverContextP ctx,
VASubpictureID subpicture
);
VAStatus(*vaSetSubpictureImage)(
VADriverContextP ctx,
VASubpictureID subpicture,
VAImageID image
);
VAStatus(*vaSetSubpictureChromakey)(
VADriverContextP ctx,
VASubpictureID subpicture,
unsigned int chromakey_min,
unsigned int chromakey_max,
unsigned int chromakey_mask
);
VAStatus(*vaSetSubpictureGlobalAlpha)(
VADriverContextP ctx,
VASubpictureID subpicture,
float global_alpha
);
VAStatus(*vaAssociateSubpicture)(
VADriverContextP ctx,
VASubpictureID subpicture,
VASurfaceID *target_surfaces,
int num_surfaces,
short src_x, /* upper left offset in subpicture */
short src_y,
unsigned short src_width,
unsigned short src_height,
short dest_x, /* upper left offset in surface */
short dest_y,
unsigned short dest_width,
unsigned short dest_height,
/*
* whether to enable chroma-keying or global-alpha
* see VA_SUBPICTURE_XXX values
*/
unsigned int flags
);
VAStatus(*vaDeassociateSubpicture)(
VADriverContextP ctx,
VASubpictureID subpicture,
VASurfaceID *target_surfaces,
int num_surfaces
);
VAStatus(*vaQueryDisplayAttributes)(
VADriverContextP ctx,
VADisplayAttribute *attr_list, /* out */
int *num_attributes /* out */
);
VAStatus(*vaGetDisplayAttributes)(
VADriverContextP ctx,
VADisplayAttribute *attr_list, /* in/out */
int num_attributes
);
VAStatus(*vaSetDisplayAttributes)(
VADriverContextP ctx,
VADisplayAttribute *attr_list,
int num_attributes
);
/* used by va trace */
VAStatus(*vaBufferInfo)(
VADriverContextP ctx, /* in */
VABufferID buf_id, /* in */
VABufferType *type, /* out */
unsigned int *size, /* out */
unsigned int *num_elements /* out */
);
/* lock/unlock surface for external access */
VAStatus(*vaLockSurface)(
VADriverContextP ctx,
VASurfaceID surface,
unsigned int *fourcc, /* out for follow argument */
unsigned int *luma_stride,
unsigned int *chroma_u_stride,
unsigned int *chroma_v_stride,
unsigned int *luma_offset,
unsigned int *chroma_u_offset,
unsigned int *chroma_v_offset,
unsigned int *buffer_name, /* if it is not NULL, assign the low lever
* surface buffer name
*/
void **buffer /* if it is not NULL, map the surface buffer for
* CPU access
*/
);
VAStatus(*vaUnlockSurface)(
VADriverContextP ctx,
VASurfaceID surface
);
/* DEPRECATED */
VAStatus
(*vaGetSurfaceAttributes)(
VADriverContextP dpy,
VAConfigID config,
VASurfaceAttrib *attrib_list,
unsigned int num_attribs
);
VAStatus
(*vaCreateSurfaces2)(
VADriverContextP ctx,
unsigned int format,
unsigned int width,
unsigned int height,
VASurfaceID *surfaces,
unsigned int num_surfaces,
VASurfaceAttrib *attrib_list,
unsigned int num_attribs
);
VAStatus
(*vaQuerySurfaceAttributes)(
VADriverContextP dpy,
VAConfigID config,
VASurfaceAttrib *attrib_list,
unsigned int *num_attribs
);
VAStatus
(*vaAcquireBufferHandle)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
VABufferInfo * buf_info /* in/out */
);
VAStatus
(*vaReleaseBufferHandle)(
VADriverContextP ctx,
VABufferID buf_id /* in */
);
VAStatus(*vaCreateMFContext)(
VADriverContextP ctx,
VAMFContextID *mfe_context /* out */
);
VAStatus(*vaMFAddContext)(
VADriverContextP ctx,
VAMFContextID mf_context,
VAContextID context
);
VAStatus(*vaMFReleaseContext)(
VADriverContextP ctx,
VAMFContextID mf_context,
VAContextID context
);
VAStatus(*vaMFSubmit)(
VADriverContextP ctx,
VAMFContextID mf_context,
VAContextID *contexts,
int num_contexts
);
VAStatus(*vaCreateBuffer2)(
VADriverContextP ctx,
VAContextID context, /* in */
VABufferType type, /* in */
unsigned int width, /* in */
unsigned int height, /* in */
unsigned int *unit_size, /* out */
unsigned int *pitch, /* out */
VABufferID *buf_id /* out */
);
VAStatus(*vaQueryProcessingRate)(
VADriverContextP ctx, /* in */
VAConfigID config_id, /* in */
VAProcessingRateParameter *proc_buf,/* in */
unsigned int *processing_rate /* out */
);
VAStatus
(*vaExportSurfaceHandle)(
VADriverContextP ctx,
VASurfaceID surface_id, /* in */
uint32_t mem_type, /* in */
uint32_t flags, /* in */
void *descriptor /* out */
);
VAStatus(*vaSyncSurface2)(
VADriverContextP ctx,
VASurfaceID surface,
uint64_t timeout_ns
);
VAStatus(*vaSyncBuffer)(
VADriverContextP ctx,
VABufferID buf_id,
uint64_t timeout_ns
);
VAStatus
(*vaCopy)(
VADriverContextP ctx, /* in */
VACopyObject *dst, /* in */
VACopyObject *src, /* in */
VACopyOption option /* in */
);
VAStatus(*vaMapBuffer2)(
VADriverContextP ctx,
VABufferID buf_id, /* in */
void **pbuf, /* out */
uint32_t flags /* in */
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[53];
};
struct VADriverContext {
void *pDriverData;
/**
* The core VA implementation hooks.
*
* This structure is allocated from libva with calloc().
*/
struct VADriverVTable *vtable;
/**
* The VA/GLX implementation hooks.
*
* This structure is intended for drivers that implement the
* VA/GLX API. The driver implementation is responsible for the
* allocation and deallocation of this structure.
*/
struct VADriverVTableGLX *vtable_glx;
/**
* The VA/EGL implementation hooks.
*
* This structure is intended for drivers that implement the
* VA/EGL API. The driver implementation is responsible for the
* allocation and deallocation of this structure.
*/
struct VADriverVTableEGL *vtable_egl;
/**
* The third-party/private implementation hooks.
*
* This structure is intended for drivers that implement the
* private API. The driver implementation is responsible for the
* allocation and deallocation of this structure.
*/
void *vtable_tpi;
void *native_dpy;
int x11_screen;
int version_major;
int version_minor;
int max_profiles;
int max_entrypoints;
int max_attributes;
int max_image_formats;
int max_subpic_formats;
int max_display_attributes;
const char *str_vendor;
void *handle; /* dlopen handle */
/**
* \brief DRM state.
*
* This field holds driver specific data for DRM-based
* drivers. This structure is allocated from libva with
* calloc(). Do not deallocate from within VA driver
* implementations.
*
* All structures shall be derived from struct drm_state. So, for
* instance, this field holds a dri_state structure for VA/X11
* drivers that use the DRM protocol.
*/
void *drm_state;
void *glx; /* opaque for GLX code */
/** \brief VA display type. */
unsigned long display_type;
/**
* The VA/Wayland implementation hooks.
*
* This structure is intended for drivers that implement the
* VA/Wayland API. libVA allocates this structure with calloc()
* and owns the resulting memory.
*/
struct VADriverVTableWayland *vtable_wayland;
/**
* \brief The VA/VPP implementation hooks.
*
* This structure is allocated from libva with calloc().
*/
struct VADriverVTableVPP *vtable_vpp;
char *override_driver_name;
void *pDisplayContext;
/**
* Error callback.
*
* This is set by libva when the driver is opened, and will not be
* changed thereafter. The driver can call it with an error message,
* which will be propagated to the API user through their error
* callbacks, or sent to a default output if no callback is available.
*
* It is expected that end users will always be able to see these
* messages, so it should be called only for serious errors. For
* example, hardware problems or fatal configuration errors.
*
* @param pDriverContext Pointer to the driver context structure
* being used by the current driver.
* @param message Message to send to the API user. This must be a
* null-terminated string.
*/
void (*error_callback)(VADriverContextP pDriverContext,
const char *message);
/**
* Info callback.
*
* This has the same behaviour as the error callback, but has its
* own set of callbacks to the API user.
*
* It should be used for informational messages which may be useful
* for an application programmer or for debugging. For example, minor
* configuration errors, or information about the reason when another
* API call generates an error return. It is not expected that end
* users will see these messages.
*
* @param pDriverContext Pointer to the driver context structure
* being used by the current driver.
* @param message Message to send to the API user. This must be a
* null-terminated string.
*/
void (*info_callback)(VADriverContextP pDriverContext,
const char *message);
/**
* \brief The VA/Protected implementation hooks.
*
* This structure is allocated from libva with calloc().
*/
struct VADriverVTableProt *vtable_prot;
unsigned long reserved[37]; /* reserve for future add-ins, decrease the subscript accordingly */
};
#define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
struct VADisplayContext {
int vadpy_magic;
VADisplayContextP pNext;
VADriverContextP pDriverContext;
/* Deprecated */
int (*vaIsValid)(
VADisplayContextP ctx
);
void (*vaDestroy)(
VADisplayContextP ctx
);
/* Deprecated */
VAStatus(*vaGetDriverName)(
VADisplayContextP ctx,
char **driver_name
);
void *opaque; /* opaque for display extensions (e.g. GLX) */
void *vatrace; /* opaque for VA trace context */
/* Deprecated */
void *vafool; /* opaque for VA fool context */
VAMessageCallback error_callback;
void *error_callback_user_context;
VAMessageCallback info_callback;
void *info_callback_user_context;
/* Deprecated */
VAStatus(*vaGetNumCandidates)(
VADisplayContextP ctx,
int * num_candidates
);
/* Deprecated */
VAStatus(*vaGetDriverNameByIndex)(
VADisplayContextP ctx,
char **driver_name,
int candidate_index
);
/**
* \brief Callback to get an array of driver names.
*
*
* The caller must provide a num_drivers
* This structure is allocated from libva with calloc().
*
* @param drivers An num_drivers sized array of null terminated strings.
* The array is managed my the caller. The callee will
* populate the individual driver name strings and the
* caller must free them.
* @param num_driver The number of driver strings contained within drivers.
* The caller must set that to the size of the drivers
* array, where the callee will update the value to
* min(caller num_driver, num_drivers_support).
*/
VAStatus(*vaGetDriverNames)(
VADisplayContextP ctx,
char **drivers,
unsigned *num_drivers
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[29];
};
typedef VAStatus(*VADriverInit)(
VADriverContextP driver_context
);
#endif /* _VA_BACKEND_H_ */

View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2009 Splitted-Desktop Systems. 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 PRECISION INSIGHT 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.
*/
#ifndef VA_BACKEND_GLX_H
#define VA_BACKEND_GLX_H
struct VADriverContext;
struct VADriverVTableGLX {
/* Optional: create a surface used for display to OpenGL */
VAStatus(*vaCreateSurfaceGLX)(
struct VADriverContext *ctx,
unsigned int gl_target,
unsigned int gl_texture,
void **gl_surface
);
/* Optional: destroy a VA/GLX surface */
VAStatus(*vaDestroySurfaceGLX)(
struct VADriverContext *ctx,
void *gl_surface
);
/* Optional: copy a VA surface to a VA/GLX surface */
VAStatus(*vaCopySurfaceGLX)(
struct VADriverContext *ctx,
void *gl_surface,
VASurfaceID surface,
unsigned int flags
);
};
#endif /* VA_BACKEND_GLX_H */

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2020 Intel Corporation. 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 INTEL 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.
*/
#ifndef VA_BACKEND_PROT_H
#define VA_BACKEND_PROT_H
#include <va/va_prot.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \brief VTable version for VA/PROTECTION hooks. */
#define VA_DRIVER_VTABLE_PROT_VERSION 1
struct VADriverVTableProt {
unsigned int version;
VAStatus
(*vaCreateProtectedSession)(
VADriverContextP ctx,
VAConfigID config_id,
VAProtectedSessionID *protected_session
);
VAStatus
(*vaDestroyProtectedSession)(
VADriverContextP ctx,
VAProtectedSessionID protected_session
);
VAStatus
(*vaAttachProtectedSession)(
VADriverContextP ctx,
VAContextID context,
VAProtectedSessionID protected_session
);
VAStatus
(*vaDetachProtectedSession)(
VADriverContextP ctx,
VAContextID context
);
VAStatus
(*vaProtectedSessionExecute)(
VADriverContextP ctx,
VAProtectedSessionID protected_session,
VABufferID buf_id
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[VA_PADDING_MEDIUM];
};
#ifdef __cplusplus
}
#endif
#endif /* VA_BACKEND_PROT_H */

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. 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 INTEL 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.
*/
#ifndef VA_BACKEND_VPP_H
#define VA_BACKEND_VPP_H
#include <va/va_vpp.h>
#ifdef __cplusplus
extern "C" {
#endif
/** \brief VTable version for VA/VPP hooks. */
#define VA_DRIVER_VTABLE_VPP_VERSION 1
struct VADriverVTableVPP {
unsigned int version;
VAStatus
(*vaQueryVideoProcFilters)(
VADriverContextP ctx,
VAContextID context,
VAProcFilterType *filters,
unsigned int *num_filters
);
VAStatus
(*vaQueryVideoProcFilterCaps)(
VADriverContextP ctx,
VAContextID context,
VAProcFilterType type,
void *filter_caps,
unsigned int *num_filter_caps
);
VAStatus
(*vaQueryVideoProcPipelineCaps)(
VADriverContextP ctx,
VAContextID context,
VABufferID *filters,
unsigned int num_filters,
VAProcPipelineCaps *pipeline_caps
);
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[16];
};
#ifdef __cplusplus
}
#endif
#endif /* VA_BACKEND_VPP_H */

View File

@ -0,0 +1,79 @@
/*
* va_backend_wayland.h - VA driver implementation hooks for Wayland
*
* Copyright (c) 2012 Intel Corporation. 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 INTEL 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.
*/
#ifndef VA_BACKEND_WAYLAND_H
#define VA_BACKEND_WAYLAND_H
#include <va/va.h>
#include <wayland-client.h>
/** \brief VA/Wayland API version. */
#define VA_WAYLAND_API_VERSION (0x574c4400) /* WLD0 */
/* Forward declarations */
struct VADriverContext;
/** \brief VA/Wayland implementation hooks. */
struct VADriverVTableWayland {
/**
* \brief Interface version.
*
* Implementations shall set this field to \ref VA_WAYLAND_API_VERSION.
*/
unsigned int version;
/** \brief Hook to return Wayland buffer associated with the VA surface. */
VAStatus(*vaGetSurfaceBufferWl)(
struct VADriverContext *ctx,
VASurfaceID surface,
unsigned int flags,
struct wl_buffer **out_buffer
);
/** \brief Hook to return Wayland buffer associated with the VA image. */
VAStatus(*vaGetImageBufferWl)(
struct VADriverContext *ctx,
VAImageID image,
unsigned int flags,
struct wl_buffer **out_buffer
);
/** \brief Indicate whether buffer sharing with prime fd is supported. */
unsigned int has_prime_sharing;
/**
* Pointer to an implementation of struct wl_interface
*
* It is set by libva-wayland when a context is created, then the backend
* driver may reuse it.
*/
const void *wl_interface;
/** \brief Reserved bytes for future use, must be zero */
unsigned long reserved[7];
};
#endif /* VA_BACKEND_WAYLAND_H */

View File

@ -0,0 +1,116 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_compat.h
* \brief The Compatibility API
*
* This file contains the \ref api_compat "Compatibility API".
*/
#ifndef VA_COMPAT_H
#define VA_COMPAT_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_compat Compatibility API
*
* The Compatibility API allows older programs that are not ported to
* the current API to still build and run correctly. In particular,
* this exposes older API to allow for backwards source compatibility.
*
* @{
*/
/**
* Makes a string literal out of the macro argument
*/
#define VA_CPP_HELPER_STRINGIFY(x) \
VA_CPP_HELPER_STRINGIFY_(x)
#define VA_CPP_HELPER_STRINGIFY_(x) \
#x
/**
* Concatenates two macro arguments at preprocessing time.
*/
#define VA_CPP_HELPER_CONCAT(a, b) \
VA_CPP_HELPER_CONCAT_(a, b)
#define VA_CPP_HELPER_CONCAT_(a, b) \
a ## b
/**
* Generates the number of macro arguments at preprocessing time.
* <http://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4a3fb/346fc464319b1ee5>
*
* Note: this doesn't work for macros with no arguments
*/
#define VA_CPP_HELPER_N_ARGS(...) \
VA_CPP_HELPER_N_ARGS_(__VA_ARGS__, VA_CPP_HELPER_N_ARGS_LIST_REV())
#define VA_CPP_HELPER_N_ARGS_(...) \
VA_CPP_HELPER_N_ARGS_LIST(__VA_ARGS__)
#define VA_CPP_HELPER_N_ARGS_LIST(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a12, a13, a14, a15, a16, N, ...) N
#define VA_CPP_HELPER_N_ARGS_LIST_REV() \
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
/**
* Generates a versioned function alias.
*
* VA_CPP_HELPER_ALIAS(vaSomeFunction, 0,32,0) will generate
* .symber vaSomeFunction_0_32_0, vaSomeFunction@VA_API_0.32.0
*/
#define VA_CPP_HELPER_ALIAS(func, major, minor, micro) \
VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@")
#define VA_CPP_HELPER_ALIAS_DEFAULT(func, major, minor, micro) \
VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@@")
#define VA_CPP_HELPER_ALIAS_(func, major, minor, micro, binding) \
asm(".symver " #func "_" #major "_" #minor "_" #micro ", " \
#func binding "VA_API_" #major "." #minor "." #micro)
/* vaCreateSurfaces() */
#ifndef VA_COMPAT_DISABLED
#define vaCreateSurfaces(dpy, ...) \
VA_CPP_HELPER_CONCAT(vaCreateSurfaces, \
VA_CPP_HELPER_N_ARGS(dpy, __VA_ARGS__)) \
(dpy, __VA_ARGS__)
#endif
#define vaCreateSurfaces6(dpy, width, height, format, num_surfaces, surfaces) \
(vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
NULL, 0)
#define vaCreateSurfaces8(dpy, format, width, height, surfaces, num_surfaces, attribs, num_attribs) \
(vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
attribs, num_attribs)
/*@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_COMPAT_H */

View File

@ -0,0 +1,695 @@
/*
* Copyright (c) 2019 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_dec_av1.h
* \brief The AV1 decoding API
*
* This file contains the \ref api_dec_av1 "AV1 decoding API".
*/
#ifndef VA_DEC_AV1_H
#define VA_DEC_AV1_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_av1 AV1 decoding API
*
* This AV1 decoding API supports 8-bit/10bit 420 format only.
*
* @{
*/
/** Attribute value for VAConfigAttribDecAV1Features.
*
* This attribute decribes the supported features of a AV1
* decoder configuration.
*
*/
typedef union VAConfigAttribValDecAV1Features {
struct {
/** large scale tile
*
* This conveys whether AV1 large scale tile is supported by HW.
* 0 - unsupported, 1 - supported.
*/
uint32_t lst_support : 2;
/* Reserved for future use. */
uint32_t reserved : 30;
} bits;
uint32_t value;
} VAConfigAttribValDecAV1Features;
/**
* \brief AV1 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
* App should send a surface with this data structure down to VAAPI once
* per frame.
*
*/
/** \brief Segmentation Information
*/
typedef struct _VASegmentationStructAV1 {
union {
struct {
/** Indicates whether segmentation map related syntax elements
* are present or not for current frame. If equal to 0,
* the segmentation map related syntax elements are
* not present for the current frame and the control flags of
* segmentation map related tables feature_data[][], and
* feature_mask[] are not valid and shall be ignored by accelerator.
*/
uint32_t enabled : 1;
/** Value 1 indicates that the segmentation map are updated
* during the decoding of this frame.
* Value 0 means that the segmentation map from the previous
* frame is used.
*/
uint32_t update_map : 1;
/** Value 1 indicates that the updates to the segmentation map
* are coded relative to the existing segmentation map.
* Value 0 indicates that the new segmentation map is coded
* without reference to the existing segmentation map.
*/
uint32_t temporal_update : 1;
/** Value 1 indicates that new parameters are about to be
* specified for each segment.
* Value 0 indicates that the segmentation parameters
* should keep their existing values.
*/
uint32_t update_data : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 28;
} bits;
uint32_t value;
} segment_info_fields;
/** \brief Segmentation parameters for current frame.
* feature_data[segment_id][feature_id]
* where segment_id has value range [0..7] indicating the segment id.
* and feature_id is defined as
typedef enum {
SEG_LVL_ALT_Q, // Use alternate Quantizer ....
SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical
SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal
SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane
SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane
SEG_LVL_REF_FRAME, // Optional Segment reference frame
SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode
SEG_LVL_GLOBALMV,
SEG_LVL_MAX
} SEG_LVL_FEATURES;
* feature_data[][] is equivalent to variable FeatureData[][] in spec,
* which is after clip3() operation.
* Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z);
* The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = {
* 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 }
*/
int16_t feature_data[8][8];
/** \brief indicates if a feature is enabled or not.
* Each bit field itself is the feature_id. Index is segment_id.
* feature_mask[segment_id] & (1 << feature_id) equal to 1 specify that the feature of
* feature_id for segment of segment_id is enabled, otherwise disabled.
*/
uint8_t feature_mask[8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASegmentationStructAV1;
/** \brief Film Grain Information
*/
typedef struct _VAFilmGrainStructAV1 {
union {
struct {
/** \brief Specify whether or not film grain is applied on current frame.
* If set to 0, all the rest parameters should be set to zero
* and ignored.
*/
uint32_t apply_grain : 1;
uint32_t chroma_scaling_from_luma : 1;
uint32_t grain_scaling_minus_8 : 2;
uint32_t ar_coeff_lag : 2;
uint32_t ar_coeff_shift_minus_6 : 2;
uint32_t grain_scale_shift : 2;
uint32_t overlap_flag : 1;
uint32_t clip_to_restricted_range : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 20;
} bits;
uint32_t value;
} film_grain_info_fields;
uint16_t grain_seed;
/* value range [0..14] */
uint8_t num_y_points;
uint8_t point_y_value[14];
uint8_t point_y_scaling[14];
/* value range [0..10] */
uint8_t num_cb_points;
uint8_t point_cb_value[10];
uint8_t point_cb_scaling[10];
/* value range [0..10] */
uint8_t num_cr_points;
uint8_t point_cr_value[10];
uint8_t point_cr_scaling[10];
/* value range [-128..127] */
int8_t ar_coeffs_y[24];
int8_t ar_coeffs_cb[25];
int8_t ar_coeffs_cr[25];
uint8_t cb_mult;
uint8_t cb_luma_mult;
uint16_t cb_offset;
uint8_t cr_mult;
uint8_t cr_luma_mult;
uint16_t cr_offset;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAFilmGrainStructAV1;
typedef enum {
/** identity transformation, 0-parameter */
VAAV1TransformationIdentity = 0,
/** translational motion, 2-parameter */
VAAV1TransformationTranslation = 1,
/** simplified affine with rotation + zoom only, 4-parameter */
VAAV1TransformationRotzoom = 2,
/** affine, 6-parameter */
VAAV1TransformationAffine = 3,
/** transformation count */
VAAV1TransformationCount
} VAAV1TransformationType;
typedef struct _VAWarpedMotionParamsAV1 {
/** \brief Specify the type of warped motion */
VAAV1TransformationType wmtype;
/** \brief Specify warp motion parameters
* wm.wmmat[] corresponds to gm_params[][] in spec.
* Details in AV1 spec section 5.9.24 or refer to libaom code
* https://aomedia.googlesource.com/aom/+/refs/heads/master/av1/decoder/decodeframe.c
*/
int32_t wmmat[8];
/* valid or invalid on affine set */
uint8_t invalid;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAWarpedMotionParamsAV1;
/**
* \brief AV1 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters and should be sent once
* per frame.
*
*/
typedef struct _VADecPictureParameterBufferAV1 {
/**@{*/
/** \brief sequence level information
*/
/** \brief AV1 bit stream profile
*/
uint8_t profile;
uint8_t order_hint_bits_minus_1;
/** \brief bit depth index
* value range [0..2]
* 0 - bit depth 8;
* 1 - bit depth 10;
* 2 - bit depth 12;
*/
uint8_t bit_depth_idx;
/** \brief corresponds to AV1 spec variable of the same name. */
uint8_t matrix_coefficients;
union {
struct {
uint32_t still_picture : 1;
uint32_t use_128x128_superblock : 1;
uint32_t enable_filter_intra : 1;
uint32_t enable_intra_edge_filter : 1;
/** read_compound_tools */
uint32_t enable_interintra_compound : 1;
uint32_t enable_masked_compound : 1;
uint32_t enable_dual_filter : 1;
uint32_t enable_order_hint : 1;
uint32_t enable_jnt_comp : 1;
uint32_t enable_cdef : 1;
uint32_t mono_chrome : 1;
uint32_t color_range : 1;
uint32_t subsampling_x : 1;
uint32_t subsampling_y : 1;
va_deprecated uint32_t chroma_sample_position : 1;
uint32_t film_grain_params_present : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 16;
} fields;
uint32_t value;
} seq_info_fields;
/** \brief Picture level information
*/
/** \brief buffer description of decoded current picture
*/
VASurfaceID current_frame;
/** \brief display buffer of current picture
* Used for film grain applied decoded picture.
* Valid only when apply_grain equals 1.
*/
VASurfaceID current_display_picture;
/** \brief number of anchor frames for large scale tile
* This parameter gives the number of entries of anchor_frames_list[].
* Value range [0..128].
*/
uint8_t anchor_frames_num;
/** \brief anchor frame list for large scale tile
* For large scale tile applications, the anchor frames could come from
* previously decoded frames in current sequence (aka. internal), or
* from external sources.
* For external anchor frames, application should call API
* vaCreateBuffer() to generate frame buffers and populate them with
* pixel frames. And this process may happen multiple times.
* The array anchor_frames_list[] is used to register all the available
* anchor frames from both external and internal, up to the current
* frame instance. If a previously registerred anchor frame is no longer
* needed, it should be removed from the list. But it does not prevent
* applications from relacing the frame buffer with new anchor frames.
* Please note that the internal anchor frames may not still be present
* in the current DPB buffer. But if it is in the anchor_frames_list[],
* it should not be replaced with other frames or removed from memory
* until it is not shown in the list.
* This number of entries of the list is given by parameter anchor_frames_num.
*/
VASurfaceID *anchor_frames_list;
/** \brief Picture resolution minus 1
* Picture original resolution. If SuperRes is enabled,
* this is the upscaled resolution.
* value range [0..65535]
*/
uint16_t frame_width_minus1;
uint16_t frame_height_minus1;
/** \brief Output frame buffer size in unit of tiles
* Valid only when large_scale_tile equals 1.
* value range [0..65535]
*/
uint16_t output_frame_width_in_tiles_minus_1;
uint16_t output_frame_height_in_tiles_minus_1;
/** \brief Surface indices of reference frames in DPB.
*
* Contains a list of uncompressed frame buffer surface indices as references.
* Application needs to make sure all the entries point to valid frames
* except for intra frames by checking ref_frame_id[]. If missing frame
* is identified, application may choose to perform error recovery by
* pointing problematic index to an alternative frame buffer.
* Driver is not responsible to validate reference frames' id.
*/
VASurfaceID ref_frame_map[8];
/** \brief Reference frame indices.
*
* Contains a list of indices into ref_frame_map[8].
* It specifies the reference frame correspondence.
* The indices of the array are defined as [LAST_FRAME – LAST_FRAME,
* LAST2_FRAME – LAST_FRAME, …, ALTREF_FRAME – LAST_FRAME], where each
* symbol is defined as:
* enum{INTRA_FRAME = 0, LAST_FRAME, LAST2_FRAME, LAST3_FRAME, GOLDEN_FRAME,
* BWDREF_FRAME, ALTREF2_FRAME, ALTREF_FRAME};
*/
uint8_t ref_frame_idx[7];
/** \brief primary reference frame index
* Index into ref_frame_idx[], specifying which reference frame contains
* propagated info that should be loaded at the start of the frame.
* When value equals PRIMARY_REF_NONE (7), it indicates there is
* no primary reference frame.
* value range [0..7]
*/
uint8_t primary_ref_frame;
uint8_t order_hint;
VASegmentationStructAV1 seg_info;
VAFilmGrainStructAV1 film_grain_info;
/** \brief tile structure
* When uniform_tile_spacing_flag == 1, width_in_sbs_minus_1[] and
* height_in_sbs_minus_1[] should be ignored, which will be generated
* by driver based on tile_cols and tile_rows.
*/
uint8_t tile_cols;
uint8_t tile_rows;
/* The width/height of a tile minus 1 in units of superblocks. Though the
* maximum number of tiles is 64, since ones of the last tile are computed
* from ones of the other tiles and frame_width/height, they are not
* necessarily specified.
*/
uint16_t width_in_sbs_minus_1[63];
uint16_t height_in_sbs_minus_1[63];
/** \brief number of tiles minus 1 in large scale tile list
* Same as AV1 semantic element.
* Valid only when large_scale_tiles == 1.
*/
uint16_t tile_count_minus_1;
/* specify the tile index for context updating */
uint16_t context_update_tile_id;
union {
struct {
/** \brief flags for current picture
* same syntax and semantic as those in AV1 code
*/
/** \brief Frame Type
* 0: KEY_FRAME;
* 1: INTER_FRAME;
* 2: INTRA_ONLY_FRAME;
* 3: SWITCH_FRAME
* For SWITCH_FRAME, application shall set error_resilient_mode = 1,
* refresh_frame_flags, etc. appropriately. And driver will convert it
* to INTER_FRAME.
*/
uint32_t frame_type : 2;
uint32_t show_frame : 1;
uint32_t showable_frame : 1;
uint32_t error_resilient_mode : 1;
uint32_t disable_cdf_update : 1;
uint32_t allow_screen_content_tools : 1;
uint32_t force_integer_mv : 1;
uint32_t allow_intrabc : 1;
uint32_t use_superres : 1;
uint32_t allow_high_precision_mv : 1;
uint32_t is_motion_mode_switchable : 1;
uint32_t use_ref_frame_mvs : 1;
/* disable_frame_end_update_cdf is coded as refresh_frame_context. */
uint32_t disable_frame_end_update_cdf : 1;
uint32_t uniform_tile_spacing_flag : 1;
uint32_t allow_warped_motion : 1;
/** \brief indicate if current frame in large scale tile mode */
uint32_t large_scale_tile : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 15;
} bits;
uint32_t value;
} pic_info_fields;
/** \brief Supper resolution scale denominator.
* When use_superres=1, superres_scale_denominator must be in the range [9..16].
* When use_superres=0, superres_scale_denominator must be 8.
*/
uint8_t superres_scale_denominator;
/** \brief Interpolation filter.
* value range [0..4]
*/
uint8_t interp_filter;
/** \brief luma loop filter levels.
* value range [0..63].
*/
uint8_t filter_level[2];
/** \brief chroma loop filter levels.
* value range [0..63].
*/
uint8_t filter_level_u;
uint8_t filter_level_v;
union {
struct {
/** \brief flags for reference pictures
* same syntax and semantic as those in AV1 code
*/
uint8_t sharpness_level : 3;
uint8_t mode_ref_delta_enabled : 1;
uint8_t mode_ref_delta_update : 1;
/** \brief Reserved bytes for future use, must be zero */
uint8_t reserved : 3;
} bits;
uint8_t value;
} loop_filter_info_fields;
/** \brief The adjustment needed for the filter level based on
* the chosen reference frame.
* value range [-64..63].
*/
int8_t ref_deltas[8];
/** \brief The adjustment needed for the filter level based on
* the chosen mode.
* value range [-64..63].
*/
int8_t mode_deltas[2];
/** \brief quantization
*/
/** \brief Y AC index
* value range [0..255]
*/
uint8_t base_qindex;
/** \brief Y DC delta from Y AC
* value range [-64..63]
*/
int8_t y_dc_delta_q;
/** \brief U DC delta from Y AC
* value range [-64..63]
*/
int8_t u_dc_delta_q;
/** \brief U AC delta from Y AC
* value range [-64..63]
*/
int8_t u_ac_delta_q;
/** \brief V DC delta from Y AC
* value range [-64..63]
*/
int8_t v_dc_delta_q;
/** \brief V AC delta from Y AC
* value range [-64..63]
*/
int8_t v_ac_delta_q;
/** \brief quantization_matrix
*/
union {
struct {
uint16_t using_qmatrix : 1;
/** \brief qm level
* value range [0..15]
* Invalid if using_qmatrix equals 0.
*/
uint16_t qm_y : 4;
uint16_t qm_u : 4;
uint16_t qm_v : 4;
/** \brief Reserved bytes for future use, must be zero */
uint16_t reserved : 3;
} bits;
uint16_t value;
} qmatrix_fields;
union {
struct {
/** \brief delta_q parameters
*/
uint32_t delta_q_present_flag : 1;
uint32_t log2_delta_q_res : 2;
/** \brief delta_lf parameters
*/
uint32_t delta_lf_present_flag : 1;
uint32_t log2_delta_lf_res : 2;
/** \brief CONFIG_LOOPFILTER_LEVEL
*/
uint32_t delta_lf_multi : 1;
/** \brief read_tx_mode
* value range [0..2]
*/
uint32_t tx_mode : 2;
/* AV1 frame reference mode semantic */
uint32_t reference_select : 1;
uint32_t reduced_tx_set_used : 1;
uint32_t skip_mode_present : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 20;
} bits;
uint32_t value;
} mode_control_fields;
/** \brief CDEF parameters
*/
/* value range [0..3] */
uint8_t cdef_damping_minus_3;
/* value range [0..3] */
uint8_t cdef_bits;
/** Encode cdef strength:
*
* The cdef_y_strengths[] and cdef_uv_strengths[] are expected to be packed
* with both primary and secondary strength. The secondary strength is
* given in the lower two bits and the primary strength is given in the next
* four bits.
*
* cdef_y_strengths[] & cdef_uv_strengths[] should be derived as:
* (cdef_y_strengths[]) = (cdef_y_pri_strength[] << 2) | (cdef_y_sec_strength[] & 0x03)
* (cdef_uv_strengths[]) = (cdef_uv_pri_strength[] << 2) | (cdef_uv_sec_strength[] & 0x03)
* In which, cdef_y_pri_strength[]/cdef_y_sec_strength[]/cdef_uv_pri_strength[]/cdef_uv_sec_strength[]
* are variables defined in AV1 Spec 5.9.19. The cdef_y_strengths[] & cdef_uv_strengths[]
* are corresponding to LIBAOM variables cm->cdef_strengths[] & cm->cdef_uv_strengths[] respectively.
*/
/* value range [0..63] */
uint8_t cdef_y_strengths[8];
/* value range [0..63] */
uint8_t cdef_uv_strengths[8];
/** \brief loop restoration parameters
*/
union {
struct {
uint16_t yframe_restoration_type : 2;
uint16_t cbframe_restoration_type : 2;
uint16_t crframe_restoration_type : 2;
uint16_t lr_unit_shift : 2;
uint16_t lr_uv_shift : 1;
/** \brief Reserved bytes for future use, must be zero */
uint16_t reserved : 7;
} bits;
uint16_t value;
} loop_restoration_fields;
/** \brief global motion
*/
VAWarpedMotionParamsAV1 wm[7];
/**@}*/
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VADecPictureParameterBufferAV1;
/**
* \brief AV1 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to bit stream data and should be
* sent once per tile.
*
* It uses the name VASliceParameterBufferAV1 to be consistent with other codec,
* but actually means VATileParameterBufferAV1.
*
* Slice data buffer of VASliceDataBufferType is used
* to send the bitstream.
*
* Please note that host decoder is responsible to parse out the
* per tile information. And the bit stream in sent to driver in per
* tile granularity.
*/
typedef struct _VASliceParameterBufferAV1 {
/**@{*/
/** \brief The byte count of current tile in the bitstream buffer,
* starting from first byte of the buffer.
* It uses the name slice_data_size to be consistent with other codec,
* but actually means tile_data_size.
*/
uint32_t slice_data_size;
/**
* offset to the first byte of the data buffer.
*/
uint32_t slice_data_offset;
/**
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
uint16_t tile_row;
uint16_t tile_column;
va_deprecated uint16_t tg_start;
va_deprecated uint16_t tg_end;
/** \brief anchor frame index for large scale tile.
* index into an array AnchorFrames of the frames that the tile uses
* for prediction.
* valid only when large_scale_tile equals 1.
*/
uint8_t anchor_frame_idx;
/** \brief tile index in the tile list.
* Valid only when large_scale_tile is enabled.
* Driver uses this field to decide the tile output location.
*/
uint16_t tile_idx_in_tile_list;
/**@}*/
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferAV1;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_AV1_H */

View File

@ -0,0 +1,616 @@
/*
* Copyright (c) 2014 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_dec_hevc.h
* \brief The HEVC decoding API
*
* This file contains the \ref api_dec_hevc "HEVC decoding API".
*/
#ifndef VA_DEC_HEVC_H
#define VA_DEC_HEVC_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_hevc HEVC decoding API
*
* This HEVC decoding API supports Main and Main Still Picture profiles.
* And it supports both short slice format and long slice format.
*
* @{
*/
/**
* \brief HEVC Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters and should be sent once
* per frame.
*
*/
typedef struct _VAPictureParameterBufferHEVC {
/** \brief buffer description of decoded current picture
* only VA_PICTURE_HEVC_FIELD_PIC and VA_PICTURE_HEVC_BOTTOM_FIELD
* of "flags" fields are meaningful.
*/
VAPictureHEVC CurrPic;
/** \brief buffer description of reference frames in DPB */
VAPictureHEVC ReferenceFrames[15];
/** \brief picture width, shall be integer multiple of minimum CB size. */
uint16_t pic_width_in_luma_samples;
/** \brief picture height, shall be integer multiple of minimum CB size. */
uint16_t pic_height_in_luma_samples;
union {
struct {
/** following flags have same syntax and semantic as those in HEVC spec */
uint32_t chroma_format_idc : 2;
uint32_t separate_colour_plane_flag : 1;
uint32_t pcm_enabled_flag : 1;
uint32_t scaling_list_enabled_flag : 1;
uint32_t transform_skip_enabled_flag : 1;
uint32_t amp_enabled_flag : 1;
uint32_t strong_intra_smoothing_enabled_flag : 1;
uint32_t sign_data_hiding_enabled_flag : 1;
uint32_t constrained_intra_pred_flag : 1;
uint32_t cu_qp_delta_enabled_flag : 1;
uint32_t weighted_pred_flag : 1;
uint32_t weighted_bipred_flag : 1;
uint32_t transquant_bypass_enabled_flag : 1;
uint32_t tiles_enabled_flag : 1;
uint32_t entropy_coding_sync_enabled_flag : 1;
uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
uint32_t loop_filter_across_tiles_enabled_flag : 1;
uint32_t pcm_loop_filter_disabled_flag : 1;
/** set based on sps_max_num_reorder_pics of current temporal layer. */
uint32_t NoPicReorderingFlag : 1;
/** picture has no B slices */
uint32_t NoBiPredFlag : 1;
uint32_t ReservedBits : 11;
} bits;
uint32_t value;
} pic_fields;
/** following parameters have same syntax with those in HEVC spec */
/** \brief DPB size for current temporal layer */
uint8_t sps_max_dec_pic_buffering_minus1;
uint8_t bit_depth_luma_minus8;
uint8_t bit_depth_chroma_minus8;
uint8_t pcm_sample_bit_depth_luma_minus1;
uint8_t pcm_sample_bit_depth_chroma_minus1;
uint8_t log2_min_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_luma_coding_block_size;
uint8_t log2_min_transform_block_size_minus2;
uint8_t log2_diff_max_min_transform_block_size;
uint8_t log2_min_pcm_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
uint8_t max_transform_hierarchy_depth_intra;
uint8_t max_transform_hierarchy_depth_inter;
int8_t init_qp_minus26;
uint8_t diff_cu_qp_delta_depth;
int8_t pps_cb_qp_offset;
int8_t pps_cr_qp_offset;
uint8_t log2_parallel_merge_level_minus2;
uint8_t num_tile_columns_minus1;
uint8_t num_tile_rows_minus1;
/**
* when uniform_spacing_flag equals 1, application should populate
* column_width_minus[], and row_height_minus1[] with approperiate values.
*/
uint16_t column_width_minus1[19];
uint16_t row_height_minus1[21];
/**
* The Following Parameters are needed for Short Slice Format Only.
* Only format decoding can ignore them.
*/
/**
* \brief Parameters needed for parsing slice segment headers
*/
union {
struct {
/** following parameters have same syntax with those in HEVC spec */
uint32_t lists_modification_present_flag : 1;
uint32_t long_term_ref_pics_present_flag : 1;
uint32_t sps_temporal_mvp_enabled_flag : 1;
uint32_t cabac_init_present_flag : 1;
uint32_t output_flag_present_flag : 1;
uint32_t dependent_slice_segments_enabled_flag : 1;
uint32_t pps_slice_chroma_qp_offsets_present_flag : 1;
uint32_t sample_adaptive_offset_enabled_flag : 1;
uint32_t deblocking_filter_override_enabled_flag : 1;
uint32_t pps_disable_deblocking_filter_flag : 1;
uint32_t slice_segment_header_extension_present_flag : 1;
/** current picture with NUT between 16 and 21 inclusive */
uint32_t RapPicFlag : 1;
/** current picture with NUT between 19 and 20 inclusive */
uint32_t IdrPicFlag : 1;
/** current picture has only intra slices */
uint32_t IntraPicFlag : 1;
uint32_t ReservedBits : 18;
} bits;
uint32_t value;
} slice_parsing_fields;
/** following parameters have same syntax with those in HEVC spec */
uint8_t log2_max_pic_order_cnt_lsb_minus4;
uint8_t num_short_term_ref_pic_sets;
uint8_t num_long_term_ref_pic_sps;
uint8_t num_ref_idx_l0_default_active_minus1;
uint8_t num_ref_idx_l1_default_active_minus1;
int8_t pps_beta_offset_div2;
int8_t pps_tc_offset_div2;
uint8_t num_extra_slice_header_bits;
/**
* \brief number of bits that structure
* short_term_ref_pic_set( num_short_term_ref_pic_sets ) takes in slice
* segment header when short_term_ref_pic_set_sps_flag equals 0.
* if short_term_ref_pic_set_sps_flag equals 1, the value should be 0.
* the bit count is calculated after emulation prevention bytes are removed
* from bit streams.
* This variable is used for accelorater to skip parsing the
* short_term_ref_pic_set( num_short_term_ref_pic_sets ) structure.
*/
uint32_t st_rps_bits;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAPictureParameterBufferHEVC;
/**
* \brief HEVC Decoding Picture Parameter Buffer Structure for Range Extension
*
* This structure conveys picture level HEVC Range Extension parameters
* and should be sent once per frame. This data structure should be sent
* together with VAPictureParameterBufferHEVC in a single buffer of
* \ref VAPictureParameterBufferHEVCExtension since each frame
* of HEVC range extension contains both picture level parameters and picture
* level range extension parameters. They should be parsed together. The buffer
* type is same as \ref VAPictureParameterBufferHEVC.
*
*/
typedef struct _VAPictureParameterBufferHEVCRext {
union {
struct {
/** \brief HEVC range extension flags
* The following flags bears the same syntax and semantics as
* those defined in HEVC bit stream spec.
*/
uint32_t transform_skip_rotation_enabled_flag : 1;
uint32_t transform_skip_context_enabled_flag : 1;
uint32_t implicit_rdpcm_enabled_flag : 1;
uint32_t explicit_rdpcm_enabled_flag : 1;
uint32_t extended_precision_processing_flag : 1;
uint32_t intra_smoothing_disabled_flag : 1;
uint32_t high_precision_offsets_enabled_flag : 1;
uint32_t persistent_rice_adaptation_enabled_flag : 1;
uint32_t cabac_bypass_alignment_enabled_flag : 1;
uint32_t cross_component_prediction_enabled_flag : 1;
uint32_t chroma_qp_offset_list_enabled_flag : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 21;
} bits;
uint32_t value;
} range_extension_pic_fields;
/** \brief HEVC range extension flags
* The following flags bears the same syntax and semantics as
* those defined in HEVC bit stream spec.
*/
uint8_t diff_cu_chroma_qp_offset_depth;
uint8_t chroma_qp_offset_list_len_minus1;
uint8_t log2_sao_offset_scale_luma;
uint8_t log2_sao_offset_scale_chroma;
uint8_t log2_max_transform_skip_block_size_minus2;
int8_t cb_qp_offset_list[6];
int8_t cr_qp_offset_list[6];
} VAPictureParameterBufferHEVCRext;
/**
*\brief HEVC Decoding Picture Parameter Buffer Structure for
*Screen Content extension
*
*This structure conveys picture level HEVC Scc parameters
*and should be sent once per frame. This data structure should be sent
*together with VAPictureParameterBufferHEVC and VAPictureParameterBufferHEVCRext
*in a single buffer of \ref VAPictureParameterBufferHEVCExtension since each
*frame of HEVC SCC contains picture level parameters, picture level range
*extension parameters and picture level Scc parameters. They should be parsed
*together and the buffer type is same as \ref VAPictureParameterBufferHEVC.
*
*/
typedef struct _VAPictureParameterBufferHEVCScc {
union {
struct {
/** \brief HEVC Scc extension flags
* The following flags bears the same syntax and semantics as
* those defined in HEVC bit stream spec.
*/
/* indicates if intra block copy (IBC) is enabled or not. */
uint32_t pps_curr_pic_ref_enabled_flag : 1;
/* indicates if Palette Mode is enabled or not. */
uint32_t palette_mode_enabled_flag : 1;
/* controls the presence and inference of the use_integer_mv_flag syntax
* in slice segment header that specifies the resolution of motion
* vectors for inter prediction.
*/
uint32_t motion_vector_resolution_control_idc : 2;
/* specifies that the intra boundary filtering process is
* disabled or not for intra prediction.
*/
uint32_t intra_boundary_filtering_disabled_flag : 1;
/* specifies that an adaptive colour transform may be applied
* to the residual in the decoding process.
*/
uint32_t residual_adaptive_colour_transform_enabled_flag : 1;
/* specifies that slice_act_y_qp_offset, slice_act_cb_qp_offset,
* slice_act_cr_qp_offset are present in the slice header
*/
uint32_t pps_slice_act_qp_offsets_present_flag : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 25;
} bits;
uint32_t value;
} screen_content_pic_fields;
/* specifies the maximum allowed palette size. */
uint8_t palette_max_size;
/* Correspond to HEVC syntax elements of the same names.
* It specifies the difference between the maximum allowed palette
* predictor size and the maximum allowed palette size.
* App needs to enforce that the variable PaletteMaxPredictorSize,
* which is derived as follows:
* PaletteMaxPredictorSize = palette_max_size + delta_palette_max_predictor_size
* should have a value range of [0..128].
*/
uint8_t delta_palette_max_predictor_size;
/** \brief Size of initial palette predictor.
* It is derived from pps_num_palette_predictor_initializer or
* sps_num_palette_predictor_initializer_minus1.
* Details in HEVC SCC spec section 9.3.2.3.
*/
uint8_t predictor_palette_size;
/** \brief Palette predictor initializer.
* It is derived from pps_palette_predictor_initializers[][]
* or sps_palette_predictor_initializers[][].
* Details in HEVC SCC spec section 9.3.2.3.
*/
uint16_t predictor_palette_entries[3][128];
/* are used to determine the offsets that are applied to the
* quantization parameter values for the luma, Cb and Cr
* components, respectively.
*/
int8_t pps_act_y_qp_offset_plus5;
int8_t pps_act_cb_qp_offset_plus5;
int8_t pps_act_cr_qp_offset_plus3;
} VAPictureParameterBufferHEVCScc;
/**
* \brief HEVC Decoding Picture Parameter Buffer Structure including Extensions
*
* This structure conveys picture level HEVC parameters including basic version 1
* and range extension and screen content extension.
* The data buffer should be sent once per frame.
*
*/
typedef struct _VAPictureParameterBufferHEVCExtension {
/** \brief basic HEVC picture parameters data structure
*/
VAPictureParameterBufferHEVC base;
/** \brief HEVC range extension picture parameters data structure
*/
VAPictureParameterBufferHEVCRext rext;
/** \brief HEVC screen content picture parameters data structure
*/
VAPictureParameterBufferHEVCScc scc;
} VAPictureParameterBufferHEVCExtension;
/**
* \brief HEVC Slice Parameter Buffer Structure For Long Format
*
* VASliceParameterBufferHEVC structure should be accompanied by a
* slice data buffer, which holds the whole raw slice NAL unit bit streams
* including start code prefix and emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice segment header and should
* be sent once per slice.
*
* For short format, this data structure is not sent by application.
*
*/
typedef struct _VASliceParameterBufferHEVC {
/** @name Codec-independent Slice Parameter Buffer base. */
/**@{*/
/** \brief Number of bytes in the slice data buffer for this slice
* counting from and including NAL unit header.
*/
uint32_t slice_data_size;
/** \brief The offset to the NAL unit header for this slice */
uint32_t slice_data_offset;
/** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
uint32_t slice_data_flag;
/**
* \brief Byte offset from NAL unit header to the begining of slice_data().
*
* This byte offset is relative to and includes the NAL unit header
* and represents the number of bytes parsed in the slice_header()
* after the removal of any emulation prevention bytes in
* there. However, the slice data buffer passed to the hardware is
* the original bitstream, thus including any emulation prevention
* bytes.
*/
uint32_t slice_data_byte_offset;
/** HEVC syntax element. */
uint32_t slice_segment_address;
/** \brief index into ReferenceFrames[]
* RefPicList[0][] corresponds to RefPicList0[] of HEVC variable.
* RefPicList[1][] corresponds to RefPicList1[] of HEVC variable.
* value range [0..14, 0xFF], where 0xFF indicates invalid entry.
*/
uint8_t RefPicList[2][15];
union {
uint32_t value;
struct {
/** current slice is last slice of picture. */
uint32_t LastSliceOfPic : 1;
/** HEVC syntax element. */
uint32_t dependent_slice_segment_flag : 1;
/** HEVC syntax element. */
uint32_t slice_type : 2;
/** HEVC syntax element. */
uint32_t color_plane_id : 2;
/** HEVC syntax element. */
uint32_t slice_sao_luma_flag : 1;
/** HEVC syntax element. */
uint32_t slice_sao_chroma_flag : 1;
/** HEVC syntax element. */
uint32_t mvd_l1_zero_flag : 1;
/** HEVC syntax element. */
uint32_t cabac_init_flag : 1;
/** HEVC syntax element. */
uint32_t slice_temporal_mvp_enabled_flag : 1;
/** HEVC syntax element. */
uint32_t slice_deblocking_filter_disabled_flag : 1;
/** HEVC syntax element. */
uint32_t collocated_from_l0_flag : 1;
/** HEVC syntax element. */
uint32_t slice_loop_filter_across_slices_enabled_flag : 1;
uint32_t reserved : 18;
} fields;
} LongSliceFlags;
/** HEVC syntax element. Collocated Reference Picture Index.
* index to RefPicList[0][] or RefPicList[1][].
* when slice_temporal_mvp_enabled_flag equals 0, it should take value 0xFF.
* value range [0..14, 0xFF].
*/
uint8_t collocated_ref_idx;
/** HEVC syntax element.
* if num_ref_idx_active_override_flag equals 0, host decoder should
* set its value to num_ref_idx_l0_default_active_minus1.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** HEVC syntax element.
* if num_ref_idx_active_override_flag equals 0, host decoder should
* set its value to num_ref_idx_l1_default_active_minus1.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** HEVC syntax element. */
int8_t slice_qp_delta;
/** HEVC syntax element. */
int8_t slice_cb_qp_offset;
/** HEVC syntax element. */
int8_t slice_cr_qp_offset;
/** HEVC syntax element. */
int8_t slice_beta_offset_div2;
/** HEVC syntax element. */
int8_t slice_tc_offset_div2;
/** HEVC syntax element. */
uint8_t luma_log2_weight_denom;
/** HEVC syntax element. */
int8_t delta_chroma_log2_weight_denom;
/** HEVC syntax element. */
int8_t delta_luma_weight_l0[15];
/** HEVC syntax element. */
int8_t luma_offset_l0[15];
/** HEVC syntax element. */
int8_t delta_chroma_weight_l0[15][2];
/** corresponds to HEVC spec variable of the same name. */
int8_t ChromaOffsetL0[15][2];
/** HEVC syntax element. */
int8_t delta_luma_weight_l1[15];
/** HEVC syntax element. */
int8_t luma_offset_l1[15];
/** HEVC syntax element. */
int8_t delta_chroma_weight_l1[15][2];
/** corresponds to HEVC spec variable of the same name. */
int8_t ChromaOffsetL1[15][2];
/** HEVC syntax element. */
uint8_t five_minus_max_num_merge_cand;
/** HEVC syntax element. */
uint16_t num_entry_point_offsets;
/** HEVC syntax element. */
uint16_t entry_offset_to_subset_array;
/** \brief Number of emulation prevention bytes in slice header. */
uint16_t slice_data_num_emu_prevn_bytes;
/**@}*/
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW - 2];
} VASliceParameterBufferHEVC;
/**
* \brief HEVC Extented Slice Parameter Buffer Structure For Long Format
*
* This data structure contains extension profiles (range extension and screen content).
*
* VASliceParameterBufferHEVCRext structure should be accompanied by a
* slice data buffer, which holds the whole raw slice NAL unit bit streams
* including start code prefix and emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice segment header and should
* be sent once per slice with VASliceParameterBufferHEVC in a single buffer of
* \ref VASliceParameterBufferHEVCExtension and the buffer type is same as \ref
* VASliceParameterBufferHEVC.
*
* For short format, this data structure is not sent by application.
*
*/
typedef struct _VASliceParameterBufferHEVCRext {
/* below four parameters are used to replace data types of the
* corresponding parameters of those in \# VASliceParameterBufferHEVC.
*/
int16_t luma_offset_l0[15];
int16_t ChromaOffsetL0[15][2];
int16_t luma_offset_l1[15];
int16_t ChromaOffsetL1[15][2];
union {
struct {
uint32_t cu_chroma_qp_offset_enabled_flag : 1;
uint32_t use_integer_mv_flag : 1;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved : 30;
} bits;
uint32_t value;
} slice_ext_flags;
/** \brief Screen Content Extension parameters.
* data range [-12..12]
*/
int8_t slice_act_y_qp_offset;
int8_t slice_act_cb_qp_offset;
int8_t slice_act_cr_qp_offset;
} VASliceParameterBufferHEVCRext;
/**
* \brief HEVC Decoding Slice Parameter Buffer Structure For Long Format including Extensions
*
* This data structure contains both baseline HEVC profiles (main, main10)
* and extension profiles (range extension and screen content).
*
* VASliceParameterBufferHEVCExtension structure should be accompanied by a
* slice data buffer, which holds the whole raw slice NAL unit bit streams
* including start code prefix and emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice segment header and should
* be sent once per slice. For HEVC range extension and HEVC Scc decoding,
* application should parse both basic slice parameters and extented slice
* parameters into this buffer structure and sent it.
*
* For short format, this data structure is not sent by application.
*
*/
typedef struct _VASliceParameterBufferHEVCExtension {
/** \brief baseline HEVC slice parameters data structure */
VASliceParameterBufferHEVC base;
/** \brief extented HEVC slice parameters data structure */
VASliceParameterBufferHEVCRext rext;
} VASliceParameterBufferHEVCExtension;
/**
* \brief HEVC Inverse Quantization Matrix Buffer Structure
*
* This structure is sent once per frame,
* and only when scaling_list_enabled_flag = 1.
* When sps_scaling_list_data_present_flag = 0, app still
* needs to send in this structure with default matrix values.
*
* Matrix entries are in raster scan order which follows HEVC spec.
*/
typedef struct _VAIQMatrixBufferHEVC {
/**
* \brief scaling lists,
* corresponds to same HEVC spec syntax element
* ScalingList[ i ][ MatrixID ][ j ].
*
* \brief 4x4 scaling,
* correspongs i = 0, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 15, inclusive.
*/
uint8_t ScalingList4x4[6][16];
/**
* \brief 8x8 scaling,
* correspongs i = 1, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t ScalingList8x8[6][64];
/**
* \brief 16x16 scaling,
* correspongs i = 2, MatrixID is in the range of 0 to 5,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t ScalingList16x16[6][64];
/**
* \brief 32x32 scaling,
* correspongs i = 3, MatrixID is in the range of 0 to 1,
* inclusive. And j is in the range of 0 to 63, inclusive.
*/
uint8_t ScalingList32x32[2][64];
/**
* \brief DC values of the 16x16 scaling lists,
* corresponds to HEVC spec syntax
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
* with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
*/
uint8_t ScalingListDC16x16[6];
/**
* \brief DC values of the 32x32 scaling lists,
* corresponds to HEVC spec syntax
* scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
* with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
*/
uint8_t ScalingListDC32x32[2];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferHEVC;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_HEVC_H */

View File

@ -0,0 +1,157 @@
/*
* Copyright (c) 2007-2012 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_dec_jpeg.h
* \brief The JPEG decoding API
*
* This file contains the \ref api_dec_jpeg "JPEG decoding API".
*/
#ifndef VA_DEC_JPEG_H
#define VA_DEC_JPEG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <va/va.h>
/**
* \defgroup api_dec_jpeg JPEG decoding API
*
* This JPEG decoding API supports Baseline profile only.
*
* @{
*/
/**
* \brief Picture parameter for JPEG decoding.
*
* This structure holds information from the frame header, along with
* definitions from additional segments.
*/
typedef struct _VAPictureParameterBufferJPEGBaseline {
/** \brief Picture width in pixels. */
uint16_t picture_width;
/** \brief Picture height in pixels. */
uint16_t picture_height;
struct {
/** \brief Component identifier (Ci). */
uint8_t component_id;
/** \brief Horizontal sampling factor (Hi). */
uint8_t h_sampling_factor;
/** \brief Vertical sampling factor (Vi). */
uint8_t v_sampling_factor;
/* \brief Quantization table selector (Tqi). */
uint8_t quantiser_table_selector;
} components[255];
/** \brief Number of components in frame (Nf). */
uint8_t num_components;
/** \brief Input color space 0: YUV, 1: RGB, 2: BGR, others: reserved */
uint8_t color_space;
/** \brief Set to VA_ROTATION_* for a single rotation angle reported by VAConfigAttribDecJPEG. */
uint32_t rotation;
/** \brief crop rectangle boundary in pixels */
VARectangle crop_rectangle;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM - 3];
} VAPictureParameterBufferJPEGBaseline;
/**
* \brief Quantization table for JPEG decoding.
*
* This structure holds the complete quantization tables. This is an
* aggregation of all quantization table (DQT) segments maintained by
* the application. i.e. up to 4 quantization tables are stored in
* there for baseline profile.
*
* The #load_quantization_table array can be used as a hint to notify
* the VA driver implementation about which table(s) actually changed
* since the last submission of this buffer.
*
* The #quantiser_table values are specified in zig-zag scan order.
*/
typedef struct _VAIQMatrixBufferJPEGBaseline {
/** \brief Specifies which #quantiser_table is valid. */
uint8_t load_quantiser_table[4];
/** \brief Quanziation tables indexed by table identifier (Tqi). */
uint8_t quantiser_table[4][64];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferJPEGBaseline;
/**
* \brief Slice parameter for JPEG decoding.
*
* This structure holds information from the scan header, along with
* definitions from additional segments. The associated slice data
* buffer holds all entropy coded segments (ECS) in the scan.
*/
typedef struct _VASliceParameterBufferJPEGBaseline {
/** @name Codec-independent Slice Parameter Buffer base. */
/**@{*/
/** \brief Number of bytes in the slice data buffer for this slice. */
uint32_t slice_data_size;
/** \brief The offset to the first byte of the first MCU. */
uint32_t slice_data_offset;
/** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_xxx. */
uint32_t slice_data_flag;
/**@}*/
/** \brief Scan horizontal position. */
uint32_t slice_horizontal_position;
/** \brief Scan vertical position. */
uint32_t slice_vertical_position;
struct {
/** \brief Scan component selector (Csj). */
uint8_t component_selector;
/** \brief DC entropy coding table selector (Tdj). */
uint8_t dc_table_selector;
/** \brief AC entropy coding table selector (Taj). */
uint8_t ac_table_selector;
} components[4];
/** \brief Number of components in scan (Ns). */
uint8_t num_components;
/** \brief Restart interval definition (Ri). */
uint16_t restart_interval;
/** \brief Number of MCUs in a scan. */
uint32_t num_mcus;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferJPEGBaseline;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_JPEG_H */

View File

@ -0,0 +1,249 @@
/*
* Copyright (c) 2007-2012 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_dec_vp8.h
* \brief VP8 decoding API
*
* This file contains the \ref api_dec_vp8 "VP8 decoding API".
*/
#ifndef VA_DEC_VP8_H
#define VA_DEC_VP8_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vp8 VP8 decoding API
*
* @{
*/
/**
* \brief VPX Bool Coder Context structure
*
* This common structure is defined for potential sharing by other VP formats
*
*/
typedef struct _VABoolCoderContextVPX {
/* partition 0 "range" */
uint8_t range;
/* partition 0 "value" */
uint8_t value;
/*
* 'partition 0 number of shifts before an output byte is available'
* it is the number of remaining bits in 'value' for decoding, range [0, 7].
*/
uint8_t count;
} VABoolCoderContextVPX;
/**
* \brief VP8 Decoding Picture Parameter Buffer Structure
*
* This structure conveys frame level parameters and should be sent once
* per frame.
*
*/
typedef struct _VAPictureParameterBufferVP8 {
/* frame width in pixels */
uint32_t frame_width;
/* frame height in pixels */
uint32_t frame_height;
/* specifies the "last" reference frame */
VASurfaceID last_ref_frame;
/* specifies the "golden" reference frame */
VASurfaceID golden_ref_frame;
/* specifies the "alternate" referrence frame */
VASurfaceID alt_ref_frame;
/* specifies the out-of-loop deblocked frame, not used currently */
VASurfaceID out_of_loop_frame;
union {
struct {
/* same as key_frame in bitstream syntax, 0 means a key frame */
uint32_t key_frame : 1;
/* same as version in bitstream syntax */
uint32_t version : 3;
/* same as segmentation_enabled in bitstream syntax */
uint32_t segmentation_enabled : 1;
/* same as update_mb_segmentation_map in bitstream syntax */
uint32_t update_mb_segmentation_map : 1;
/* same as update_segment_feature_data in bitstream syntax */
uint32_t update_segment_feature_data : 1;
/* same as filter_type in bitstream syntax */
uint32_t filter_type : 1;
/* same as sharpness_level in bitstream syntax */
uint32_t sharpness_level : 3;
/* same as loop_filter_adj_enable in bitstream syntax */
uint32_t loop_filter_adj_enable : 1;
/* same as mode_ref_lf_delta_update in bitstream syntax */
uint32_t mode_ref_lf_delta_update : 1;
/* same as sign_bias_golden in bitstream syntax */
uint32_t sign_bias_golden : 1;
/* same as sign_bias_alternate in bitstream syntax */
uint32_t sign_bias_alternate : 1;
/* same as mb_no_coeff_skip in bitstream syntax */
uint32_t mb_no_coeff_skip : 1;
/* flag to indicate that loop filter should be disabled */
uint32_t loop_filter_disable : 1;
} bits;
uint32_t value;
} pic_fields;
/*
* probabilities of the segment_id decoding tree and same as
* mb_segment_tree_probs in the spec.
*/
uint8_t mb_segment_tree_probs[3];
/* Post-adjustment loop filter levels for the 4 segments */
uint8_t loop_filter_level[4];
/* loop filter deltas for reference frame based MB level adjustment */
int8_t loop_filter_deltas_ref_frame[4];
/* loop filter deltas for coding mode based MB level adjustment */
int8_t loop_filter_deltas_mode[4];
/* same as prob_skip_false in bitstream syntax */
uint8_t prob_skip_false;
/* same as prob_intra in bitstream syntax */
uint8_t prob_intra;
/* same as prob_last in bitstream syntax */
uint8_t prob_last;
/* same as prob_gf in bitstream syntax */
uint8_t prob_gf;
/*
* list of 4 probabilities of the luma intra prediction mode decoding
* tree and same as y_mode_probs in frame header
*/
uint8_t y_mode_probs[4];
/*
* list of 3 probabilities of the chroma intra prediction mode decoding
* tree and same as uv_mode_probs in frame header
*/
uint8_t uv_mode_probs[3];
/*
* updated mv decoding probabilities and same as mv_probs in
* frame header
*/
uint8_t mv_probs[2][19];
VABoolCoderContextVPX bool_coder_ctx;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAPictureParameterBufferVP8;
/**
* \brief VP8 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to data partitions and should be
* sent once per frame. Slice data buffer of VASliceDataBufferType is used
* to send the partition data.
*
*/
typedef struct _VASliceParameterBufferVP8 {
/*
* number of bytes in the slice data buffer for the partitions
*/
uint32_t slice_data_size;
/*
* offset to the first byte of partition data (control partition)
*/
uint32_t slice_data_offset;
/*
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
/*
* offset to the first bit of MB from the first byte of partition data(slice_data_offset)
*/
uint32_t macroblock_offset;
/*
* Partitions
* (1<<log2_nbr_of_dct_partitions)+1, count both control partition (frame header) and toke partition
*/
uint8_t num_of_partitions;
/*
* partition_size[0] is remaining bytes of control partition after parsed by application.
* exclude current byte for the remaining bits in bool_coder_ctx.
* exclude the uncompress data chunk since first_part_size 'excluding the uncompressed data chunk'
*/
uint32_t partition_size[9];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferVP8;
/**
* \brief VP8 Coefficient Probability Data Buffer Structure
*
* Contains the contents of the token probability table, which may be
* incrementally modified in the frame header. There are four dimensions to
* the token probability array. The outermost dimension is indexed by the
* type of plane being decoded; the next dimension is selected by the
* position of the coefficient being decoded; the third dimension, * roughly
* speaking, measures the "local complexity" or extent to which nearby
* coefficients are non-zero; the fourth, and final, dimension of the token
* probability array is indexed by the position in the token tree structure,
* as are all tree probability arrays. This structure is sent once per frame.
*
*/
typedef struct _VAProbabilityDataBufferVP8 {
uint8_t dct_coeff_probs[4][8][3][11];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAProbabilityDataBufferVP8;
/**
* \brief VP8 Inverse Quantization Matrix Buffer Structure
*
* Contains quantization indices for yac(0),ydc(1),y2dc(2),y2ac(3),uvdc(4),
* uvac(5) for each segment (0-3). When segmentation is disabled, only
* quantization_index[0][] will be used. This structure is sent once per frame.
*/
typedef struct _VAIQMatrixBufferVP8 {
/*
* array first dimensional is segment and 2nd dimensional is Q index
* all Q indexs should be clipped to be range [0, 127]
*/
uint16_t quantization_index[4][6];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAIQMatrixBufferVP8;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VP8_H */

View File

@ -0,0 +1,312 @@
/*
* Copyright (c) 2014 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_dec_vp9.h
* \brief The VP9 decoding API
*
* This file contains the \ref api_dec_vp9 "VP9 decoding API".
*/
#ifndef VA_DEC_VP9_H
#define VA_DEC_VP9_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vp9 VP9 decoding API
*
* This VP9 decoding API supports 8-bit 420 format only.
*
* @{
*/
/**
* \brief VP9 Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters.
* App should send a surface with this data structure down to VAAPI once
* per frame.
*
*/
typedef struct _VADecPictureParameterBufferVP9 {
/** \brief picture width
* Picture original resolution. The value may not be multiple of 8.
*/
uint16_t frame_width;
/** \brief picture height
* Picture original resolution. The value may not be multiple of 8.
*/
uint16_t frame_height;
/** \brief Surface indices of reference frames in DPB.
*
* Each entry of the list specifies the surface index of the picture
* that is referred by current picture or will be referred by any future
* picture.
* Application who calls this API should update this list based on the
* refreshing information from VP9 bitstream.
*/
VASurfaceID reference_frames[8];
union {
struct {
/** \brief flags for current picture
* same syntax and semantic as those in VP9 code
*/
uint32_t subsampling_x : 1;
uint32_t subsampling_y : 1;
uint32_t frame_type : 1;
uint32_t show_frame : 1;
uint32_t error_resilient_mode : 1;
uint32_t intra_only : 1;
uint32_t allow_high_precision_mv : 1;
uint32_t mcomp_filter_type : 3;
uint32_t frame_parallel_decoding_mode : 1;
uint32_t reset_frame_context : 2;
uint32_t refresh_frame_context : 1;
uint32_t frame_context_idx : 2;
uint32_t segmentation_enabled : 1;
/** \brief corresponds to variable temporal_update in VP9 code.
*/
uint32_t segmentation_temporal_update : 1;
/** \brief corresponds to variable update_mb_segmentation_map
* in VP9 code.
*/
uint32_t segmentation_update_map : 1;
/** \brief Index of reference_frames[] and points to the
* LAST reference frame.
* It corresponds to active_ref_idx[0] in VP9 code.
*/
uint32_t last_ref_frame : 3;
/** \brief Sign Bias of the LAST reference frame.
* It corresponds to ref_frame_sign_bias[LAST_FRAME] in VP9 code.
*/
uint32_t last_ref_frame_sign_bias : 1;
/** \brief Index of reference_frames[] and points to the
* GOLDERN reference frame.
* It corresponds to active_ref_idx[1] in VP9 code.
*/
uint32_t golden_ref_frame : 3;
/** \brief Sign Bias of the GOLDERN reference frame.
* Corresponds to ref_frame_sign_bias[GOLDERN_FRAME] in VP9 code.
*/
uint32_t golden_ref_frame_sign_bias : 1;
/** \brief Index of reference_frames[] and points to the
* ALTERNATE reference frame.
* Corresponds to active_ref_idx[2] in VP9 code.
*/
uint32_t alt_ref_frame : 3;
/** \brief Sign Bias of the ALTERNATE reference frame.
* Corresponds to ref_frame_sign_bias[ALTREF_FRAME] in VP9 code.
*/
uint32_t alt_ref_frame_sign_bias : 1;
/** \brief Lossless Mode
* LosslessFlag = base_qindex == 0 &&
* y_dc_delta_q == 0 &&
* uv_dc_delta_q == 0 &&
* uv_ac_delta_q == 0;
* Where base_qindex, y_dc_delta_q, uv_dc_delta_q and uv_ac_delta_q
* are all variables in VP9 code.
*/
uint32_t lossless_flag : 1;
} bits;
uint32_t value;
} pic_fields;
/* following parameters have same syntax with those in VP9 code */
uint8_t filter_level;
uint8_t sharpness_level;
/** \brief number of tile rows specified by (1 << log2_tile_rows).
* It corresponds the variable with same name in VP9 code.
*/
uint8_t log2_tile_rows;
/** \brief number of tile columns specified by (1 << log2_tile_columns).
* It corresponds the variable with same name in VP9 code.
*/
uint8_t log2_tile_columns;
/** \brief Number of bytes taken up by the uncompressed frame header,
* which corresponds to byte length of function
* read_uncompressed_header() in VP9 code.
* Specifically, it is the byte count from bit stream buffer start to
* the last byte of uncompressed frame header.
* If there are other meta data in the buffer before uncompressed header,
* its size should be also included here.
*/
uint8_t frame_header_length_in_bytes;
/** \brief The byte count of compressed header the bitstream buffer,
* which corresponds to syntax first_partition_size in code.
*/
uint16_t first_partition_size;
/** These values are segment probabilities with same names in VP9
* function setup_segmentation(). They should be parsed directly from
* bitstream by application.
*/
uint8_t mb_segment_tree_probs[7];
uint8_t segment_pred_probs[3];
/** \brief VP9 Profile definition
* value range [0..3].
*/
uint8_t profile;
/** \brief VP9 bit depth per sample
* same for both luma and chroma samples.
*/
uint8_t bit_depth;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VADecPictureParameterBufferVP9;
/**
* \brief VP9 Segmentation Parameter Data Structure
*
* This structure conveys per segment parameters.
* 8 of this data structure will be included in VASegmentationParameterBufferVP9
* and sent to API in a single buffer.
*
*/
typedef struct _VASegmentParameterVP9 {
union {
struct {
/** \brief Indicates if per segment reference frame indicator
* is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference_enabled : 1;
/** \brief Specifies per segment reference indication.
* 0: reserved
* 1: Last ref
* 2: golden
* 3: altref
* Value can be derived from variable data when
* j == SEG_LVL_REF_FRAME in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference : 2;
/** \brief Indicates if per segment skip feature is enabled.
* Corresponding to variable feature_enabled when
* j == SEG_LVL_SKIP in function setup_segmentation() VP9 code.
*/
uint16_t segment_reference_skipped : 1;
} fields;
uint16_t value;
} segment_flags;
/** \brief Specifies the filter level information per segment.
* The value corresponds to variable lfi->lvl[seg][ref][mode] in VP9 code,
* where m is [ref], and n is [mode] in FilterLevel[m][n].
*/
uint8_t filter_level[4][2];
/** \brief Specifies per segment Luma AC quantization scale.
* Corresponding to y_dequant[qindex][1] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t luma_ac_quant_scale;
/** \brief Specifies per segment Luma DC quantization scale.
* Corresponding to y_dequant[qindex][0] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t luma_dc_quant_scale;
/** \brief Specifies per segment Chroma AC quantization scale.
* Corresponding to uv_dequant[qindex][1] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t chroma_ac_quant_scale;
/** \brief Specifies per segment Chroma DC quantization scale.
* Corresponding to uv_dequant[qindex][0] in vp9_mb_init_quantizer()
* function of VP9 code.
*/
int16_t chroma_dc_quant_scale;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASegmentParameterVP9;
/**
* \brief VP9 Slice Parameter Buffer Structure
*
* This structure conveys parameters related to segmentation data and should be
* sent once per frame.
*
* When segmentation is disabled, only SegParam[0] has valid values,
* all other entries should be populated with 0.
* Otherwise, all eight entries should be valid.
*
* Slice data buffer of VASliceDataBufferType is used
* to send the bitstream which should include whole or part of partition 0
* (at least compressed header) to the end of frame.
*
*/
typedef struct _VASliceParameterBufferVP9 {
/** \brief The byte count of current frame in the bitstream buffer,
* starting from first byte of the buffer.
* It uses the name slice_data_size to be consitent with other codec,
* but actually means frame_data_size.
*/
uint32_t slice_data_size;
/**
* offset to the first byte of partition data (control partition)
*/
uint32_t slice_data_offset;
/**
* see VA_SLICE_DATA_FLAG_XXX definitions
*/
uint32_t slice_data_flag;
/**
* \brief per segment information
*/
VASegmentParameterVP9 seg_param[8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceParameterBufferVP9;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VP9_H */

View File

@ -0,0 +1,688 @@
/*
* Copyright (c) 2024 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_dec_vvc.h
* \brief The VVC decoding API
*
* This file contains the \ref api_dec_vvc "VVC decoding API".
*/
#ifndef VA_DEC_VVC_H
#define VA_DEC_VVC_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_dec_vvc VVC decoding API
*
* This VVC decoding API supports Main 10 profile and Multilayer Main 10 profile.
* And it supports only long slice format.
*
* @{
*/
/**
* \brief Weighted Prediction Parameters.
*/
typedef struct _VAWeightedPredInfo {
/** \brief Weighted Prediction parameters.
* All the parameters except reserved bytes are VVC syntax.
*/
uint8_t luma_log2_weight_denom;
int8_t delta_chroma_log2_weight_denom;
uint8_t num_l0_weights;
uint8_t luma_weight_l0_flag[15];
uint8_t chroma_weight_l0_flag[15];
int8_t delta_luma_weight_l0[15];
int8_t luma_offset_l0[15];
int8_t delta_chroma_weight_l0[15][2];
int16_t delta_chroma_offset_l0[15][2];
uint8_t num_l1_weights;
uint8_t luma_weight_l1_flag[15];
uint8_t chroma_weight_l1_flag[15];
int8_t delta_luma_weight_l1[15];
int8_t luma_offset_l1[15];
int8_t delta_chroma_weight_l1[15][2];
int16_t delta_chroma_offset_l1[15][2];
/** \brief Reserved for future use, must be zero */
uint16_t reserved16b;
uint32_t reserved32b;
} VAWeightedPredInfo;
/**
* \brief VVC Decoding Picture Parameter Buffer Structure
*
* This structure conveys picture level parameters and should be sent once
* per frame.
*
* Host decoder is required to send in a buffer of VAPictureParameterBufferVVC
* as the first va buffer for each frame.
*
*/
typedef struct _VAPictureParameterBufferVVC {
/** \brief buffer description of decoded current picture
*/
VAPictureVVC CurrPic;
/** \brief buffer description of reference frames in DPB */
VAPictureVVC ReferenceFrames[15];
/** \brief picture width, shall be integer multiple of Max(8, MinCbSizeY). */
uint16_t pps_pic_width_in_luma_samples;
/** \brief picture height, shall be integer multiple of Max(8, MinCbSizeY). */
uint16_t pps_pic_height_in_luma_samples;
/** \brief sequence level parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint16_t sps_num_subpics_minus1;
uint8_t sps_chroma_format_idc;
uint8_t sps_bitdepth_minus8;
uint8_t sps_log2_ctu_size_minus5;
uint8_t sps_log2_min_luma_coding_block_size_minus2;
uint8_t sps_log2_transform_skip_max_size_minus2;
/** \brief chroma QP mapping table.
* ChromaQpTable[][] corresponds to VVC spec variable with the same name.
* It is derived according to formula (57) in VVC spec section 7.4.3.4.
*/
int8_t ChromaQpTable[3][111];
uint8_t sps_six_minus_max_num_merge_cand;
uint8_t sps_five_minus_max_num_subblock_merge_cand;
uint8_t sps_max_num_merge_cand_minus_max_num_gpm_cand;
uint8_t sps_log2_parallel_merge_level_minus2;
uint8_t sps_min_qp_prime_ts;
uint8_t sps_six_minus_max_num_ibc_merge_cand;
uint8_t sps_num_ladf_intervals_minus2;
int8_t sps_ladf_lowest_interval_qp_offset;
int8_t sps_ladf_qp_offset[4];
uint16_t sps_ladf_delta_threshold_minus1[4];
/** \brief Reserved for future use, must be zero */
uint32_t reserved32b01[VA_PADDING_LOW - 2];
union {
struct {
uint64_t sps_subpic_info_present_flag : 1;
uint64_t sps_independent_subpics_flag : 1;
uint64_t sps_subpic_same_size_flag : 1;
uint64_t sps_entropy_coding_sync_enabled_flag : 1;
uint64_t sps_qtbtt_dual_tree_intra_flag : 1;
uint64_t sps_max_luma_transform_size_64_flag : 1;
uint64_t sps_transform_skip_enabled_flag : 1;
uint64_t sps_bdpcm_enabled_flag : 1;
uint64_t sps_mts_enabled_flag : 1;
uint64_t sps_explicit_mts_intra_enabled_flag : 1;
uint64_t sps_explicit_mts_inter_enabled_flag : 1;
uint64_t sps_lfnst_enabled_flag : 1;
uint64_t sps_joint_cbcr_enabled_flag : 1;
uint64_t sps_same_qp_table_for_chroma_flag : 1;
uint64_t sps_sao_enabled_flag : 1;
uint64_t sps_alf_enabled_flag : 1;
uint64_t sps_ccalf_enabled_flag : 1;
uint64_t sps_lmcs_enabled_flag : 1;
uint64_t sps_sbtmvp_enabled_flag : 1;
uint64_t sps_amvr_enabled_flag : 1;
uint64_t sps_smvd_enabled_flag : 1;
uint64_t sps_mmvd_enabled_flag : 1;
uint64_t sps_sbt_enabled_flag : 1;
uint64_t sps_affine_enabled_flag : 1;
uint64_t sps_6param_affine_enabled_flag : 1;
uint64_t sps_affine_amvr_enabled_flag : 1;
uint64_t sps_affine_prof_enabled_flag : 1;
uint64_t sps_bcw_enabled_flag : 1;
uint64_t sps_ciip_enabled_flag : 1;
uint64_t sps_gpm_enabled_flag : 1;
uint64_t sps_isp_enabled_flag : 1;
uint64_t sps_mrl_enabled_flag : 1;
uint64_t sps_mip_enabled_flag : 1;
uint64_t sps_cclm_enabled_flag : 1;
uint64_t sps_chroma_horizontal_collocated_flag : 1;
uint64_t sps_chroma_vertical_collocated_flag : 1;
uint64_t sps_palette_enabled_flag : 1;
uint64_t sps_act_enabled_flag : 1;
uint64_t sps_ibc_enabled_flag : 1;
uint64_t sps_ladf_enabled_flag : 1;
uint64_t sps_explicit_scaling_list_enabled_flag : 1;
uint64_t sps_scaling_matrix_for_lfnst_disabled_flag : 1;
uint64_t sps_scaling_matrix_for_alternative_colour_space_disabled_flag : 1;
uint64_t sps_scaling_matrix_designated_colour_space_flag : 1;
uint64_t sps_virtual_boundaries_enabled_flag : 1;
uint64_t sps_virtual_boundaries_present_flag : 1;
/** \brief Reserved for future use, must be zero */
uint64_t reserved : 18;
} bits;
uint64_t value;
} sps_flags;
/** \brief picture level parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
/** \brief number of vertical virtual boundaries on the picture.
* NumVerVirtualBoundaries corresponds to VVC spec variable with the same name.
* It is derived according to formula (78) in VVC spec section 7.4.3.8.
*/
uint8_t NumVerVirtualBoundaries;
/** \brief number of horizontal virtual boundaries on the picture.
* NumHorVirtualBoundaries corresponds to VVC spec variable with the same name.
* It is derived according to formula (80) in VVC spec section 7.4.3.8.
*/
uint8_t NumHorVirtualBoundaries;
/** \brief location of the vertical virtual boundary in units of luma samples.
* VirtualBoundaryPosX[] corresponds to VVC spec variable with the same name.
* It is derived according to formula (79) in VVC spec section 7.4.3.8.
*/
uint16_t VirtualBoundaryPosX[3];
/** \brief location of the horizontal virtual boundary in units of luma samples.
* VirtualBoundaryPosY[] corresponds to VVC spec variable with the same name.
* It is derived according to formula (81) in VVC spec section 7.4.3.8.
*/
uint16_t VirtualBoundaryPosY[3];
int32_t pps_scaling_win_left_offset;
int32_t pps_scaling_win_right_offset;
int32_t pps_scaling_win_top_offset;
int32_t pps_scaling_win_bottom_offset;
int8_t pps_num_exp_tile_columns_minus1;
uint16_t pps_num_exp_tile_rows_minus1;
uint16_t pps_num_slices_in_pic_minus1;
uint16_t pps_pic_width_minus_wraparound_offset;
int8_t pps_cb_qp_offset;
int8_t pps_cr_qp_offset;
int8_t pps_joint_cbcr_qp_offset_value;
uint8_t pps_chroma_qp_offset_list_len_minus1;
int8_t pps_cb_qp_offset_list[6];
int8_t pps_cr_qp_offset_list[6];
int8_t pps_joint_cbcr_qp_offset_list[6];
/** \brief Reserved for future use, must be zero */
uint16_t reserved16b01;
uint32_t reserved32b02[VA_PADDING_LOW - 2];
union {
struct {
uint32_t pps_loop_filter_across_tiles_enabled_flag : 1;
uint32_t pps_rect_slice_flag : 1;
uint32_t pps_single_slice_per_subpic_flag : 1;
uint32_t pps_loop_filter_across_slices_enabled_flag : 1;
uint32_t pps_weighted_pred_flag : 1;
uint32_t pps_weighted_bipred_flag : 1;
uint32_t pps_ref_wraparound_enabled_flag : 1;
uint32_t pps_cu_qp_delta_enabled_flag : 1;
uint32_t pps_cu_chroma_qp_offset_list_enabled_flag : 1;
uint32_t pps_deblocking_filter_override_enabled_flag : 1;
uint32_t pps_deblocking_filter_disabled_flag : 1;
uint32_t pps_dbf_info_in_ph_flag : 1;
uint32_t pps_sao_info_in_ph_flag : 1;
uint32_t pps_alf_info_in_ph_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 18;
} bits;
uint32_t value;
} pps_flags;
/** \brief picture header parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint8_t ph_lmcs_aps_id;
uint8_t ph_scaling_list_aps_id;
uint8_t ph_log2_diff_min_qt_min_cb_intra_slice_luma;
uint8_t ph_max_mtt_hierarchy_depth_intra_slice_luma;
uint8_t ph_log2_diff_max_bt_min_qt_intra_slice_luma;
uint8_t ph_log2_diff_max_tt_min_qt_intra_slice_luma;
uint8_t ph_log2_diff_min_qt_min_cb_intra_slice_chroma;
uint8_t ph_max_mtt_hierarchy_depth_intra_slice_chroma;
uint8_t ph_log2_diff_max_bt_min_qt_intra_slice_chroma;
uint8_t ph_log2_diff_max_tt_min_qt_intra_slice_chroma;
uint8_t ph_cu_qp_delta_subdiv_intra_slice;
uint8_t ph_cu_chroma_qp_offset_subdiv_intra_slice;
uint8_t ph_log2_diff_min_qt_min_cb_inter_slice;
uint8_t ph_max_mtt_hierarchy_depth_inter_slice;
uint8_t ph_log2_diff_max_bt_min_qt_inter_slice;
uint8_t ph_log2_diff_max_tt_min_qt_inter_slice;
uint8_t ph_cu_qp_delta_subdiv_inter_slice;
uint8_t ph_cu_chroma_qp_offset_subdiv_inter_slice;
/** \brief Reserved for future use, must be zero */
uint16_t reserved16b02;
uint32_t reserved32b03[VA_PADDING_LOW - 2];
union {
struct {
uint32_t ph_non_ref_pic_flag : 1;
uint32_t ph_alf_enabled_flag : 1;
uint32_t ph_alf_cb_enabled_flag : 1;
uint32_t ph_alf_cr_enabled_flag : 1;
uint32_t ph_alf_cc_cb_enabled_flag : 1;
uint32_t ph_alf_cc_cr_enabled_flag : 1;
uint32_t ph_lmcs_enabled_flag : 1;
uint32_t ph_chroma_residual_scale_flag : 1;
uint32_t ph_explicit_scaling_list_enabled_flag : 1;
uint32_t ph_virtual_boundaries_present_flag : 1;
uint32_t ph_temporal_mvp_enabled_flag : 1;
uint32_t ph_mmvd_fullpel_only_flag : 1;
uint32_t ph_mvd_l1_zero_flag : 1;
uint32_t ph_bdof_disabled_flag : 1;
uint32_t ph_dmvr_disabled_flag : 1;
uint32_t ph_prof_disabled_flag : 1;
uint32_t ph_joint_cbcr_sign_flag : 1;
uint32_t ph_sao_luma_enabled_flag : 1;
uint32_t ph_sao_chroma_enabled_flag : 1;
uint32_t ph_deblocking_filter_disabled_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 12;
} bits;
uint32_t value;
} ph_flags;
/** \brief Reserved for future use, must be zero */
uint32_t reserved32b04;
union {
struct {
/** \brief Flag to indicate if current picture is an intra picture.
* Takes value 1 when all slices of current picture are intra slices.
* Takes value 0 when some slices of current picture may not be
* intra slices.
*/
uint32_t IntraPicFlag : 1; // [0..1]
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 31;
} fields;
uint32_t value;
} PicMiscFlags;
/** \brief Reserved bytes for future use, must be zero */
uint32_t reserved32b[VA_PADDING_HIGH + 1];
} VAPictureParameterBufferVVC;
/**
* \brief VVC Slice Parameter Buffer Structure
*
* VASliceParameterBufferVVC structure should be accompanied by a
* slice data buffer, which holds the whole packed slice NAL unit bit stream
* with emulation prevention bytes not removed.
*
* This structure conveys parameters related to slice header and should
* be sent once per slice.
*/
typedef struct _VASliceParameterBufferVVC {
/** @name Codec-independent Slice Parameter Buffer base. */
/**@{*/
/** \brief Number of bytes in the slice data buffer for this slice
* counting from and including NAL unit header.
*/
uint32_t slice_data_size;
/** \brief The offset to the NAL unit header for this slice */
uint32_t slice_data_offset;
/** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
uint32_t slice_data_flag;
/**
* \brief Byte offset from NAL unit header to the beginning of slice_data().
*
* This byte offset is relative to and includes the NAL unit header
* and represents the number of bytes parsed in the slice_header()
* after the removal of any emulation prevention bytes in
* there. However, the slice data buffer passed to the hardware is
* the original bitstream, thus including any emulation prevention
* bytes.
*/
uint32_t slice_data_byte_offset;
/** \brief index into ReferenceFrames[]
* RefPicList[][] corresponds to VVC spec variable with the same name.
* Value range [0..14, 0xFF], where 0xFF indicates invalid entry.
*/
uint8_t RefPicList[2][15];
/**
* \brief the subpicture ID of the subpicture that contains the slice.
* The value of the variable CurrSubpicIdx
* is derived to be such that SubpicIdVal[CurrSubpicIdx] is equal
* to sh_subpic_id. CurrSubpicIdx is the index of array VASubPicArrayBufferVVC.SubPicSet[].
* And it is the spec variable with the same name.
*/
uint16_t sh_subpic_id;
/* parameters below are VVC syntax or spec variables. */
uint16_t sh_slice_address;
uint16_t sh_num_tiles_in_slice_minus1;
uint8_t sh_slice_type;
uint8_t sh_num_alf_aps_ids_luma;
uint8_t sh_alf_aps_id_luma[7];
uint8_t sh_alf_aps_id_chroma;
uint8_t sh_alf_cc_cb_aps_id;
uint8_t sh_alf_cc_cr_aps_id;
/**
* \brief NumRefIdxActive[i] - 1 specifies the maximum reference index
* for RPL i that may be used to decode the slice. When NumRefIdxActive[i]
* is equal to 0, no reference index for RPL i is used to decode the slice.
* NumRefIdxActive[] corresponds to VVC spec variable with the same name.
* It is derived according to formula (138) in VVC spec section 7.4.8.
*/
uint8_t NumRefIdxActive[2];
uint8_t sh_collocated_ref_idx;
/**
* \brief initial value of the QpY quantization parameter for the slice.
* SliceQpY corresponds to VVC spec variable with the same name.
* It is derived according to formula (86) in VVC spec section 7.4.3.8
* and formula (139) in VVC Spec section 7.4.8.
*/
int8_t SliceQpY;
/* parameters below are VVC syntax. */
int8_t sh_cb_qp_offset;
int8_t sh_cr_qp_offset;
int8_t sh_joint_cbcr_qp_offset;
int8_t sh_luma_beta_offset_div2;
int8_t sh_luma_tc_offset_div2;
int8_t sh_cb_beta_offset_div2;
int8_t sh_cb_tc_offset_div2;
int8_t sh_cr_beta_offset_div2;
int8_t sh_cr_tc_offset_div2;
/** \brief Reserved bytes for future use, must be zero */
uint8_t reserved8b[VA_PADDING_LOW - 1];
uint32_t reserved32b;
// weighted prediction info
VAWeightedPredInfo WPInfo;
union {
struct {
/* flags below are VVC syntax. */
uint32_t sh_alf_enabled_flag : 1;
uint32_t sh_alf_cb_enabled_flag : 1;
uint32_t sh_alf_cr_enabled_flag : 1;
uint32_t sh_alf_cc_cb_enabled_flag : 1;
uint32_t sh_alf_cc_cr_enabled_flag : 1;
uint32_t sh_lmcs_used_flag : 1;
uint32_t sh_explicit_scaling_list_used_flag : 1;
uint32_t sh_cabac_init_flag : 1;
uint32_t sh_collocated_from_l0_flag : 1;
uint32_t sh_cu_chroma_qp_offset_enabled_flag : 1;
uint32_t sh_sao_luma_used_flag : 1;
uint32_t sh_sao_chroma_used_flag : 1;
uint32_t sh_deblocking_filter_disabled_flag : 1;
uint32_t sh_dep_quant_used_flag : 1;
uint32_t sh_sign_data_hiding_used_flag : 1;
uint32_t sh_ts_residual_coding_disabled_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 16;
} bits;
uint32_t value;
} sh_flags;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VASliceParameterBufferVVC;
/**
* \brief VVC Scaling List Data Structure
*
* Host decoder sends in an array of VVC Scaling Lists through one or multiple
* buffers which may contain 1 to 8 VAScalingListVVC data structures in total.
* Each buffer contains an integer number of VAScalingListVVC data structures
* with no gap in between.
* Driver may store the data internally. Host decoder may choose not to
* send the same scaling list data for each frame. When a VAScalingListVVC
* structure carries a same value of aps_adaptation_parameter_set_id
* as a previously stored structure, driver should override the old structure
* with values in the new structure.
* VAIQMatrixBufferType is used to send this buffer.
*/
typedef struct _VAScalingListVVC {
/** \brief VVC syntax to specify the identifier for the APS.*/
uint8_t aps_adaptation_parameter_set_id;
/** \brief Reserved for future use, must be zero */
uint8_t reserved8b;
/**
* \brief Specifies the spec variable ScalingMatrixDCRec[id−14],
* where id = [14..27].
*/
uint8_t ScalingMatrixDCRec[14];
/**
* \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
* where id = [0..1]. Check section 7.4.3.20 for derivation process.
*/
uint8_t ScalingMatrixRec2x2[2][2][2];
/**
* \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
* where id = [2..7]. Check section 7.4.3.20 for derivation process.
*/
uint8_t ScalingMatrixRec4x4[6][4][4];
/**
* \brief Specifies the spec variable ScalingMatrixRec[id][x][y],
* where id = [8..27]. Check section 7.4.3.20 for derivation process.
*/
uint8_t ScalingMatrixRec8x8[20][8][8];
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAScalingListVVC;
/**
* \brief VVC Adaptive Loop Filter Data Structure
*
* Host decoder sends in an array of VVC ALF sets through one or multiple
* buffers which may contain 1 to 8 VAAlfDataVVC data structures in total.
* Each buffer contains an integer number of VAAlfDataVVC data structures
* with no gap in between.
* Driver may store the data internally. Host decoder may choose not to
* send the same ALF data for each frame. When a VAAlfDataVVC structure
* carries a same value of aps_adaptation_parameter_set_id as a previously
* stored structure, driver should override the old structure
* with values in the new structure.
* VAAlfBufferType is used to send this buffer.
*/
typedef struct _VAAlfDataVVC {
/**
* \brief VVC Adaptive Loop Filter parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint8_t aps_adaptation_parameter_set_id;
uint8_t alf_luma_num_filters_signalled_minus1;
uint8_t alf_luma_coeff_delta_idx[25];
int8_t filtCoeff[25][12];
uint8_t alf_luma_clip_idx[25][12];
uint8_t alf_chroma_num_alt_filters_minus1;
int8_t AlfCoeffC[8][6];
uint8_t alf_chroma_clip_idx[8][6];
uint8_t alf_cc_cb_filters_signalled_minus1;
int8_t CcAlfApsCoeffCb[4][7];
uint8_t alf_cc_cr_filters_signalled_minus1;
int8_t CcAlfApsCoeffCr[4][7];
/** \brief Reserved bytes for future use, must be zero */
uint16_t reserved16b;
uint32_t reserved32b;
union {
struct {
uint32_t alf_luma_filter_signal_flag : 1;
uint32_t alf_chroma_filter_signal_flag : 1;
uint32_t alf_cc_cb_filter_signal_flag : 1;
uint32_t alf_cc_cr_filter_signal_flag : 1;
uint32_t alf_luma_clip_flag : 1;
uint32_t alf_chroma_clip_flag : 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 26;
} bits;
uint32_t value;
} alf_flags;
/** \brief Reserved for future use, must be zero */
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VAAlfDataVVC;
/**
* \brief VVC Luma Mapping with Chroma Scaling Data Structure
*
* Host decoder sends in an array of VVC LMCS sets through one or multiple
* buffers which may contain 1 to 4 VALmcsDataVVC data structures in total.
* Each buffer contains an integer number of VALmcsDataVVC data structures
* with no gap in between.
* Driver may store the data internally. Host decoder may choose not to
* send the same LMCS data for each frame. When a VALmcsDataVVC structure
* carries a same value of aps_adaptation_parameter_set_id as a previously
* stored structure, driver should override the old structure
* with values in the new structure.
* VALmcsBufferType is used to send this buffer.
*/
typedef struct _VALmcsDataVVC {
/**
* \brief VVC Luma Mapping with Chroma Scaling parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint8_t aps_adaptation_parameter_set_id;
uint8_t lmcs_min_bin_idx;
uint8_t lmcs_delta_max_bin_idx;
int16_t lmcsDeltaCW[16];
int8_t lmcsDeltaCrs;
/** \brief Reserved for future use, must be zero */
uint8_t reserved8b[VA_PADDING_LOW - 1];
uint32_t va_reserved[VA_PADDING_MEDIUM];
} VALmcsDataVVC;
/**
* \brief VVC SubPicture Data Structure
*
* Host decoder sends in an array of VVC SubPic sets through one or
* multiple buffers which contain sps_num_subpics_minus1 + 1
* VASubPicVVC data structures in total. Each buffer contains
* an integer number of VASubPicVVC data structures with no gap in between.
* The Subpic sets are sent sequentially in the order of indices
* from 0 to sps_num_subpics_minus1 according to the bitstream.
* VASubPicBufferType is used to send this buffer.
*/
typedef struct _VASubPicVVC {
/**
* \brief VVC SubPicture layout parameters.
* All the parameters except reserved bytes are VVC syntax or spec variables.
*/
uint16_t sps_subpic_ctu_top_left_x;
uint16_t sps_subpic_ctu_top_left_y;
uint16_t sps_subpic_width_minus1;
uint16_t sps_subpic_height_minus1;
/** \brief the subpicture ID of the i-th subpicture.
* It is same variable as in VVC spec.
*/
uint16_t SubpicIdVal;
union {
struct {
uint16_t sps_subpic_treated_as_pic_flag : 1;
uint16_t sps_loop_filter_across_subpic_enabled_flag : 1;
/** \brief Reserved for future use, must be zero */
uint16_t reserved : 14;
} bits;
uint16_t value;
} subpic_flags;
/** \brief Reserved for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASubPicVVC;
/**
* \brief data buffer of tile widths and heights.
* VATileBufferType is used to send this buffer.
*
* Host decoder sends in number of pps_num_exp_tile_columns_minus1 + 1
* tile column widths of pps_tile_column_width_minus1[i], followed by
* number of pps_num_exp_tile_rows_minus1 + 1 of tile row heights of
* pps_tile_row_height_minus1[i], through one or multiple buffers.
* Each tile width or height is formatted as
uint16_t tile_dimension;
* Each buffer contains an integer number of tile_dimension with
* no gap in between.
* The buffers with type VATileBufferType should be submitted for each
* picture. And driver will derive the tile structure from it.
* When pps_num_exp_tile_columns_minus1 + pps_num_exp_tile_rows_minus1 equals 0,
* this buffer is still submitted by app to driver.
*/
/**
* \brief VVC SliceStruct Data Structure
*
* Host decoder sends in an array of SliceStruct sets through one or multiple
* buffers. These SliceStruct sets contain only the "explicit" slices parsed
* from PPS header.
* Each SliceStruct set is described by VASliceStructVVC data structure.
* Each buffer contains an integer number of VASliceStructVVC data structures,
* which are laid out sequentially in the order of
* ascending slice indices according to the spec with no gap in between.
*
* When pps_rect_slice_flag equals 0 or there are no explicit slices,
* this buffer is not submitted by app to driver. Otherwise, for each picture,
* this buffer should be submitted.
*
* Note: When pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1
* equals 0, if the sum of pps_exp_slice_height_in_ctus_minus1 + 1 of all those
* slices with same SliceTopLeftTileIdx value is less than the height of tile
* SliceTopLeftTileIdx in unit of CTUs, driver should derive the rest slices in
* that tile according to equation (21) in spec section 6.5.1. And VASliceStructVVC
* for these (derived) slices are not passed in to LibVA by App.
*
* App should populate the data entries regardless of values of
* pps_single_slice_per_subpic_flag or sps_subpic_info_present_flag.
*
* VASliceStructBufferType is used to send this buffer.
*/
typedef struct _VASliceStructVVC {
/** \brief the tile index of which the starting CTU (top-left) of
* the slice belongs to. The tile index is in raster scan order.
* Same syntax variable as in VVC spec.
*/
uint16_t SliceTopLeftTileIdx;
/* plus 1 specifies the width of the rectangular slice in units
* of tile columns.
*/
uint16_t pps_slice_width_in_tiles_minus1;
/* plus 1 specifies the height of the rectangular slice in units
* of tile rows. If the slice does not cover the whole tile,
* pps_slice_height_in_tiles_minus1 shall be 0.
*/
uint16_t pps_slice_height_in_tiles_minus1;
/* plus 1 specifies the height of the rectangular slice in units
* of CTU rows.
* If pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1 > 0,
* set this value to 0.
* If pps_slice_width_in_tiles_minus1 + pps_slice_height_in_tiles_minus1 == 0,
* and if there is only one slice in tile, set this value to the number of
* CTU rows of the tile minus 1, otherwise, set the value equal to
* corresponding pps_exp_slice_height_in_ctus_minus1 from bitstream.
*/
uint16_t pps_exp_slice_height_in_ctus_minus1;
/** \brief Reserved for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VASliceStructVVC;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DEC_VVC_H */

View File

@ -0,0 +1,73 @@
/*
* Copyright © 2007,2008 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Kristian Høgsberg (krh@redhat.com)
*/
#ifndef _VA_DRI2_H_
#define _VA_DRI2_H_
#include <X11/Xproto.h>
#include <X11/extensions/Xfixes.h>
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
typedef struct {
unsigned int attachment;
unsigned int name;
unsigned int pitch;
unsigned int cpp;
unsigned int flags;
} VA_DRI2Buffer;
extern Bool
VA_DRI2QueryExtension(Display *display, int *eventBase, int *errorBase);
extern Bool
VA_DRI2QueryVersion(Display *display, int *major, int *minor);
extern Bool
VA_DRI2Connect(Display *display, XID window,
char **driverName, char **deviceName);
extern Bool
VA_DRI2Authenticate(Display *display, XID window, drm_magic_t magic);
extern void
VA_DRI2CreateDrawable(Display *display, XID drawable);
extern void
VA_DRI2DestroyDrawable(Display *display, XID handle);
extern VA_DRI2Buffer *
VA_DRI2GetBuffers(Display *dpy, XID drawable,
int *width, int *height,
unsigned int *attachments, int count,
int *outCount);
extern void
VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
CARD32 dest, CARD32 src);
extern void
VA_DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
CARD64 remainder, CARD64 *count);
#endif

View File

@ -0,0 +1,46 @@
/*
* Copyright © 2022 Collabora Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Soft-
* ware"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, provided that the above copyright
* notice(s) and this permission notice appear in all copies of the Soft-
* ware and that both the above copyright notice(s) and this permission
* notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
* MANCE OF THIS SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder shall
* not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization of
* the copyright holder.
*
* Authors:
* Emil Velikov (emil.velikov@collabora.com)
*/
#ifndef _VA_DRI3_H_
#define _VA_DRI3_H_
#include "sysdeps.h"
#include "va_backend.h"
DLL_HIDDEN
VAStatus va_DRI3_GetDriverNames(
VADisplayContextP pDisplayContext,
char **drivers,
unsigned *num_drivers
);
#endif

View File

@ -0,0 +1,85 @@
/*
* Copyright (c) 2012 Intel Corporation. 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 PRECISION INSIGHT 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.
*/
#ifndef _VA_DRICOMMON_H_
#define _VA_DRICOMMON_H_
#include <X11/Xlib.h>
#include <xf86drm.h>
#include <drm.h>
#include <va/va_backend.h>
#include <va/va_drmcommon.h>
enum {
/* Compatibility. Do not use for newly-written code. */
VA_NONE = VA_DRM_AUTH_NONE,
VA_DRI1 = VA_DRM_AUTH_DRI1,
VA_DRI2 = VA_DRM_AUTH_DRI2,
VA_DUMMY = VA_DRM_AUTH_CUSTOM
};
union dri_buffer {
struct {
unsigned int attachment;
unsigned int name;
unsigned int pitch;
unsigned int cpp;
unsigned int flags;
/** \brief Reserved bytes for future use, must be zero */
unsigned int va_reserved[8];
} dri2;
};
struct dri_drawable {
XID x_drawable;
int is_window;
int x;
int y;
unsigned int width;
unsigned int height;
struct dri_drawable *next;
};
#define DRAWABLE_HASH_SZ 32
struct dri_state {
struct drm_state base;
struct dri_drawable *drawable_hash[DRAWABLE_HASH_SZ];
struct dri_drawable *(*createDrawable)(VADriverContextP ctx, XID x_drawable);
void (*destroyDrawable)(VADriverContextP ctx, struct dri_drawable *dri_drawable);
void (*swapBuffer)(VADriverContextP ctx, struct dri_drawable *dri_drawable);
union dri_buffer *(*getRenderingBuffer)(VADriverContextP ctx, struct dri_drawable *dri_drawable);
void (*close)(VADriverContextP ctx);
/** \brief Reserved bytes for future use, must be zero */
unsigned long va_reserved[16];
};
Bool va_isDRI2Connected(VADriverContextP ctx, char **driver_name);
void va_dri_free_drawable(VADriverContextP ctx, struct dri_drawable* dri_drawable);
void va_dri_free_drawable_hashtable(VADriverContextP ctx);
struct dri_drawable *va_dri_get_drawable(VADriverContextP ctx, XID drawable);
void va_dri_swap_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable);
union dri_buffer *va_dri_get_rendering_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable);
#endif /* _VA_DRICOMMON_H_ */

View File

@ -0,0 +1,61 @@
/*
* va_drm.h - Raw DRM API
*
* Copyright (c) 2012 Intel Corporation. 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 INTEL 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.
*/
#ifndef VA_DRM_H
#define VA_DRM_H
#include <va/va.h>
/**
* \file va_drm.h
* \brief The raw DRM API
*
* This file contains the \ref api_drm "Raw DRM API".
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Returns a VA display derived from the specified DRM connection.
*
* This function returns a (possibly cached) VA display from the
* specified DRM connection @fd.
*
* @param[in] fd the DRM connection descriptor
* @return the VA display
*/
VADisplay
vaGetDisplayDRM(int fd);
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_DRM_H */

View File

@ -0,0 +1,234 @@
/*
* va_drmcommon.h - Common utilities for DRM-based drivers
*
* Copyright (c) 2012 Intel Corporation. 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 INTEL 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.
*/
#ifndef VA_DRM_COMMON_H
#define VA_DRM_COMMON_H
#include <stdint.h>
#include <va/va.h>
/** \brief DRM authentication type. */
enum {
/** \brief Disconnected. */
VA_DRM_AUTH_NONE = 0,
/**
* \brief Connected. Authenticated with DRI1 protocol.
*
* @deprecated
* This is a deprecated authentication type. All DRI-based drivers have
* been migrated to use the DRI2 protocol. Newly written drivers shall
* use DRI2 protocol only, or a custom authentication means. e.g. opt
* for authenticating on the VA driver side, instead of libva side.
*/
VA_DRM_AUTH_DRI1 = 1,
/**
* \brief Connected. Authenticated with DRI2 protocol.
*
* This is only useful to VA/X11 drivers. The libva-x11 library provides
* a helper function VA_DRI2Authenticate() for authenticating the
* connection. However, DRI2 conformant drivers don't need to call that
* function since authentication happens on the libva side, implicitly.
*/
VA_DRM_AUTH_DRI2 = 2,
/**
* \brief Connected. Authenticated with some alternate raw protocol.
*
* This authentication mode is mainly used in non-VA/X11 drivers.
* Authentication happens through some alternative method, at the
* discretion of the VA driver implementation.
*/
VA_DRM_AUTH_CUSTOM = 3
};
/** \brief Base DRM state. */
struct drm_state {
/** \brief DRM connection descriptor. */
int fd;
/** \brief DRM authentication type. */
int auth_type;
/** \brief Reserved bytes for future use, must be zero */
int va_reserved[8];
};
/** \brief Kernel DRM buffer memory type. */
#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000
/** \brief DRM PRIME memory type (old version)
*
* This supports only single objects with restricted memory layout.
* Used with VASurfaceAttribExternalBuffers.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
/** \brief DRM PRIME memory type
*
* Used with VADRMPRIMESurfaceDescriptor.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000
/** \brief DRM PRIME3 memory type
*
* Used with VADRMPRIME3SurfaceDescriptor.
*/
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 0x08000000
/**
* \brief External buffer descriptor for a DRM PRIME surface.
*
* For export, call vaExportSurfaceHandle() with mem_type set to
* VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an
* instance of this structure to fill.
* If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each
* layer will contain exactly one plane. For example, an NV12
* surface will be exported as two layers, one of DRM_FORMAT_R8 and
* one of DRM_FORMAT_GR88.
* If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export,
* there will be exactly one layer.
*
* For import, call vaCreateSurfaces() with the MemoryType attribute
* set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the
* ExternalBufferDescriptor attribute set to point to an array of
* num_surfaces instances of this structure.
* The number of planes which need to be provided for a given layer
* is dependent on both the format and the format modifier used for
* the objects containing it. For example, the format DRM_FORMAT_RGBA
* normally requires one plane, but with the format modifier
* I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first
* being the main data plane and the second containing the color
* control surface.
* Note that a given driver may only support a subset of possible
* representations of a particular format. For example, it may only
* support NV12 surfaces when they are contained within a single DRM
* object, and therefore fail to create such surfaces if the two
* planes are in different DRM objects.
* Note that backend driver will retrieve the resource represent by fd,
* and a valid surface ID is generated. Backend driver will not close
* the file descriptor. Application should handle the release of the fd.
* releasing the fd will not impact the existence of the surface.
*/
typedef struct _VADRMPRIMESurfaceDescriptor {
/** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
uint32_t fourcc;
/** Width of the surface in pixels. */
uint32_t width;
/** Height of the surface in pixels. */
uint32_t height;
/** Number of distinct DRM objects making up the surface. */
uint32_t num_objects;
/** Description of each object. */
struct {
/** DRM PRIME file descriptor for this object. */
int fd;
/** Total size of this object (may include regions which are
* not part of the surface). */
uint32_t size;
/** Format modifier applied to this object. */
uint64_t drm_format_modifier;
} objects[4];
/** Number of layers making up the surface. */
uint32_t num_layers;
/** Description of each layer in the surface. */
struct {
/** DRM format fourcc of this layer (DRM_FOURCC_*). */
uint32_t drm_format;
/** Number of planes in this layer. */
uint32_t num_planes;
/** Index in the objects array of the object containing each
* plane. */
uint32_t object_index[4];
/** Offset within the object of each plane. */
uint32_t offset[4];
/** Pitch of each plane. */
uint32_t pitch[4];
} layers[4];
} VADRMPRIMESurfaceDescriptor;
/**
* \brief External buffer descriptor for a DRM PRIME surface with flags
*
* This structure is an extention for VADRMPRIMESurfaceDescriptor,
* it has the same behavior as if used with VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2.
*
* The field "flags" is added, see "Surface external buffer descriptor flags".
* To use this structure, use VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3 instead.
*/
typedef struct _VADRMPRIME3SurfaceDescriptor {
/** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
uint32_t fourcc;
/** Width of the surface in pixels. */
uint32_t width;
/** Height of the surface in pixels. */
uint32_t height;
/** Number of distinct DRM objects making up the surface. */
uint32_t num_objects;
/** Description of each object. */
struct {
/** DRM PRIME file descriptor for this object. */
int fd;
/** Total size of this object (may include regions which are
* not part of the surface). */
uint32_t size;
/** Format modifier applied to this object. */
uint64_t drm_format_modifier;
} objects[4];
/** Number of layers making up the surface. */
uint32_t num_layers;
/** Description of each layer in the surface. */
struct {
/** DRM format fourcc of this layer (DRM_FOURCC_*). */
uint32_t drm_format;
/** Number of planes in this layer. */
uint32_t num_planes;
/** Index in the objects array of the object containing each
* plane. */
uint32_t object_index[4];
/** Offset within the object of each plane. */
uint32_t offset[4];
/** Pitch of each plane. */
uint32_t pitch[4];
} layers[4];
/** \brief flags. See "Surface external buffer descriptor flags". */
uint32_t flags;
/** reserved bytes, must be zero */
uint32_t reserved[VA_PADDING_MEDIUM - 1];
} VADRMPRIME3SurfaceDescriptor;
/**
* \brief List of DRM format modifiers.
*
* To allocate surfaces with one of the modifiers specified in the array, call
* vaCreateSurfaces() with the VASurfaceAttribDRMFormatModifiers attribute set
* to point to an array of num_surfaces instances of this structure. The driver
* will select the optimal modifier in the list.
*
* DRM format modifiers are defined in drm_fourcc.h in the Linux kernel.
*/
typedef struct _VADRMFormatModifierList {
/** Number of modifiers. */
uint32_t num_modifiers;
/** Array of modifiers. */
uint64_t *modifiers;
} VADRMFormatModifierList;
#endif /* VA_DRM_COMMON_H */

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2007 Intel Corporation. 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 PRECISION INSIGHT 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.
*/
#ifndef _VA_EGL_H_
#define _VA_EGL_H_
#warning The APIs / data structures included in this file are deprecated
#endif /* _VA_EGL_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,659 @@
/*
* Copyright (c) 2007-2011 Intel Corporation. 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 INTEL 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.
*/
/**
* \file va_enc_h264.h
* \brief The H.264 encoding API
*
* This file contains the \ref api_enc_h264 "H.264 encoding API".
*/
#ifndef VA_ENC_H264_H
#define VA_ENC_H264_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup api_enc_h264 H.264 encoding API
*
* @{
*/
/**
* @name Picture flags
*
* Those flags flags are meant to signal when a picture marks the end
* of a sequence, a stream, or even both at once.
*
* @{
*/
/**
* \brief Marks the last picture in the sequence.
*
* i.e. the driver appends \c end_of_seq() NAL unit to the encoded frame.
*/
#define H264_LAST_PICTURE_EOSEQ 0x01
/**
* \brief Marks the last picture in the stream.
*
* i.e. the driver appends \c end_of_stream() NAL unit to the encoded frame.
*/
#define H264_LAST_PICTURE_EOSTREAM 0x02
/**@}*/
/**
* \brief Packed header types specific to H.264 encoding.
*
* Types of packed headers generally used for H.264 encoding. Each
* associated packed header data buffer shall contain the start code
* prefix 0x000001 followed by the complete NAL unit, thus also
* including the \c nal_unit_type.
*
* Note: the start code prefix can contain an arbitrary number of leading
* zeros. The driver will skip them for emulation prevention bytes insertion,
* if necessary.
*/
typedef enum {
/**
* \brief Packed Sequence Parameter Set (SPS).
*
* The corresponding packed header data buffer shall contain the
* complete seq_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 7.
*/
VAEncPackedHeaderH264_SPS = VAEncPackedHeaderSequence,
/**
* \brief Packed Picture Parameter Set (PPS).
*
* The corresponding packed header data buffer shall contain the
* complete pic_parameter_set_rbsp() syntax element.
*
* Note: packed \c nal_unit_type shall be equal to 8.
*/
VAEncPackedHeaderH264_PPS = VAEncPackedHeaderPicture,
/**
* \brief Packed slice header.
*
* The corresponding packed header data buffer shall contain the
* \c slice_header() syntax element only, along with any start
* code prefix and NAL unit type preceeding it. i.e. this means
* that the buffer does not contain any of the \c slice_data() or
* the \c rbsp_slice_trailing_bits().
*
* Note: packed \c nal_unit_type shall be equal to 1 (non-IDR
* picture), or 5 (IDR picture).
*/
VAEncPackedHeaderH264_Slice = VAEncPackedHeaderSlice,
/**
* \brief Packed Supplemental Enhancement Information (SEI).
*
* The corresponding packed header data buffer shall contain the
* complete sei_rbsp() syntax element, thus including several
* sei_message() elements if necessary.
*
* Note: packed \c nal_unit_type shall be equal to 6.
*
* @deprecated
* This is a deprecated packed header flag, All applications can use
* \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed
* SEI header data buffer to the driver
*/
VAEncPackedHeaderH264_SEI va_deprecated_enum = (0x80000000 | 1),
} VAEncPackedHeaderTypeH264;
/**
* \brief Sequence parameter for H.264 encoding in baseline, main & high
* profiles.
*
* This structure holds information for \c seq_parameter_set_data() as
* defined by the H.264 specification.
*
* If packed sequence headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If \c seq_scaling_matrix_present_flag is set to \c 1, then a
* #VAIQMatrixBufferH264 buffer shall also be provided within the same
* \c vaRenderPicture() call as this sequence parameter buffer.
*/
typedef struct _VAEncSequenceParameterBufferH264 {
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t seq_parameter_set_id;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t level_idc;
/** \brief Period between I frames. */
uint32_t intra_period;
/** \brief Period between IDR frames. */
uint32_t intra_idr_period;
/** \brief Period between I/P frames. */
uint32_t ip_period;
/**
* \brief Initial bitrate set for this sequence in CBR or VBR modes.
*
* This field represents the initial bitrate value for this
* sequence if CBR or VBR mode is used, i.e. if the encoder
* pipeline was created with a #VAConfigAttribRateControl
* attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
*
* The bitrate can be modified later on through
* #VAEncMiscParameterRateControl buffers.
*/
uint32_t bits_per_second;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t max_num_ref_frames;
/** \brief Picture width in macroblocks. */
uint16_t picture_width_in_mbs;
/** \brief Picture height in macroblocks. */
uint16_t picture_height_in_mbs;
union {
struct {
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t chroma_format_idc : 2;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_mbs_only_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t mb_adaptive_frame_field_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t seq_scaling_matrix_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t direct_8x8_inference_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t log2_max_frame_num_minus4 : 4;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t pic_order_cnt_type : 2;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t log2_max_pic_order_cnt_lsb_minus4 : 4;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t delta_pic_order_always_zero_flag : 1;
} bits;
uint32_t value;
} seq_fields;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t bit_depth_luma_minus8;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t bit_depth_chroma_minus8;
/** if pic_order_cnt_type == 1 */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t num_ref_frames_in_pic_order_cnt_cycle;
/** \brief Same as the H.264 bitstream syntax element. */
int32_t offset_for_non_ref_pic;
/** \brief Same as the H.264 bitstream syntax element. */
int32_t offset_for_top_to_bottom_field;
/** \brief Same as the H.264 bitstream syntax element. */
int32_t offset_for_ref_frame[256];
/**@}*/
/** @name Cropping (optional) */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t frame_cropping_flag;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_left_offset;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_right_offset;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_top_offset;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t frame_crop_bottom_offset;
/**@}*/
/** @name VUI parameters (optional) */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t vui_parameters_present_flag;
union {
struct {
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t aspect_ratio_info_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t timing_info_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t bitstream_restriction_flag : 1;
/** \brief Range: 0 to 16, inclusive. */
uint32_t log2_max_mv_length_horizontal : 5;
/** \brief Range: 0 to 16, inclusive. */
uint32_t log2_max_mv_length_vertical : 5;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t fixed_frame_rate_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t low_delay_hrd_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t motion_vectors_over_pic_boundaries_flag: 1;
/** \brief Reserved for future use, must be zero */
uint32_t reserved : 16;
} bits;
uint32_t value;
} vui_fields;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t aspect_ratio_idc;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t sar_width;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t sar_height;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t num_units_in_tick;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t time_scale;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
/**@}*/
} VAEncSequenceParameterBufferH264;
/**
* \brief Picture parameter for H.264 encoding in baseline, main & high
* profiles.
*
* This structure holds information for \c pic_parameter_set_rbsp() as
* defined by the H.264 specification.
*
* If packed picture headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If \c pic_scaling_matrix_present_flag is set to \c 1, then a
* #VAIQMatrixBufferH264 buffer shall also be provided within the same
* \c vaRenderPicture() call as this picture parameter buffer.
*/
typedef struct _VAEncPictureParameterBufferH264 {
/**
* \brief Information about the picture to be encoded.
*
* See #VAPictureH264 for further description of each field.
* Note that CurrPic.picture_id represents the reconstructed
* (decoded) picture. User provides a scratch VA surface ID here.
*/
VAPictureH264 CurrPic;
/**
* \brief Decoded Picture Buffer (DPB).
*
* This array represents the list of reconstructed (decoded)
* frames used as reference. It is important to keep track of
* reconstructed frames so that they can be used later on as
* reference for P or B-frames encoding.
*/
VAPictureH264 ReferenceFrames[16];
/**
* \brief Output encoded bitstream.
*
* \ref coded_buf has type #VAEncCodedBufferType. It should be
* large enough to hold the compressed NAL slice and possibly SPS
* and PPS NAL units.
*/
VABufferID coded_buf;
/** \brief The picture parameter set referred to in the slice header. */
uint8_t pic_parameter_set_id;
/** \brief The active sequence parameter set. Range: 0 to 31, inclusive. */
uint8_t seq_parameter_set_id;
/**
* \brief OR'd flags describing whether the picture is the last one or not.
*
* This fields holds 0 if the picture to be encoded is not the last
* one in the stream or sequence. Otherwise, it is a combination of
* \ref H264_LAST_PICTURE_EOSEQ or \ref H264_LAST_PICTURE_EOSTREAM.
*/
uint8_t last_picture;
/** \brief The picture identifier.
* Range: 0 to \f$2^{log2\_max\_frame\_num\_minus4 + 4} - 1\f$, inclusive.
*/
uint16_t frame_num;
/** \brief \c pic_init_qp_minus26 + 26. */
uint8_t pic_init_qp;
/** \brief Maximum reference index for reference picture list 0.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** \brief Maximum reference index for reference picture list 1.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** \brief Range: -12 to 12, inclusive. */
int8_t chroma_qp_index_offset;
/** \brief Range: -12 to 12, inclusive. */
int8_t second_chroma_qp_index_offset;
union {
struct {
/** \brief Is picture an IDR picture? */
uint32_t idr_pic_flag : 1;
/** \brief Is picture a reference picture? */
uint32_t reference_pic_flag : 2;
/** \brief Selects CAVLC (0) or CABAC (1) entropy coding mode. */
uint32_t entropy_coding_mode_flag : 1;
/** \brief Is weighted prediction applied to P slices? */
uint32_t weighted_pred_flag : 1;
/** \brief Range: 0 to 2, inclusive. */
uint32_t weighted_bipred_idc : 2;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t constrained_intra_pred_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t transform_8x8_mode_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t deblocking_filter_control_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t redundant_pic_cnt_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t pic_order_present_flag : 1;
/** \brief Same as the H.264 bitstream syntax element. */
uint32_t pic_scaling_matrix_present_flag : 1;
} bits;
uint32_t value;
} pic_fields;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncPictureParameterBufferH264;
typedef struct _VAEncQPBufferH264 {
/*
* \brief This structure holds QP per 16x16 macroblock. Buffer size shall be
* sufficient to fit the slice or frame to be encoded depending on if it is a
* slice level or frame level encoding.
*/
uint8_t qp;
} VAEncQPBufferH264;
/**
* \brief Slice parameter for H.264 encoding in baseline, main & high profiles.
*
* This structure holds information for \c
* slice_layer_without_partitioning_rbsp() as defined by the H.264
* specification.
*
* If packed slice headers mode is used, i.e. if the encoding
* pipeline was configured with the #VA_ENC_PACKED_HEADER_SLICE
* flag, then the driver expects two more buffers to be provided to
* the same \c vaRenderPicture() as this buffer:
* - a #VAEncPackedHeaderParameterBuffer with type set to
* VAEncPackedHeaderType::VAEncPackedHeaderSlice ;
* - a #VAEncPackedHeaderDataBuffer which holds the actual packed
* header data.
*
* If per-macroblock encoder configuration is needed, \c macroblock_info
* references a buffer of type #VAEncMacroblockParameterBufferH264. This
* buffer is not passed to vaRenderPicture() and it can be re-used
* without re-allocating the whole buffer.
*/
typedef struct _VAEncSliceParameterBufferH264 {
/** \brief Starting MB address for this slice. */
uint32_t macroblock_address;
/** \brief Number of macroblocks in this slice. */
uint32_t num_macroblocks;
/**
* \brief Per-MB encoder configuration buffer, or \c VA_INVALID_ID.
*
* If per-MB encoder configuration is needed, then \ref macroblock_info
* references a buffer of type #VAEncMacroblockParameterBufferH264
* (\c VAEncMacroblockParameterBufferType). Otherwise, buffer id
* is set to \c VA_INVALID_ID and per-MB configuration is derived
* from this slice parameter.
*
* The \c macroblock_info buffer must hold \ref num_macroblocks
* elements.
*/
VABufferID macroblock_info;
/** \brief Slice type.
* Range: 0..2, 5..7, i.e. no switching slices.
*/
uint8_t slice_type;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t pic_parameter_set_id;
/** \brief Same as the H.264 bitstream syntax element. */
uint16_t idr_pic_id;
/** @name If pic_order_cnt_type == 0 */
/**@{*/
/** \brief The picture order count modulo MaxPicOrderCntLsb. */
uint16_t pic_order_cnt_lsb;
/** \brief Valid if \c pic_order_present_flag and this is a bottom field. */
int32_t delta_pic_order_cnt_bottom;
/**@}*/
/** @name If pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag */
/**@{*/
/** \brief [0]: top, [1]: bottom. */
int32_t delta_pic_order_cnt[2];
/**@}*/
/** @name If slice_type == B */
/**@{*/
uint8_t direct_spatial_mv_pred_flag;
/**@}*/
/** @name If slice_type == P */
/**@{*/
/** \brief Specifies if
* \ref _VAEncPictureParameterBufferH264::num_ref_idx_l0_active_minus1 or
* \ref _VAEncPictureParameterBufferH264::num_ref_idx_l1_active_minus1 are
* overriden by the values for this slice.
*/
uint8_t num_ref_idx_active_override_flag;
/** \brief Maximum reference index for reference picture list 0.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l0_active_minus1;
/** \brief Maximum reference index for reference picture list 1.
* Range: 0 to 31, inclusive.
*/
uint8_t num_ref_idx_l1_active_minus1;
/** \brief Reference picture list 0 (for P slices). */
VAPictureH264 RefPicList0[32];
/** \brief Reference picture list 1 (for B slices). */
VAPictureH264 RefPicList1[32];
/**@}*/
/** @name pred_weight_table() */
/**@{*/
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t luma_log2_weight_denom;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t chroma_log2_weight_denom;
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t luma_weight_l0_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_weight_l0[32];
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_offset_l0[32];
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t chroma_weight_l0_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_weight_l0[32][2];
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_offset_l0[32][2];
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t luma_weight_l1_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_weight_l1[32];
/** \brief Same as the H.264 bitstream syntax element. */
signed short luma_offset_l1[32];
/** \brief Same as the H.264 bitstream syntax element. */
uint8_t chroma_weight_l1_flag;
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_weight_l1[32][2];
/** \brief Same as the H.264 bitstream syntax element. */
signed short chroma_offset_l1[32][2];
/**@}*/
/** \brief Range: 0 to 2, inclusive. */
uint8_t cabac_init_idc;
/** \brief Same as the H.264 bitstream syntax element. */
int8_t slice_qp_delta;
/** @name If deblocking_filter_control_present_flag */
/**@{*/
/** \brief Range: 0 to 2, inclusive. */
uint8_t disable_deblocking_filter_idc;
/** \brief Same as the H.264 bitstream syntax element. */
int8_t slice_alpha_c0_offset_div2;
/** \brief Same as the H.264 bitstream syntax element. */
int8_t slice_beta_offset_div2;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
/**@}*/
} VAEncSliceParameterBufferH264;
/**
* @name Macroblock neighbour availability bits
*
* \anchor api_enc_h264_mb_pred_avail_bits
* Definitions for macroblock neighbour availability bits used in
* intra prediction mode (non MBAFF only).
*
* @{
*/
/** \brief References macroblock in the top-left corner. */
#define VA_MB_PRED_AVAIL_TOP_LEFT (1 << 2)
/** \brief References macroblock above the current macroblock. */
#define VA_MB_PRED_AVAIL_TOP (1 << 4)
/** \brief References macroblock in the top-right corner. */
#define VA_MB_PRED_AVAIL_TOP_RIGHT (1 << 3)
/** \brief References macroblock on the left of the current macroblock. */
#define VA_MB_PRED_AVAIL_LEFT (1 << 6)
/**@}*/
/**
* \brief Macroblock parameter for H.264 encoding in baseline, main & high
* profiles.
*
* This structure holds per-macroblock information. The buffer must be
* allocated with as many elements (macroblocks) as necessary to fit
* the slice to be encoded. Besides, the per-macroblock records must
* be written in a strict raster order and with no gap. i.e. every
* macroblock, regardless of its type, shall have an entry.
*/
typedef struct _VAEncMacroblockParameterBufferH264 {
/**
* \brief Quantization parameter.
*
* Requested quantization parameter. Range: 0 to 51, inclusive.
* If \ref qp is set to 0xff, then the actual value is derived
* from the slice-level value: \c pic_init_qp + \c slice_qp_delta.
*/
uint8_t qp;
union {
/** @name Data for intra macroblock */
/**@{*/
union {
struct {
/**
* \brief Flag specified to override MB neighbour
* availability bits from VME stage.
*
* This flag specifies that macroblock neighbour
* availability bits from the VME stage are overriden
* by the \ref pred_avail_flags hereunder.
*/
uint32_t pred_avail_override_flag : 1;
/**
* \brief Bitwise representation of which macroblocks
* are available for intra prediction.
*
* If the slice is intra-coded, this field represents
* the macroblocks available for intra prediction.
* See \ref api_enc_h264_mb_pred_avail_bits
* "macroblock neighbour availability" bit definitions.
*/
uint32_t pred_avail_flags : 8;
} bits;
uint32_t value;
} intra_fields;
/**@}*/
/** @name Data for inter macroblock */
/**@{*/
union {
struct {
uint32_t reserved;
} bits;
uint32_t value;
} inter_fields;
/**@}*/
} info;
/** \brief Reserved bytes for future use, must be zero */
uint32_t va_reserved[VA_PADDING_LOW];
} VAEncMacroblockParameterBufferH264;
/**
* \brief MB partition modes and 1/2 1/4 motion search configuration
*
* Specifies MB partition modes that are disabled. Specifies Half-pel
* mode and Quarter-pel mode searching
*/
typedef struct _VAEncMiscParameterSubMbPartPelH264 {
uint32_t disable_inter_sub_mb_partition;
union {
struct {
uint32_t disable_16x16_inter_mb_partition : 1;
uint32_t disable_16x8_inter_mb_partition : 1;
uint32_t disable_8x16_inter_mb_partition : 1;
uint32_t disable_8x8_inter_mb_partition : 1;
uint32_t disable_8x4_inter_mb_partition : 1;
uint32_t disable_4x8_inter_mb_partition : 1;
uint32_t disable_4x4_inter_mb_partition : 1;
uint32_t reserved : 1;
} bits;
uint8_t value;
} inter_sub_mb_partition_mask;
/**
* \brief Precison of motion search
* 0:Integer mode searching
* 1:Half-pel mode searching
* 2:Reserved
* 3:Quarter-pel mode searching
*/
uint32_t enable_sub_pel_mode;
uint8_t sub_pel_mode;
uint8_t reserved[3];
} VAEncMiscParameterSubMbPartPelH264;
/**@}*/
#ifdef __cplusplus
}
#endif
#endif /* VA_ENC_H264_H */

Some files were not shown because too many files have changed in this diff Show More