Skip to content

Commit 12ab316

Browse files
committed
Merge tag 'amd-drm-next-5.7-2020-04-01' of git://people.freedesktop.org/~agd5f/linux into drm-next
amd-drm-next-5.7-2020-04-01: amdgpu: - HDCP fixes - gfx10 fix - Misc display fixes - BACO fixes amdkfd: - Fix memory leak Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 9c34696 + 3148a6a commit 12ab316

27 files changed

+223
-114
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ static int gfx_v10_0_mec_init(struct amdgpu_device *adev)
11131113
return r;
11141114
}
11151115

1116-
memset(hpd, 0, adev->gfx.mec.hpd_eop_obj->tbo.mem.size);
1116+
memset(hpd, 0, mec_hpd_size);
11171117

11181118
amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
11191119
amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)
19461946
return r;
19471947
}
19481948

1949-
memset(hpd, 0, adev->gfx.mec.hpd_eop_obj->tbo.mem.size);
1949+
memset(hpd, 0, mec_hpd_size);
19501950

19511951
amdgpu_bo_kunmap(adev->gfx.mec.hpd_eop_obj);
19521952
amdgpu_bo_unreserve(adev->gfx.mec.hpd_eop_obj);

drivers/gpu/drm/amd/amdkfd/kfd_device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,9 +1112,9 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,
11121112
return 0;
11131113

11141114
kfd_gtt_no_free_chunk:
1115-
pr_debug("Allocation failed with mem_obj = %p\n", mem_obj);
1115+
pr_debug("Allocation failed with mem_obj = %p\n", *mem_obj);
11161116
mutex_unlock(&kfd->gtt_sa_lock);
1117-
kfree(mem_obj);
1117+
kfree(*mem_obj);
11181118
return -ENOMEM;
11191119
}
11201120

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3639,6 +3639,9 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
36393639
case DRM_FORMAT_NV12:
36403640
plane_info->format = SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb;
36413641
break;
3642+
case DRM_FORMAT_P010:
3643+
plane_info->format = SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb;
3644+
break;
36423645
default:
36433646
DRM_ERROR(
36443647
"Unsupported screen format %s\n",
@@ -5535,6 +5538,8 @@ static int get_plane_formats(const struct drm_plane *plane,
55355538

55365539
if (plane_cap && plane_cap->pixel_format_support.nv12)
55375540
formats[num_formats++] = DRM_FORMAT_NV12;
5541+
if (plane_cap && plane_cap->pixel_format_support.p010)
5542+
formats[num_formats++] = DRM_FORMAT_P010;
55385543
break;
55395544

55405545
case DRM_PLANE_TYPE_OVERLAY:
@@ -5587,12 +5592,15 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
55875592
}
55885593

55895594
if (plane->type == DRM_PLANE_TYPE_PRIMARY &&
5590-
plane_cap && plane_cap->pixel_format_support.nv12) {
5595+
plane_cap &&
5596+
(plane_cap->pixel_format_support.nv12 ||
5597+
plane_cap->pixel_format_support.p010)) {
55915598
/* This only affects YUV formats. */
55925599
drm_plane_create_color_properties(
55935600
plane,
55945601
BIT(DRM_COLOR_YCBCR_BT601) |
5595-
BIT(DRM_COLOR_YCBCR_BT709),
5602+
BIT(DRM_COLOR_YCBCR_BT709) |
5603+
BIT(DRM_COLOR_YCBCR_BT2020),
55965604
BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
55975605
BIT(DRM_COLOR_YCBCR_FULL_RANGE),
55985606
DRM_COLOR_YCBCR_BT709, DRM_COLOR_YCBCR_LIMITED_RANGE);

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,13 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work,
192192
&hdcp_work->srm_version);
193193

194194
display->adjust.disable = 0;
195-
if (content_type == DRM_MODE_HDCP_CONTENT_TYPE0)
195+
if (content_type == DRM_MODE_HDCP_CONTENT_TYPE0) {
196+
hdcp_w->link.adjust.hdcp1.disable = 0;
196197
hdcp_w->link.adjust.hdcp2.force_type = MOD_HDCP_FORCE_TYPE_0;
197-
else if (content_type == DRM_MODE_HDCP_CONTENT_TYPE1)
198+
} else if (content_type == DRM_MODE_HDCP_CONTENT_TYPE1) {
199+
hdcp_w->link.adjust.hdcp1.disable = 1;
198200
hdcp_w->link.adjust.hdcp2.force_type = MOD_HDCP_FORCE_TYPE_1;
201+
}
199202

200203
schedule_delayed_work(&hdcp_w->property_validate_dwork,
201204
msecs_to_jiffies(DRM_HDCP_CHECK_PERIOD_MS));
@@ -263,7 +266,7 @@ static void event_callback(struct work_struct *work)
263266

264267
mutex_lock(&hdcp_work->mutex);
265268

266-
cancel_delayed_work(&hdcp_work->watchdog_timer_dwork);
269+
cancel_delayed_work(&hdcp_work->callback_dwork);
267270

268271
mod_hdcp_process_event(&hdcp_work->hdcp, MOD_HDCP_EVENT_CALLBACK,
269272
&hdcp_work->output);
@@ -344,6 +347,8 @@ static void event_watchdog_timer(struct work_struct *work)
344347

345348
mutex_lock(&hdcp_work->mutex);
346349

350+
cancel_delayed_work(&hdcp_work->watchdog_timer_dwork);
351+
347352
mod_hdcp_process_event(&hdcp_work->hdcp,
348353
MOD_HDCP_EVENT_WATCHDOG_TIMEOUT,
349354
&hdcp_work->output);
@@ -414,7 +419,8 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
414419
link->dp.rev = aconnector->dc_link->dpcd_caps.dpcd_rev.raw;
415420
link->dp.mst_supported = config->mst_supported;
416421
display->adjust.disable = 1;
417-
link->adjust.auth_delay = 2;
422+
link->adjust.auth_delay = 3;
423+
link->adjust.hdcp1.disable = 0;
418424

419425
hdcp_update_display(hdcp_work, link_index, aconnector, DRM_MODE_HDCP_CONTENT_TYPE0, false);
420426
}

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,26 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context)
13601360
return (result == DC_OK);
13611361
}
13621362

