resource.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. bool resource_build_scaling_params(
  71. const struct dc_surface *surface,
  72. struct pipe_ctx *pipe_ctx);
  73. enum dc_status resource_build_scaling_params_for_context(
  74. const struct core_dc *dc,
  75. struct validate_context *context);
  76. void resource_build_info_frame(struct pipe_ctx *pipe_ctx);
  77. void resource_unreference_clock_source(
  78. struct resource_context *res_ctx,
  79. struct clock_source *clock_source);
  80. void resource_reference_clock_source(
  81. struct resource_context *res_ctx,
  82. struct clock_source *clock_source);
  83. bool resource_are_streams_timing_synchronizable(
  84. const struct core_stream *stream1,
  85. const struct core_stream *stream2);
  86. struct clock_source *resource_find_used_clk_src_for_sharing(
  87. struct resource_context *res_ctx,
  88. struct pipe_ctx *pipe_ctx);
  89. struct clock_source *dc_resource_find_first_free_pll(
  90. struct resource_context *res_ctx);
  91. struct pipe_ctx *resource_get_head_pipe_for_stream(
  92. struct resource_context *res_ctx,
  93. const struct core_stream *stream);
  94. bool resource_attach_surfaces_to_context(
  95. const struct dc_surface *const *surfaces,
  96. int surface_count,
  97. const struct dc_target *dc_target,
  98. struct validate_context *context);
  99. struct pipe_ctx *find_idle_secondary_pipe(struct resource_context *res_ctx);
  100. bool resource_is_stream_unchanged(
  101. const struct validate_context *old_context, struct core_stream *stream);
  102. bool is_target_unchanged(
  103. const struct core_target *old_target, const struct core_target *target);
  104. bool resource_validate_attach_surfaces(
  105. const struct dc_validation_set set[],
  106. int set_count,
  107. const struct validate_context *old_context,
  108. struct validate_context *context);
  109. void validate_guaranteed_copy_target(
  110. struct validate_context *context,
  111. int max_targets);
  112. void resource_validate_ctx_update_pointer_after_copy(
  113. const struct validate_context *src_ctx,
  114. struct validate_context *dst_ctx);
  115. void resource_validate_ctx_copy_construct(
  116. const struct validate_context *src_ctx,
  117. struct validate_context *dst_ctx);
  118. void resource_validate_ctx_destruct(struct validate_context *context);
  119. enum dc_status resource_map_clock_resources(
  120. const struct core_dc *dc,
  121. struct validate_context *context);
  122. enum dc_status resource_map_phy_clock_resources(
  123. const struct core_dc *dc,
  124. struct validate_context *context);
  125. bool pipe_need_reprogram(
  126. struct pipe_ctx *pipe_ctx_old,
  127. struct pipe_ctx *pipe_ctx);
  128. #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */