compressor.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright 2012-15 Advanced Micro Devices, Inc.
  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, sublicense,
  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 shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef __DAL_COMPRESSOR_H__
  26. #define __DAL_COMPRESSOR_H__
  27. #include "include/grph_object_id.h"
  28. #include "bios_parser_interface.h"
  29. enum fbc_compress_ratio {
  30. FBC_COMPRESS_RATIO_INVALID = 0,
  31. FBC_COMPRESS_RATIO_1TO1 = 1,
  32. FBC_COMPRESS_RATIO_2TO1 = 2,
  33. FBC_COMPRESS_RATIO_4TO1 = 4,
  34. FBC_COMPRESS_RATIO_8TO1 = 8,
  35. };
  36. union fbc_physical_address {
  37. struct {
  38. uint32_t low_part;
  39. int32_t high_part;
  40. } addr;
  41. uint64_t quad_part;
  42. };
  43. struct compr_addr_and_pitch_params {
  44. /* enum controller_id controller_id; */
  45. uint32_t inst;
  46. uint32_t source_view_width;
  47. uint32_t source_view_height;
  48. };
  49. enum fbc_hw_max_resolution_supported {
  50. FBC_MAX_X = 3840,
  51. FBC_MAX_Y = 2400,
  52. FBC_MAX_X_SG = 1920,
  53. FBC_MAX_Y_SG = 1080,
  54. };
  55. struct compressor;
  56. struct compressor_funcs {
  57. void (*power_up_fbc)(struct compressor *cp);
  58. void (*enable_fbc)(struct compressor *cp,
  59. struct compr_addr_and_pitch_params *params);
  60. void (*disable_fbc)(struct compressor *cp);
  61. void (*set_fbc_invalidation_triggers)(struct compressor *cp,
  62. uint32_t fbc_trigger);
  63. void (*surface_address_and_pitch)(
  64. struct compressor *cp,
  65. struct compr_addr_and_pitch_params *params);
  66. bool (*is_fbc_enabled_in_hw)(struct compressor *cp,
  67. uint32_t *fbc_mapped_crtc_id);
  68. };
  69. struct compressor {
  70. struct dc_context *ctx;
  71. uint32_t attached_inst;
  72. bool is_enabled;
  73. const struct compressor_funcs *funcs;
  74. union {
  75. uint32_t raw;
  76. struct {
  77. uint32_t FBC_SUPPORT:1;
  78. uint32_t FB_POOL:1;
  79. uint32_t DYNAMIC_ALLOC:1;
  80. uint32_t LPT_SUPPORT:1;
  81. uint32_t LPT_MC_CONFIG:1;
  82. uint32_t DUMMY_BACKEND:1;
  83. uint32_t CLK_GATING_DISABLED:1;
  84. } bits;
  85. } options;
  86. union fbc_physical_address compr_surface_address;
  87. uint32_t embedded_panel_h_size;
  88. uint32_t embedded_panel_v_size;
  89. uint32_t memory_bus_width;
  90. uint32_t banks_num;
  91. uint32_t raw_size;
  92. uint32_t channel_interleave_size;
  93. uint32_t dram_channels_num;
  94. uint32_t allocated_size;
  95. uint32_t preferred_requested_size;
  96. uint32_t lpt_channels_num;
  97. enum fbc_compress_ratio min_compress_ratio;
  98. };
  99. struct fbc_input_info {
  100. bool dynamic_fbc_buffer_alloc;
  101. unsigned int source_view_width;
  102. unsigned int source_view_height;
  103. unsigned int num_of_active_targets;
  104. };
  105. struct fbc_requested_compressed_size {
  106. unsigned int preferred_size;
  107. unsigned int preferred_size_alignment;
  108. unsigned int min_size;
  109. unsigned int min_size_alignment;
  110. union {
  111. struct {
  112. /* Above preferedSize must be allocated in FB pool */
  113. unsigned int preferred_must_be_framebuffer_pool : 1;
  114. /* Above minSize must be allocated in FB pool */
  115. unsigned int min_must_be_framebuffer_pool : 1;
  116. } bits;
  117. unsigned int flags;
  118. };
  119. };
  120. #endif