1363+
static bool is_flip_pending_in_pipes(struct dc *dc, struct dc_state *context)
1364+
{
1365+
int i;
1366+
struct pipe_ctx *pipe;
1367+
1368+
for (i = 0; i < MAX_PIPES; i++) {
1369+
pipe = &context->res_ctx.pipe_ctx[i];
1370+
1371+
if (!pipe->plane_state)
1372+
continue;
1373+
1374+
/* Must set to false to start with, due to OR in update function */
1375+
pipe->plane_state->status.is_flip_pending = false;
1376+
dc->hwss.update_pending_status(pipe);
1377+
if (pipe->plane_state->status.is_flip_pending)
1378+
return true;
1379+
}
1380+
return false;
1381+
}
1382+
13631383
bool dc_post_update_surfaces_to_stream(struct dc *dc)
13641384
{
13651385
int i;
@@ -1370,6 +1390,9 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
13701390

13711391
post_surface_trace(dc);
13721392

1393+
if (is_flip_pending_in_pipes(dc, context))
1394+
return true;
1395+
13731396
for (i = 0; i < dc->res_pool->pipe_count; i++)
13741397
if (context->res_ctx.pipe_ctx[i].stream == NULL ||
13751398
context->res_ctx.pipe_ctx[i].plane_state == NULL) {
@@ -1703,6 +1726,9 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
17031726
if (u->coeff_reduction_factor)
17041727
update_flags->bits.coeff_reduction_change = 1;
17051728

1729+
if (u->gamut_remap_matrix)
1730+
update_flags->bits.gamut_remap_change = 1;
1731+
17061732
if (u->gamma) {
17071733
enum surface_pixel_format format = SURFACE_PIXEL_FORMAT_GRPH_BEGIN;
17081734

@@ -1728,7 +1754,8 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
17281754

17291755
if (update_flags->bits.input_csc_change
17301756
|| update_flags->bits.coeff_reduction_change
1731-
|| update_flags->bits.gamma_change) {
1757+
|| update_flags->bits.gamma_change
1758+
|| update_flags->bits.gamut_remap_change) {
17321759
type = UPDATE_TYPE_FULL;
17331760
elevate_update_type(&overall_type, type);
17341761
}
@@ -1973,6 +2000,10 @@ static void copy_surface_update_to_plane(
19732000
if (srf_update->coeff_reduction_factor)
19742001
surface->coeff_reduction_factor =
19752002
*srf_update->coeff_reduction_factor;
2003+
2004+
if (srf_update->gamut_remap_matrix)
2005+
surface->gamut_remap_matrix =
2006+
*srf_update->gamut_remap_matrix;
19762007
}
19772008

19782009
static void copy_stream_update_to_stream(struct dc *dc,

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
10771077
* on certain displays, such as the Sharp 4k
10781078
*/
10791079
pipe_ctx->plane_res.scl_data.lb_params.depth = LB_PIXEL_DEPTH_30BPP;
1080+
pipe_ctx->plane_res.scl_data.lb_params.alpha_en = plane_state->per_pixel_alpha;
10801081

10811082
pipe_ctx->plane_res.scl_data.recout.x += timing->h_border_left;
10821083
pipe_ctx->plane_res.scl_data.recout.y += timing->v_border_top;

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ union surface_update_flags {
726726
uint32_t output_tf_change:1;
727727
uint32_t pixel_format_change:1;
728728
uint32_t plane_size_change:1;
729+
uint32_t gamut_remap_change:1;
729730

730731
/* Full updates */
731732
uint32_t new_plane:1;
@@ -760,6 +761,7 @@ struct dc_plane_state {
760761
struct dc_csc_transform input_csc_color_matrix;
761762
struct fixed31_32 coeff_reduction_factor;
762763
struct fixed31_32 hdr_mult;
764+
struct colorspace_transform gamut_remap_matrix;
763765

764766
// TODO: No longer used, remove
765767
struct dc_hdr_static_metadata hdr_static_ctx;
@@ -839,6 +841,7 @@ struct dc_surface_update {
839841
const struct dc_transfer_func *func_shaper;
840842
const struct dc_3dlut *lut3d_func;
841843
const struct dc_transfer_func *blend_tf;
844+
const struct colorspace_transform *gamut_remap_matrix;
842845
};
843846

844847
/*

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,6 +2004,12 @@ void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
20042004
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
20052005
adjust.temperature_matrix[i] =
20062006
pipe_ctx->stream->gamut_remap_matrix.matrix[i];
2007+
} else if (pipe_ctx->plane_state &&
2008+
pipe_ctx->plane_state->gamut_remap_matrix.enable_remap == true) {
2009+
adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
2010+
for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
2011+
adjust.temperature_matrix[i] =
2012+
pipe_ctx->plane_state->gamut_remap_matrix.matrix[i];
20072013
}
20082014

20092015
pipe_ctx->plane_res.dpp->funcs->dpp_set_gamut_remap(pipe_ctx->plane_res.dpp, &adjust);

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,23 @@ void optc1_set_blank_data_double_buffer(struct timing_generator *optc, bool enab
342342
OTG_BLANK_DATA_DOUBLE_BUFFER_EN, blank_data_double_buffer_enable);
343343
}
344344

345+
/**
346+
* optc1_set_timing_double_buffer() - DRR double buffering control
347+
*
348+
* Sets double buffer point for V_TOTAL, H_TOTAL, VTOTAL_MIN,
349+
* VTOTAL_MAX, VTOTAL_MIN_SEL and VTOTAL_MAX_SEL registers.
350+
*
351+
* Options: any time, start of frame, dp start of frame (range timing)
352+
*/
353+
void optc1_set_timing_double_buffer(struct timing_generator *optc, bool enable)
354+
{
355+
struct optc *optc1 = DCN10TG_FROM_TG(optc);
356+
uint32_t mode = enable ? 2 : 0;
357+
358+
REG_UPDATE(OTG_DOUBLE_BUFFER_CONTROL,
359+
OTG_RANGE_TIMING_DBUF_UPDATE_MODE, mode);
360+
}
361+
345362
/**
346363
* unblank_crtc
347364
* Call ASIC Control Object to UnBlank CRTC.
@@ -1353,6 +1370,7 @@ void optc1_clear_optc_underflow(struct timing_generator *optc)
13531370
void optc1_tg_init(struct timing_generator *optc)
13541371
{
13551372
optc1_set_blank_data_double_buffer(optc, true);
1373+
optc1_set_timing_double_buffer(optc, true);
13561374
optc1_clear_optc_underflow(optc);
13571375
}
13581376

0 commit comments

Comments
 (0)