Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6705bf9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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.
  ...
parents bec04432 49e37ba0
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -409,5 +409,15 @@ those drivers as simple as possible, so lots of room for refactoring:


Contact: Noralf Trønnes, Daniel Vetter
Contact: Noralf Trønnes, Daniel Vetter


AMD DC Display Driver
---------------------

AMD DC is the display driver for AMD devices starting with Vega. There has been
a bunch of progress cleaning it up but there's still plenty of work to be done.

See drivers/gpu/drm/amd/display/TODO for tasks.

Contact: Harry Wentland, Alex Deucher

Outside DRM
Outside DRM
===========
===========
+1 −0
Original line number Original line Diff line number Diff line
@@ -41,3 +41,4 @@ config DRM_AMDGPU_GART_DEBUGFS
	  pages. Uses more memory for housekeeping, enable only for debugging.
	  pages. Uses more memory for housekeeping, enable only for debugging.


source "drivers/gpu/drm/amd/acp/Kconfig"
source "drivers/gpu/drm/amd/acp/Kconfig"
source "drivers/gpu/drm/amd/display/Kconfig"
+16 −1
Original line number Original line Diff line number Diff line
@@ -4,13 +4,19 @@
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.


FULL_AMD_PATH=$(src)/..
FULL_AMD_PATH=$(src)/..
DISPLAY_FOLDER_NAME=display
FULL_AMD_DISPLAY_PATH = $(FULL_AMD_PATH)/$(DISPLAY_FOLDER_NAME)


ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
	-I$(FULL_AMD_PATH)/include \
	-I$(FULL_AMD_PATH)/include \
	-I$(FULL_AMD_PATH)/amdgpu \
	-I$(FULL_AMD_PATH)/amdgpu \
	-I$(FULL_AMD_PATH)/scheduler \
	-I$(FULL_AMD_PATH)/scheduler \
	-I$(FULL_AMD_PATH)/powerplay/inc \
	-I$(FULL_AMD_PATH)/powerplay/inc \
	-I$(FULL_AMD_PATH)/acp/include
	-I$(FULL_AMD_PATH)/acp/include \
	-I$(FULL_AMD_DISPLAY_PATH) \
	-I$(FULL_AMD_DISPLAY_PATH)/include \
	-I$(FULL_AMD_DISPLAY_PATH)/dc \
	-I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm


amdgpu-y := amdgpu_drv.o
amdgpu-y := amdgpu_drv.o


@@ -133,4 +139,13 @@ include $(FULL_AMD_PATH)/powerplay/Makefile


amdgpu-y += $(AMD_POWERPLAY_FILES)
amdgpu-y += $(AMD_POWERPLAY_FILES)


ifneq ($(CONFIG_DRM_AMD_DC),)

RELATIVE_AMD_DISPLAY_PATH = ../$(DISPLAY_FOLDER_NAME)
include $(FULL_AMD_DISPLAY_PATH)/Makefile

amdgpu-y += $(AMD_DISPLAY_FILES)

endif

obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o
obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o
+16 −0
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@
#include "amdgpu_vce.h"
#include "amdgpu_vce.h"
#include "amdgpu_vcn.h"
#include "amdgpu_vcn.h"
#include "amdgpu_mn.h"
#include "amdgpu_mn.h"
#include "amdgpu_dm.h"


