mirror of
https://github.com/torvalds/linux.git
synced 2026-04-26 02:22:28 -04:00
Merge tag 'amd-drm-next-5.12-2021-01-08' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-5.12-2021-01-08: amdgpu: - Rework IH ring handling on vega and navi - Rework HDP handling for vega and navi - swSMU documenation updates - Overdrive support for Sienna Cichlid and newer asics - swSMU updates for vangogh - swSMU updates for renoir - Enable FP16 on DCE8-11 - Misc code cleanups and bug fixes radeon: - Fixes for platforms that can't access PCI resources correctly - Misc code cleanups From: Alex Deucher <alexdeucher@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210108221811.3868-1-alexander.deucher@amd.com Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -60,7 +60,6 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/pci.h>
|
||||
@@ -2386,8 +2385,7 @@ void amdgpu_dm_update_connector_after_detect(
|
||||
|
||||
drm_connector_update_edid_property(connector,
|
||||
aconnector->edid);
|
||||
aconnector->num_modes = drm_add_edid_modes(connector, aconnector->edid);
|
||||
drm_connector_list_update(connector);
|
||||
drm_add_edid_modes(connector, aconnector->edid);
|
||||
|
||||
if (aconnector->dc_link->aux_mode)
|
||||
drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
|
||||
@@ -3760,10 +3758,53 @@ static const struct drm_encoder_funcs amdgpu_dm_encoder_funcs = {
|
||||
};
|
||||
|
||||
|
||||
static void get_min_max_dc_plane_scaling(struct drm_device *dev,
|
||||
struct drm_framebuffer *fb,
|
||||
int *min_downscale, int *max_upscale)
|
||||
{
|
||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||
struct dc *dc = adev->dm.dc;
|
||||
/* Caps for all supported planes are the same on DCE and DCN 1 - 3 */
|
||||
struct dc_plane_cap *plane_cap = &dc->caps.planes[0];
|
||||
|
||||
switch (fb->format->format) {
|
||||
case DRM_FORMAT_P010:
|
||||
case DRM_FORMAT_NV12:
|
||||
case DRM_FORMAT_NV21:
|
||||
*max_upscale = plane_cap->max_upscale_factor.nv12;
|
||||
*min_downscale = plane_cap->max_downscale_factor.nv12;
|
||||
break;
|
||||
|
||||
case DRM_FORMAT_XRGB16161616F:
|
||||
case DRM_FORMAT_ARGB16161616F:
|
||||
case DRM_FORMAT_XBGR16161616F:
|
||||
case DRM_FORMAT_ABGR16161616F:
|
||||
*max_upscale = plane_cap->max_upscale_factor.fp16;
|
||||
*min_downscale = plane_cap->max_downscale_factor.fp16;
|
||||
break;
|
||||
|
||||
default:
|
||||
*max_upscale = plane_cap->max_upscale_factor.argb8888;
|
||||
*min_downscale = plane_cap->max_downscale_factor.argb8888;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* A factor of 1 in the plane_cap means to not allow scaling, ie. use a
|
||||
* scaling factor of 1.0 == 1000 units.
|
||||
*/
|
||||
if (*max_upscale == 1)
|
||||
*max_upscale = 1000;
|
||||
|
||||
if (*min_downscale == 1)
|
||||
*min_downscale = 1000;
|
||||
}
|
||||
|
||||
|
||||
static int fill_dc_scaling_info(const struct drm_plane_state *state,
|
||||
struct dc_scaling_info *scaling_info)
|
||||
{
|
||||
int scale_w, scale_h;
|
||||
int scale_w, scale_h, min_downscale, max_upscale;
|
||||
|
||||
memset(scaling_info, 0, sizeof(*scaling_info));
|
||||
|
||||
@@ -3795,17 +3836,25 @@ static int fill_dc_scaling_info(const struct drm_plane_state *state,
|
||||
/* DRM doesn't specify clipping on destination output. */
|
||||
scaling_info->clip_rect = scaling_info->dst_rect;
|
||||
|
||||
/* TODO: Validate scaling per-format with DC plane caps */
|
||||
/* Validate scaling per-format with DC plane caps */
|
||||
if (state->plane && state->plane->dev && state->fb) {
|
||||
get_min_max_dc_plane_scaling(state->plane->dev, state->fb,
|
||||
&min_downscale, &max_upscale);
|
||||
} else {
|
||||
min_downscale = 250;
|
||||
max_upscale = 16000;
|
||||
}
|
||||
|
||||
scale_w = scaling_info->dst_rect.width * 1000 /
|
||||
scaling_info->src_rect.width;
|
||||
|
||||
if (scale_w < 250 || scale_w > 16000)
|
||||
if (scale_w < min_downscale || scale_w > max_upscale)
|
||||
return -EINVAL;
|
||||
|
||||
scale_h = scaling_info->dst_rect.height * 1000 /
|
||||
scaling_info->src_rect.height;
|
||||
|
||||
if (scale_h < 250 || scale_h > 16000)
|
||||
if (scale_h < min_downscale || scale_h > max_upscale)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
@@ -5414,6 +5463,7 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
|
||||
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
|
||||
struct amdgpu_device *adev = drm_to_adev(crtc->dev);
|
||||
struct dm_crtc_state *acrtc_state = to_dm_crtc_state(crtc->state);
|
||||
struct amdgpu_display_manager *dm = &adev->dm;
|
||||
int rc = 0;
|
||||
|
||||
if (enable) {
|
||||
@@ -5429,7 +5479,27 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
|
||||
return rc;
|
||||
|
||||
irq_source = IRQ_TYPE_VBLANK + acrtc->otg_inst;
|
||||
return dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY;
|
||||
|
||||
if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
|
||||
return -EBUSY;
|
||||
|
||||
mutex_lock(&dm->dc_lock);
|
||||
|
||||
if (enable)
|
||||
dm->active_vblank_irq_count++;
|
||||
else
|
||||
dm->active_vblank_irq_count--;
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_DCN)
|
||||
dc_allow_idle_optimizations(
|
||||
adev->dm.dc, dm->active_vblank_irq_count == 0 ? true : false);
|
||||
|
||||
DRM_DEBUG_DRIVER("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0);
|
||||
#endif
|
||||
|
||||
mutex_unlock(&dm->dc_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dm_enable_vblank(struct drm_crtc *crtc)
|
||||
@@ -6424,12 +6494,26 @@ static void dm_plane_helper_cleanup_fb(struct drm_plane *plane,
|
||||
static int dm_plane_helper_check_state(struct drm_plane_state *state,
|
||||
struct drm_crtc_state *new_crtc_state)
|
||||
{
|
||||
int max_downscale = 0;
|
||||
int max_upscale = INT_MAX;
|
||||
struct drm_framebuffer *fb = state->fb;
|
||||
int min_downscale, max_upscale;
|
||||
int min_scale = 0;
|
||||
int max_scale = INT_MAX;
|
||||
|
||||
/* Plane enabled? Get min/max allowed scaling factors from plane caps. */
|
||||
if (fb && state->crtc) {
|
||||
get_min_max_dc_plane_scaling(state->crtc->dev, fb,
|
||||
&min_downscale, &max_upscale);
|
||||
/*
|
||||
* Convert to drm convention: 16.16 fixed point, instead of dc's
|
||||
* 1.0 == 1000. Also drm scaling is src/dst instead of dc's
|
||||
* dst/src, so min_scale = 1.0 / max_upscale, etc.
|
||||
*/
|
||||
min_scale = (1000 << 16) / max_upscale;
|
||||
max_scale = (1000 << 16) / min_downscale;
|
||||
}
|
||||
|
||||
/* TODO: These should be checked against DC plane caps */
|
||||
return drm_atomic_helper_check_plane_state(
|
||||
state, new_crtc_state, max_downscale, max_upscale, true, true);
|
||||
state, new_crtc_state, min_scale, max_scale, true, true);
|
||||
}
|
||||
|
||||
static int dm_plane_atomic_check(struct drm_plane *plane,
|
||||
@@ -8378,8 +8462,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
|
||||
acrtc->dm_irq_params.stream = dm_new_crtc_state->stream;
|
||||
manage_dm_interrupts(adev, acrtc, true);
|
||||
}
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
if (new_crtc_state->active &&
|
||||
if (IS_ENABLED(CONFIG_DEBUG_FS) && new_crtc_state->active &&
|
||||
amdgpu_dm_is_valid_crc_source(dm_new_crtc_state->crc_src)) {
|
||||
/**
|
||||
* Frontend may have changed so reapply the CRC capture
|
||||
@@ -8400,7 +8483,6 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
|
||||
amdgpu_dm_crtc_configure_crc_source(
|
||||
crtc, dm_new_crtc_state, dm_new_crtc_state->crc_src);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
for_each_new_crtc_in_state(state, crtc, new_crtc_state, j)
|
||||
|
||||
Reference in New Issue
Block a user