aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 17:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 17:34:42 -0500
commitf6705bf959efac87bca76d40050d342f1d212587 (patch)
treee199b124c6067a92be7f4727538ffc721670fc28 /drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
parentbec04432cb9036dedf89140c102b5ac03e4b3626 (diff)
parent49e37ba07a3ae697086c0a1a32c113a1f177d138 (diff)
Merge tag 'drm-for-v4.15-amd-dc' of git://people.freedesktop.org/~airlied/linux
Pull amdgpu DC display code for Vega from Dave Airlie: "This is the pull request for the AMD DC (display code) layer which is a requirement to program the display engines on the new Vega and Raven based GPUs. It also contains support for all amdgpu supported GPUs (CIK, VI, Polaris), which has to be enabled. It is also a kms atomic modesetting compatible driver (unlike the current in-tree display code). I've kept it separate from drm-next because it may have some things that cause you to reject it. Background story: AMD have an internal team creating a shared OS codebase for display at hw bring up time using information from their hardware teams. This process doesn't lead to the most Linux friendly/looking code but we have worked together on cleaning a lot of it up and dealing with sparse/smatch/checkpatch, and having their team internally adhere to Linux coding standards. This tree is a complete history rebased since they started opening it, we decided not to squash it down as the history may have some value. Some of the commits therefore might not reach kernel standards, and we are steadily training people in AMD to better write commit msgs. There is a major bunch of generated bandwidth calculation and verification code that comes from their hardware team. On Vega and before this is float calculations, on Raven (DCN10) this is double based. They do the required things to do FP in the kernel, and I could understand this might raise some issues. Rewriting the bandwidth would be a major undertaken in reverification, it's non-trivial to work out if a display can handle the complete set of mode information thrown at it. Future story: There is a TODO list with this, and it address most of the remaining things that would be nice to refine/remove. The DCN10 code is still under development internally and they push out a lot of patches quite regularly and are supporting this code base with their display team. I think we've reached the point where keeping it out of tree is going to motivate distributions to start carrying the code, so I'd prefer we get it in tree. I think this code is slightly better than STAGING quality but not massively so, I'd really like to see that float/double magic gone and fixed point used, but AMD don't seem to think the accuracy and revalidation of the code is worth the effort" * tag 'drm-for-v4.15-amd-dc' of git://people.freedesktop.org/~airlied/linux: (1110 commits) drm/amd/display: fix MST link training fail division by 0 drm/amd/display: Fix formatting for null pointer dereference fix drm/amd/display: Remove dangling planes on dc commit state drm/amd/display: add flip_immediate to commit update for stream drm/amd/display: Miss register MST encoder cbs drm/amd/display: Fix warnings on S3 resume drm/amd/display: use num_timing_generator instead of pipe_count drm/amd/display: use configurable FBC option in dm drm/amd/display: fix AZ clock not enabled before program AZ endpoint amdgpu/dm: Don't use DRM_ERROR in amdgpu_dm_atomic_check amd/display: Fix potential null dereference in dce_calcs.c amdgpu/dm: Remove unused forward declaration drm/amdgpu: Remove unused dc_stream from amdgpu_crtc amdgpu/dc: Fix double unlock in amdgpu_dm_commit_planes amdgpu/dc: Fix missing null checks in amdgpu_dm.c amdgpu/dc: Fix potential null dereferences in amdgpu_dm.c amdgpu/dc: fix more indentation warnings amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream. amdgpu/dc: fix indentation warning from smatch. amdgpu/dc: fix non-ansi function decls. ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index a7afe553e0a1..f2b72c7c6857 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -911,10 +911,6 @@ static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device,
911 struct cgs_display_info *info) 911 struct cgs_display_info *info)
912{ 912{
913 CGS_FUNC_ADEV; 913 CGS_FUNC_ADEV;
914 struct amdgpu_crtc *amdgpu_crtc;
915 struct drm_device *ddev = adev->ddev;
916 struct drm_crtc *crtc;
917 uint32_t line_time_us, vblank_lines;
918 struct cgs_mode_info *mode_info; 914 struct cgs_mode_info *mode_info;
919 915
920 if (info == NULL) 916 if (info == NULL)
@@ -928,30 +924,43 @@ static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device,
928 mode_info->ref_clock = adev->clock.spll.reference_freq; 924 mode_info->ref_clock = adev->clock.spll.reference_freq;
929 } 925 }
930 926
931 if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { 927 if (!amdgpu_device_has_dc_support(adev)) {
932 list_for_each_entry(crtc, 928 struct amdgpu_crtc *amdgpu_crtc;
933 &ddev->mode_config.crtc_list, head) { 929 struct drm_device *ddev = adev->ddev;
934 amdgpu_crtc = to_amdgpu_crtc(crtc); 930 struct drm_crtc *crtc;
935 if (crtc->enabled) { 931 uint32_t line_time_us, vblank_lines;
936 info->active_display_mask |= (1 << amdgpu_crtc->crtc_id); 932
937 info->display_count++; 933 if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {
938 } 934 list_for_each_entry(crtc,
939 if (mode_info != NULL && 935 &ddev->mode_config.crtc_list, head) {
940 crtc->enabled && amdgpu_crtc->enabled && 936 amdgpu_crtc = to_amdgpu_crtc(crtc);
941 amdgpu_crtc->hw_mode.clock) { 937 if (crtc->enabled) {
942 line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) / 938 info->active_display_mask |= (1 << amdgpu_crtc->crtc_id);
943 amdgpu_crtc->hw_mode.clock; 939 info->display_count++;
944 vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - 940 }
945 amdgpu_crtc->hw_mode.crtc_vdisplay + 941 if (mode_info != NULL &&
946 (amdgpu_crtc->v_border * 2); 942 crtc->enabled && amdgpu_crtc->enabled &&
947 mode_info->vblank_time_us = vblank_lines * line_time_us; 943 amdgpu_crtc->hw_mode.clock) {
948 mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode); 944 line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) /
949 mode_info->ref_clock = adev->clock.spll.reference_freq; 945 amdgpu_crtc->hw_mode.clock;
950 mode_info = NULL; 946 vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end -
947 amdgpu_crtc->hw_mode.crtc_vdisplay +
948 (amdgpu_crtc->v_border * 2);
949 mode_info->vblank_time_us = vblank_lines * line_time_us;
950 mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode);
951 mode_info->ref_clock = adev->clock.spll.reference_freq;
952 mode_info = NULL;
953 }
951 } 954 }
952 } 955 }
956 } else {
957 info->display_count = adev->pm.pm_display_cfg.num_display;
958 if (mode_info != NULL) {
959 mode_info->vblank_time_us = adev->pm.pm_display_cfg.min_vblank_time;
960 mode_info->refresh_rate = adev->pm.pm_display_cfg.vrefresh;
961 mode_info->ref_clock = adev->clock.spll.reference_freq;
962 }
953 } 963 }
954
955 return 0; 964 return 0;
956} 965}
957 966