Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lima_screen.h 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #ifndef H_LIMA_SCREEN
  25. #define H_LIMA_SCREEN
  26. #include <stdio.h>
  27. #include "util/slab.h"
  28. #include "util/list.h"
  29. #include "os/os_thread.h"
  30. #include "pipe/p_screen.h"
  31. #define LIMA_DEBUG_GP (1 << 0)
  32. #define LIMA_DEBUG_PP (1 << 1)
  33. #define LIMA_DEBUG_DUMP (1 << 2)
  34. #define LIMA_DEBUG_SHADERDB (1 << 3)
  35. #define LIMA_DEBUG_NO_BO_CACHE (1 << 4)
  36. #define LIMA_DEBUG_BO_CACHE (1 << 5)
  37. extern uint32_t lima_debug;
  38. extern FILE *lima_dump_command_stream;
  39. extern int lima_ctx_num_plb;
  40. extern int lima_plb_max_blk;
  41. extern int lima_ppir_force_spilling;
  42. struct ra_regs;
  43. #define MIN_BO_CACHE_BUCKET (12) /* 2^12 = 4KB */
  44. #define MAX_BO_CACHE_BUCKET (22) /* 2^22 = 4MB */
  45. #define NR_BO_CACHE_BUCKETS (MAX_BO_CACHE_BUCKET - MIN_BO_CACHE_BUCKET + 1)
  46. struct lima_screen {
  47. struct pipe_screen base;
  48. struct renderonly *ro;
  49. int refcnt;
  50. void *winsys_priv;
  51. int fd;
  52. int gpu_type;
  53. int num_pp;
  54. uint32_t plb_max_blk;
  55. /* bo table */
  56. mtx_t bo_table_lock;
  57. mtx_t bo_cache_lock;
  58. struct util_hash_table *bo_handles;
  59. struct util_hash_table *bo_flink_names;
  60. struct list_head bo_cache_buckets[NR_BO_CACHE_BUCKETS];
  61. struct list_head bo_cache_time;
  62. struct slab_parent_pool transfer_pool;
  63. struct ra_regs *pp_ra;
  64. struct lima_bo *pp_buffer;
  65. #define pp_frame_rsw_offset 0x0000
  66. #define pp_clear_program_offset 0x0040
  67. #define pp_reload_program_offset 0x0080
  68. #define pp_shared_index_offset 0x00c0
  69. #define pp_clear_gl_pos_offset 0x0100
  70. #define pp_buffer_size 0x1000
  71. };
  72. static inline struct lima_screen *
  73. lima_screen(struct pipe_screen *pscreen)
  74. {
  75. return (struct lima_screen *)pscreen;
  76. }
  77. struct pipe_screen *
  78. lima_screen_create(int fd, struct renderonly *ro);
  79. #endif