Path: blob/21.2-virgl/src/gallium/drivers/freedreno/freedreno_gmem.h
4570 views
/*1* Copyright (C) 2012 Rob Clark <[email protected]>2*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, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*22* Authors:23* Rob Clark <[email protected]>24*/2526#ifndef FREEDRENO_GMEM_H_27#define FREEDRENO_GMEM_H_2829#include "pipe/p_state.h"30#include "util/list.h"3132#include "freedreno_util.h"3334/* per-pipe configuration for hw binning: */35struct fd_vsc_pipe {36uint8_t x, y, w, h; /* VSC_PIPE[p].CONFIG */37};3839/* per-tile configuration for hw binning: */40struct fd_tile {41uint8_t p; /* index into vsc_pipe[]s */42uint8_t n; /* slot within pipe */43uint16_t bin_w, bin_h;44uint16_t xoff, yoff;45};4647struct fd_gmem_stateobj {48struct pipe_reference reference;49struct fd_screen *screen;50void *key;5152uint32_t cbuf_base[MAX_RENDER_TARGETS];53uint32_t zsbuf_base[2];54uint8_t cbuf_cpp[MAX_RENDER_TARGETS];55uint8_t zsbuf_cpp[2];56uint16_t bin_h, nbins_y;57uint16_t bin_w, nbins_x;58uint16_t minx, miny;59uint16_t width, height;60uint16_t maxpw, maxph; /* maximum pipe width/height */61uint8_t num_vsc_pipes; /* number of pipes for a20x */6263struct fd_vsc_pipe vsc_pipe[32];64struct fd_tile tile[2048];6566struct list_head node;67};6869void __fd_gmem_destroy(struct fd_gmem_stateobj *gmem);7071static inline void72fd_gmem_reference(struct fd_gmem_stateobj **ptr, struct fd_gmem_stateobj *gmem)73{74struct fd_gmem_stateobj *old_gmem = *ptr;7576if (pipe_reference(&(*ptr)->reference, &gmem->reference))77__fd_gmem_destroy(old_gmem);7879*ptr = gmem;80}8182struct fd_gmem_cache {83struct hash_table *ht;84struct list_head lru;85};8687struct fd_batch;8889void fd_gmem_render_tiles(struct fd_batch *batch) assert_dt;90unsigned fd_gmem_estimate_bins_per_pipe(struct fd_batch *batch);91bool fd_gmem_needs_restore(struct fd_batch *batch, const struct fd_tile *tile,92uint32_t buffers);9394struct pipe_screen;95void fd_gmem_screen_init(struct pipe_screen *pscreen);96void fd_gmem_screen_fini(struct pipe_screen *pscreen);9798#endif /* FREEDRENO_GMEM_H_ */99100101