lima_screen.h revision b8e80941
1/* 2 * Copyright (c) 2017-2019 Lima Project 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the 12 * next paragraph) shall be included in all copies or substantial portions 13 * of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 * 23 */ 24 25#ifndef H_LIMA_SCREEN 26#define H_LIMA_SCREEN 27 28#include <stdio.h> 29 30#include "util/slab.h" 31#include "util/list.h" 32#include "os/os_thread.h" 33 34#include "pipe/p_screen.h" 35 36#define LIMA_DEBUG_GP (1 << 0) 37#define LIMA_DEBUG_PP (1 << 1) 38#define LIMA_DEBUG_DUMP (1 << 2) 39 40extern uint32_t lima_debug; 41extern FILE *lima_dump_command_stream; 42extern int lima_ctx_num_plb; 43extern int lima_ppir_force_spilling; 44 45struct ra_regs; 46 47struct lima_screen { 48 struct pipe_screen base; 49 struct renderonly *ro; 50 51 int refcnt; 52 void *winsys_priv; 53 54 int fd; 55 int gpu_type; 56 int num_pp; 57 58 /* bo table */ 59 mtx_t bo_table_lock; 60 struct util_hash_table *bo_handles; 61 struct util_hash_table *bo_flink_names; 62 63 struct slab_parent_pool transfer_pool; 64 65 struct ra_regs *pp_ra; 66 67 struct lima_bo *pp_buffer; 68 #define pp_frame_rsw_offset 0x0000 69 #define pp_clear_program_offset 0x0040 70 #define pp_reload_program_offset 0x0080 71 #define pp_shared_index_offset 0x00c0 72 #define pp_clear_gl_pos_offset 0x0100 73 #define pp_stack_offset 0x1000 74 #define pp_stack_pp_size 0x400 /* per pp, up to 8 pp */ 75 #define pp_stack_offset_end 0x3000 76 #define pp_buffer_size 0x3000 77 78}; 79 80static inline struct lima_screen * 81lima_screen(struct pipe_screen *pscreen) 82{ 83 return (struct lima_screen *)pscreen; 84} 85 86struct pipe_screen * 87lima_screen_create(int fd, struct renderonly *ro); 88 89#endif 90