Path: blob/21.2-virgl/src/intel/common/intel_l3_config.h
4547 views
/*1* Copyright (c) 2015 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef INTEL_L3_CONFIG_H24#define INTEL_L3_CONFIG_H2526#include <stdio.h>2728#include "dev/intel_device_info.h"2930/**31* Chunk of L3 cache reserved for some specific purpose.32*/33enum intel_l3_partition {34/** Shared local memory. */35INTEL_L3P_SLM = 0,36/** Unified return buffer. */37INTEL_L3P_URB,38/** Union of DC and RO. */39INTEL_L3P_ALL,40/** Data cluster RW partition. */41INTEL_L3P_DC,42/** Union of IS, C and T. */43INTEL_L3P_RO,44/** Instruction and state cache. */45INTEL_L3P_IS,46/** Constant cache. */47INTEL_L3P_C,48/** Texture cache. */49INTEL_L3P_T,50/** Number of supported L3 partitions. */51INTEL_NUM_L3P52};5354/**55* L3 configuration represented as the number of ways allocated for each56* partition. \sa get_l3_way_size().57*/58struct intel_l3_config {59unsigned n[INTEL_NUM_L3P];60};6162/**63* L3 configuration represented as a vector of weights giving the desired64* relative size of each partition. The scale is arbitrary, only the ratios65* between weights will have an influence on the selection of the closest L366* configuration.67*/68struct intel_l3_weights {69float w[INTEL_NUM_L3P];70};7172float intel_diff_l3_weights(struct intel_l3_weights w0, struct intel_l3_weights w1);7374struct intel_l3_weights75intel_get_default_l3_weights(const struct intel_device_info *devinfo,76bool needs_dc, bool needs_slm);7778struct intel_l3_weights79intel_get_l3_config_weights(const struct intel_l3_config *cfg);8081const struct intel_l3_config *82intel_get_default_l3_config(const struct intel_device_info *devinfo);8384const struct intel_l3_config *85intel_get_l3_config(const struct intel_device_info *devinfo,86struct intel_l3_weights w0);8788unsigned89intel_get_l3_config_urb_size(const struct intel_device_info *devinfo,90const struct intel_l3_config *cfg);9192void intel_dump_l3_config(const struct intel_l3_config *cfg, FILE *fp);9394enum intel_urb_deref_block_size {95INTEL_URB_DEREF_BLOCK_SIZE_32 = 0,96INTEL_URB_DEREF_BLOCK_SIZE_PER_POLY = 1,97INTEL_URB_DEREF_BLOCK_SIZE_8 = 2,98};99100void intel_get_urb_config(const struct intel_device_info *devinfo,101const struct intel_l3_config *l3_cfg,102bool tess_present, bool gs_present,103const unsigned entry_size[4],104unsigned entries[4], unsigned start[4],105enum intel_urb_deref_block_size *deref_block_size,106bool *constrained);107108#endif /* INTEL_L3_CONFIG_H */109110111