#include "gpu_scheduler.h"
#include "gpu_scheduler.h"
#include "amdgpu_virt.h"
#include "amdgpu_virt.h"
@@ -101,6 +102,8 @@ extern int amdgpu_vm_fragment_size;
extern int amdgpu_vm_fault_stop;
extern int amdgpu_vm_fault_stop;
extern int amdgpu_vm_debug;
extern int amdgpu_vm_debug;
extern int amdgpu_vm_update_mode;
extern int amdgpu_vm_update_mode;
extern int amdgpu_dc;
extern int amdgpu_dc_log;
extern int amdgpu_sched_jobs;
extern int amdgpu_sched_jobs;
extern int amdgpu_sched_hw_submission;
extern int amdgpu_sched_hw_submission;
extern int amdgpu_no_evict;
extern int amdgpu_no_evict;
@@ -1535,6 +1538,7 @@ struct amdgpu_device {
	/* display */
	/* display */
	bool				enable_virtual_display;
	bool				enable_virtual_display;
	struct amdgpu_mode_info		mode_info;
	struct amdgpu_mode_info		mode_info;
	/* For pre-DCE11. DCE11 and later are in "struct amdgpu_device->dm" */
	struct work_struct		hotplug_work;
	struct work_struct		hotplug_work;
	struct amdgpu_irq_src		crtc_irq;
	struct amdgpu_irq_src		crtc_irq;
	struct amdgpu_irq_src		pageflip_irq;
	struct amdgpu_irq_src		pageflip_irq;
@@ -1590,6 +1594,9 @@ struct amdgpu_device {
	/* GDS */
	/* GDS */
	struct amdgpu_gds		gds;
	struct amdgpu_gds		gds;


	/* display related functionality */
	struct amdgpu_display_manager dm;

	struct amdgpu_ip_block          ip_blocks[AMDGPU_MAX_IP_NUM];
	struct amdgpu_ip_block          ip_blocks[AMDGPU_MAX_IP_NUM];
	int				num_ip_blocks;
	int				num_ip_blocks;
	struct mutex	mn_lock;
	struct mutex	mn_lock;
@@ -1653,6 +1660,9 @@ void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v);
u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index);
u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index);
void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v);
void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v);


bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type);
bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);

/*
/*
 * Registers read & write functions.
 * Registers read & write functions.
 */
 */
@@ -1911,5 +1921,11 @@ int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
			   uint64_t addr, struct amdgpu_bo **bo,
			   uint64_t addr, struct amdgpu_bo **bo,
			   struct amdgpu_bo_va_mapping **mapping);
			   struct amdgpu_bo_va_mapping **mapping);


#if defined(CONFIG_DRM_AMD_DC)
int amdgpu_dm_display_resume(struct amdgpu_device *adev );
#else
static inline int amdgpu_dm_display_resume(struct amdgpu_device *adev) { return 0; }
#endif

#include "amdgpu_object.h"
#include "amdgpu_object.h"
#endif
#endif
+34 −25
Original line number Original line Diff line number Diff line
@@ -911,10 +911,6 @@ static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device,
					  struct cgs_display_info *info)
					  struct cgs_display_info *info)
{
{
	CGS_FUNC_ADEV;
	CGS_FUNC_ADEV;
	struct amdgpu_crtc *amdgpu_crtc;
	struct drm_device *ddev = adev->ddev;
	struct drm_crtc *crtc;
	uint32_t line_time_us, vblank_lines;
	struct cgs_mode_info *mode_info;
	struct cgs_mode_info *mode_info;


	if (info == NULL)
	if (info == NULL)
@@ -928,6 +924,12 @@ static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device,
		mode_info->ref_clock = adev->clock.spll.reference_freq;
		mode_info->ref_clock = adev->clock.spll.reference_freq;
	}
	}


	if (!amdgpu_device_has_dc_support(adev)) {
		struct amdgpu_crtc *amdgpu_crtc;
		struct drm_device *ddev = adev->ddev;
		struct drm_crtc *crtc;
		uint32_t line_time_us, vblank_lines;

		if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {
		if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {
			list_for_each_entry(crtc,
			list_for_each_entry(crtc,
					&ddev->mode_config.crtc_list, head) {
					&ddev->mode_config.crtc_list, head) {
@@ -951,7 +953,14 @@ static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device,
				}
				}
			}
			}
		}
		}

	} else {
		info->display_count = adev->pm.pm_display_cfg.num_display;
		if (mode_info != NULL) {
			mode_info->vblank_time_us = adev->pm.pm_display_cfg.min_vblank_time;
			mode_info->refresh_rate = adev->pm.pm_display_cfg.vrefresh;
			mode_info->ref_clock = adev->clock.spll.reference_freq;
		}
	}
	return 0;
	return 0;
}
}


Loading