resource.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Copyright 2015 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. #ifndef DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_
  25. #define DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_
  26. #include "core_types.h"
  27. #include "core_status.h"
  28. #include "core_dc.h"
  29. #include "dal_asic_id.h"
  30. /* TODO unhardcode, 4 for CZ*/
  31. #define MEMORY_TYPE_MULTIPLIER 4
  32. enum dce_version resource_parse_asic_id(
  33. struct hw_asic_id asic_id);
  34. struct resource_caps {
  35. int num_timing_generator;
  36. int num_video_plane;
  37. int num_audio;
  38. int num_stream_encoder;
  39. int num_pll;
  40. };
  41. struct resource_straps {
  42. uint32_t hdmi_disable;
  43. uint32_t dc_pinstraps_audio;
  44. uint32_t audio_stream_number;
  45. };
  46. struct resource_create_funcs {
  47. void (*read_dce_straps)(
  48. struct dc_context *ctx, struct resource_straps *straps);
  49. struct audio *(*create_audio)(
  50. struct dc_context *ctx, unsigned int inst);
  51. struct stream_encoder *(*create_stream_encoder)(
  52. enum engine_id eng_id, struct dc_context *ctx);
  53. struct dce_hwseq *(*create_hwseq)(
  54. struct dc_context *ctx);
  55. };
  56. bool resource_construct(
  57. unsigned int num_virtual_links,
  58. struct core_dc *dc,
  59. struct resource_pool *pool,
  60. const struct resource_create_funcs *create_funcs);
  61. struct resource_pool *dc_create_resource_pool(
  62. struct core_dc *dc,
  63. int num_virtual_links,
  64. enum dce_version dc_version,
  65. struct hw_asic_id asic_id);
  66. void dc_destroy_resource_pool(struct core_dc *dc);
  67. enum dc_status resource_map_pool_resources(
  68. const struct core_dc *dc,
  69. struct validate_context *context,
  70. struct validate_context *old_context);
  71. bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx);
  72. enum dc_status resource_build_scaling_params_for_context(
  73. const struct core_dc *dc,
  74. struct validate_context *context);
  75. void resource_build_info_frame(struct pipe_ctx *pipe_ctx);
  76. void resource_unreference_clock_source(
  77. struct resource_context *res_ctx,
  78. const struct resource_pool *pool,
  79. struct clock_source **clock_source);
  80. void resource_reference_clock_source(
  81. struct resource_context *res_ctx,
  82. const struct resource_pool *pool,
  83. struct clock_source *clock_source);
  84. bool resource_are_streams_timing_synchronizable(
  85. const struct core_stream *stream1,
  86. const struct core_stream *stream2);
  87. struct clock_source *resource_find_used_clk_src_for_sharing(
  88. struct resource_context *res_ctx,
  89. struct pipe_ctx *pipe_ctx);
  90. struct clock_source *dc_resource_find_first_free_pll(
  91. struct resource_context *res_ctx,
  92. const struct resource_pool *pool);
  93. struct pipe_ctx *resource_get_head_pipe_for_stream(
  94. struct resource_context *res_ctx,
  95. const struct core_stream *stream);
  96. bool resource_attach_surfaces_to_context(
  97. const struct dc_surface *const *surfaces,
  98. int surface_count,
  99. const struct dc_stream *dc_stream,
  100. struct validate_context *context,
  101. const struct resource_pool *pool);
  102. struct pipe_ctx *find_idle_secondary_pipe(
  103. struct resource_context *res_ctx,
  104. const struct resource_pool *pool);
  105. bool resource_is_stream_unchanged(
  106. const struct validate_context *old_context, const struct core_stream *stream);
  107. bool is_stream_unchanged(
  108. const struct core_stream *old_stream, const struct core_stream *stream);
  109. bool resource_validate_attach_surfaces(
  110. const struct dc_validation_set set[],
  111. int set_count,
  112. const struct validate_context *old_context,
  113. struct validate_context *context,
  114. const struct resource_pool *pool);
  115. void validate_guaranteed_copy_streams(
  116. struct validate_context *context,
  117. int max_streams);
  118. void resource_validate_ctx_update_pointer_after_copy(
  119. const struct validate_context *src_ctx,
  120. struct validate_context *dst_ctx);
  121. enum dc_status resource_map_clock_resources(
  122. const struct core_dc *dc,
  123. struct validate_context *context,
  124. struct validate_context *old_context);
  125. enum dc_status resource_map_phy_clock_resources(
  126. const struct core_dc *dc,
  127. struct validate_context *context,
  128. struct validate_context *old_context);
  129. bool pipe_need_reprogram(
  130. struct pipe_ctx *pipe_ctx_old,
  131. struct pipe_ctx *pipe_ctx);
  132. void resource_build_bit_depth_reduction_params(const struct core_stream *stream,
  133. struct bit_depth_reduction_params *fmt_bit_depth);
  134. #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */