1b8e80941Smrg/* 2b8e80941Smrg * Copyright (C) 2019 Alyssa Rosenzweig 3b8e80941Smrg * Copyright (C) 2014-2017 Broadcom 4b8e80941Smrg * 5b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 6b8e80941Smrg * copy of this software and associated documentation files (the "Software"), 7b8e80941Smrg * to deal in the Software without restriction, including without limitation 8b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the 10b8e80941Smrg * Software is furnished to do so, subject to the following conditions: 11b8e80941Smrg * 12b8e80941Smrg * The above copyright notice and this permission notice (including the next 13b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the 14b8e80941Smrg * Software. 15b8e80941Smrg * 16b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21b8e80941Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22b8e80941Smrg * SOFTWARE. 23b8e80941Smrg * 24b8e80941Smrg */ 25b8e80941Smrg 26b8e80941Smrg#ifndef __PAN_JOB_H__ 27b8e80941Smrg#define __PAN_JOB_H__ 28b8e80941Smrg 29b8e80941Smrg/* Used as a hash table key */ 30b8e80941Smrg 31b8e80941Smrgstruct panfrost_job_key { 32b8e80941Smrg struct pipe_surface *cbufs[4]; 33b8e80941Smrg struct pipe_surface *zsbuf; 34b8e80941Smrg}; 35b8e80941Smrg 36b8e80941Smrg#define PAN_REQ_MSAA (1 << 0) 37b8e80941Smrg#define PAN_REQ_DEPTH_WRITE (1 << 1) 38b8e80941Smrg 39b8e80941Smrg/* A panfrost_job corresponds to a bound FBO we're rendering to, 40b8e80941Smrg * collecting over multiple draws. */ 41b8e80941Smrg 42b8e80941Smrgstruct panfrost_job { 43b8e80941Smrg struct panfrost_context *ctx; 44b8e80941Smrg struct panfrost_job_key key; 45b8e80941Smrg 46b8e80941Smrg /* Buffers cleared (PIPE_CLEAR_* bitmask) */ 47b8e80941Smrg unsigned clear; 48b8e80941Smrg 49b8e80941Smrg /* Packed clear values */ 50b8e80941Smrg uint32_t clear_color; 51b8e80941Smrg float clear_depth; 52b8e80941Smrg unsigned clear_stencil; 53b8e80941Smrg 54b8e80941Smrg /* Whether this job uses the corresponding requirement (PAN_REQ_* 55b8e80941Smrg * bitmask) */ 56b8e80941Smrg unsigned requirements; 57b8e80941Smrg 58b8e80941Smrg /* BOs referenced -- will be used for flushing logic */ 59b8e80941Smrg struct set *bos; 60b8e80941Smrg}; 61b8e80941Smrg 62b8e80941Smrg/* Functions for managing the above */ 63b8e80941Smrg 64b8e80941Smrgstruct panfrost_job * 65b8e80941Smrgpanfrost_create_job(struct panfrost_context *ctx); 66b8e80941Smrg 67b8e80941Smrgvoid 68b8e80941Smrgpanfrost_free_job(struct panfrost_context *ctx, struct panfrost_job *job); 69b8e80941Smrg 70b8e80941Smrgstruct panfrost_job * 71b8e80941Smrgpanfrost_get_job(struct panfrost_context *ctx, 72b8e80941Smrg struct pipe_surface **cbufs, struct pipe_surface *zsbuf); 73b8e80941Smrg 74b8e80941Smrgstruct panfrost_job * 75b8e80941Smrgpanfrost_get_job_for_fbo(struct panfrost_context *ctx); 76b8e80941Smrg 77b8e80941Smrgvoid 78b8e80941Smrgpanfrost_job_init(struct panfrost_context *ctx); 79b8e80941Smrg 80b8e80941Smrgvoid 81b8e80941Smrgpanfrost_job_add_bo(struct panfrost_job *job, struct panfrost_bo *bo); 82b8e80941Smrg 83b8e80941Smrgvoid 84b8e80941Smrgpanfrost_flush_jobs_writing_resource(struct panfrost_context *panfrost, 85b8e80941Smrg struct pipe_resource *prsc); 86b8e80941Smrg 87b8e80941Smrgvoid 88b8e80941Smrgpanfrost_flush_jobs_reading_resource(struct panfrost_context *panfrost, 89b8e80941Smrg struct pipe_resource *prsc); 90b8e80941Smrg 91b8e80941Smrg#endif 92