Path: blob/21.2-virgl/src/gallium/drivers/lima/lima_resource.h
4565 views
/*1* Copyright (c) 2017-2019 Lima Project2*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, sub license,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 the11* next paragraph) shall be included in all copies or substantial portions12* of the 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 NON-INFRINGEMENT. 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 OTHER20* DEALINGS IN THE SOFTWARE.21*22*/2324#ifndef H_LIMA_RESOURCE25#define H_LIMA_RESOURCE2627#include "pipe/p_state.h"2829/* max texture size is 4096x4096 */30#define LIMA_MAX_MIP_LEVELS 1331#define LAYOUT_CONVERT_THRESHOLD 83233struct lima_screen;34struct panfrost_minmax_cache;3536struct lima_resource_level {37uint32_t width;38uint32_t stride;39uint32_t offset;40uint32_t layer_stride;41};4243struct lima_damage_region {44struct pipe_scissor_state *region;45struct pipe_scissor_state bound;46unsigned num_region;47bool aligned;48};4950struct lima_resource {51struct pipe_resource base;5253struct lima_damage_region damage;54struct renderonly_scanout *scanout;55struct lima_bo *bo;56struct panfrost_minmax_cache *index_cache;57bool tiled;58bool modifier_constant;59unsigned full_updates;6061struct lima_resource_level levels[LIMA_MAX_MIP_LEVELS];62};6364struct lima_surface {65struct pipe_surface base;66int tiled_w, tiled_h;67unsigned reload;68};6970struct lima_transfer {71struct pipe_transfer base;72void *staging;73};7475static inline struct lima_resource *76lima_resource(struct pipe_resource *res)77{78return (struct lima_resource *)res;79}8081static inline struct lima_surface *82lima_surface(struct pipe_surface *surf)83{84return (struct lima_surface *)surf;85}8687static inline struct lima_transfer *88lima_transfer(struct pipe_transfer *trans)89{90return (struct lima_transfer *)trans;91}9293void94lima_resource_screen_init(struct lima_screen *screen);9596void97lima_resource_context_init(struct lima_context *ctx);9899#endif100101102