diff options
author | Dave Airlie <airlied@redhat.com> | 2017-11-08 21:01:08 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-11-08 21:01:08 -0500 |
commit | 4479ed411cf41b42b1c548f73099287fff2330ff (patch) | |
tree | d4aeae53b3ec20afe0c996d2a7d03a6f5c5a4df8 | |
parent | 26c860d5579684528114c3875ef88f7796330eb5 (diff) | |
parent | f368d3bfde225199eef2216b03e0ba4944a3434a (diff) |
Merge branch 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux into drm-next
A bunch of smatch fixes for the dc code.
* 'drm-next-4.15-dc' of git://people.freedesktop.org/~agd5f/linux:
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.
drm/amd/display: remove some unneeded code
drm/amd/display: checking for NULL instead of IS_ERR()
drm/amd/display: small cleanup in destruct()
23 files changed, 114 insertions, 99 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 59e2e5d59562..ffde1e9666e8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | |||
@@ -436,8 +436,6 @@ struct amdgpu_crtc { | |||
436 | enum amdgpu_interrupt_state vsync_timer_enabled; | 436 | enum amdgpu_interrupt_state vsync_timer_enabled; |
437 | 437 | ||
438 | int otg_inst; | 438 | int otg_inst; |
439 | /* After Set Mode stream will be non-NULL */ | ||
440 | const struct dc_stream *stream; | ||
441 | struct drm_pending_vblank_event *event; | 439 | struct drm_pending_vblank_event *event; |
442 | }; | 440 | }; |
443 | 441 | ||
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 33a15a1d818c..8ed6767b4616 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
@@ -430,10 +430,12 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) | |||
430 | /* Display Core create. */ | 430 | /* Display Core create. */ |
431 | adev->dm.dc = dc_create(&init_data); | 431 | adev->dm.dc = dc_create(&init_data); |
432 | 432 | ||
433 | if (adev->dm.dc) | 433 | if (adev->dm.dc) { |
434 | DRM_INFO("Display Core initialized!\n"); | 434 | DRM_INFO("Display Core initialized!\n"); |
435 | else | 435 | } else { |
436 | DRM_INFO("Display Core failed to initialize!\n"); | 436 | DRM_INFO("Display Core failed to initialize!\n"); |
437 | goto error; | ||
438 | } | ||
437 | 439 | ||
438 | INIT_WORK(&adev->dm.mst_hotplug_work, hotplug_notify_work_func); | 440 | INIT_WORK(&adev->dm.mst_hotplug_work, hotplug_notify_work_func); |
439 | 441 | ||
@@ -517,7 +519,7 @@ static int detect_mst_link_for_all_connectors(struct drm_device *dev) | |||
517 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | 519 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
518 | 520 | ||
519 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 521 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
520 | aconnector = to_amdgpu_dm_connector(connector); | 522 | aconnector = to_amdgpu_dm_connector(connector); |
521 | if (aconnector->dc_link->type == dc_connection_mst_branch) { | 523 | if (aconnector->dc_link->type == dc_connection_mst_branch) { |
522 | DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n", | 524 | DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n", |
523 | aconnector, aconnector->base.base.id); | 525 | aconnector, aconnector->base.base.id); |
@@ -1296,7 +1298,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm) | |||
1296 | &amdgpu_dm_backlight_ops, | 1298 | &amdgpu_dm_backlight_ops, |
1297 | &props); | 1299 | &props); |
1298 | 1300 | ||
1299 | if (NULL == dm->backlight_dev) | 1301 | if (IS_ERR(dm->backlight_dev)) |
1300 | DRM_ERROR("DM: Backlight registration failed!\n"); | 1302 | DRM_ERROR("DM: Backlight registration failed!\n"); |
1301 | else | 1303 | else |
1302 | DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name); | 1304 | DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name); |
@@ -2273,7 +2275,7 @@ decide_crtc_timing_for_drm_display_mode(struct drm_display_mode *drm_mode, | |||
2273 | } | 2275 | } |
2274 | } | 2276 | } |
2275 | 2277 | ||
2276 | static void create_fake_sink(struct amdgpu_dm_connector *aconnector) | 2278 | static int create_fake_sink(struct amdgpu_dm_connector *aconnector) |
2277 | { | 2279 | { |
2278 | struct dc_sink *sink = NULL; | 2280 | struct dc_sink *sink = NULL; |
2279 | struct dc_sink_init_data sink_init_data = { 0 }; | 2281 | struct dc_sink_init_data sink_init_data = { 0 }; |
@@ -2282,14 +2284,18 @@ static void create_fake_sink(struct amdgpu_dm_connector *aconnector) | |||
2282 | sink_init_data.sink_signal = aconnector->dc_link->connector_signal; | 2284 | sink_init_data.sink_signal = aconnector->dc_link->connector_signal; |
2283 | 2285 | ||
2284 | sink = dc_sink_create(&sink_init_data); | 2286 | sink = dc_sink_create(&sink_init_data); |
2285 | if (!sink) | 2287 | if (!sink) { |
2286 | DRM_ERROR("Failed to create sink!\n"); | 2288 | DRM_ERROR("Failed to create sink!\n"); |
2289 | return -ENOMEM; | ||
2290 | } | ||
2287 | 2291 | ||
2288 | sink->sink_signal = SIGNAL_TYPE_VIRTUAL; | 2292 | sink->sink_signal = SIGNAL_TYPE_VIRTUAL; |
2289 | aconnector->fake_enable = true; | 2293 | aconnector->fake_enable = true; |
2290 | 2294 | ||
2291 | aconnector->dc_sink = sink; | 2295 | aconnector->dc_sink = sink; |
2292 | aconnector->dc_link->local_sink = sink; | 2296 | aconnector->dc_link->local_sink = sink; |
2297 | |||
2298 | return 0; | ||
2293 | } | 2299 | } |
2294 | 2300 | ||
2295 | static struct dc_stream_state * | 2301 | static struct dc_stream_state * |
@@ -2323,7 +2329,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, | |||
2323 | if (aconnector->mst_port) | 2329 | if (aconnector->mst_port) |
2324 | goto stream_create_fail; | 2330 | goto stream_create_fail; |
2325 | 2331 | ||
2326 | create_fake_sink(aconnector); | 2332 | if (create_fake_sink(aconnector)) |
2333 | goto stream_create_fail; | ||
2327 | } | 2334 | } |
2328 | 2335 | ||
2329 | stream = dc_create_stream_for_sink(aconnector->dc_sink); | 2336 | stream = dc_create_stream_for_sink(aconnector->dc_sink); |
@@ -2423,6 +2430,8 @@ dm_crtc_duplicate_state(struct drm_crtc *crtc) | |||
2423 | return NULL; | 2430 | return NULL; |
2424 | 2431 | ||
2425 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 2432 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
2433 | if (!state) | ||
2434 | return NULL; | ||
2426 | 2435 | ||
2427 | __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); | 2436 | __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); |
2428 | 2437 | ||
@@ -3419,6 +3428,8 @@ create_i2c(struct ddc_service *ddc_service, | |||
3419 | struct amdgpu_i2c_adapter *i2c; | 3428 | struct amdgpu_i2c_adapter *i2c; |
3420 | 3429 | ||
3421 | i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL); | 3430 | i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL); |
3431 | if (!i2c) | ||
3432 | return NULL; | ||
3422 | i2c->base.owner = THIS_MODULE; | 3433 | i2c->base.owner = THIS_MODULE; |
3423 | i2c->base.class = I2C_CLASS_DDC; | 3434 | i2c->base.class = I2C_CLASS_DDC; |
3424 | i2c->base.dev.parent = &adev->pdev->dev; | 3435 | i2c->base.dev.parent = &adev->pdev->dev; |
@@ -3449,6 +3460,11 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, | |||
3449 | DRM_DEBUG_DRIVER("%s()\n", __func__); | 3460 | DRM_DEBUG_DRIVER("%s()\n", __func__); |
3450 | 3461 | ||
3451 | i2c = create_i2c(link->ddc, link->link_index, &res); | 3462 | i2c = create_i2c(link->ddc, link->link_index, &res); |
3463 | if (!i2c) { | ||
3464 | DRM_ERROR("Failed to create i2c adapter data\n"); | ||
3465 | return -ENOMEM; | ||
3466 | } | ||
3467 | |||
3452 | aconnector->i2c = i2c; | 3468 | aconnector->i2c = i2c; |
3453 | res = i2c_add_adapter(&i2c->base); | 3469 | res = i2c_add_adapter(&i2c->base); |
3454 | 3470 | ||
@@ -3888,7 +3904,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, | |||
3888 | DRM_ERROR("%s: acrtc %d, already busy\n", | 3904 | DRM_ERROR("%s: acrtc %d, already busy\n", |
3889 | __func__, | 3905 | __func__, |
3890 | acrtc_attach->crtc_id); | 3906 | acrtc_attach->crtc_id); |
3891 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
3892 | /* In commit tail framework this cannot happen */ | 3907 | /* In commit tail framework this cannot happen */ |
3893 | WARN_ON(1); | 3908 | WARN_ON(1); |
3894 | } | 3909 | } |
@@ -4712,10 +4727,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, | |||
4712 | goto fail; | 4727 | goto fail; |
4713 | } | 4728 | } |
4714 | 4729 | ||
4715 | /* Run this here since we want to validate the streams we created */ | 4730 | /* Run this here since we want to validate the streams we created */ |
4716 | ret = drm_atomic_helper_check_planes(dev, state); | 4731 | ret = drm_atomic_helper_check_planes(dev, state); |
4717 | if (ret) | 4732 | if (ret) |
4718 | goto fail; | 4733 | goto fail; |
4719 | 4734 | ||
4720 | /* Check scaling and underscan changes*/ | 4735 | /* Check scaling and underscan changes*/ |
4721 | /*TODO Removed scaling changes validation due to inability to commit | 4736 | /*TODO Removed scaling changes validation due to inability to commit |
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index be3b70d683e7..f42f8357b676 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | |||
@@ -199,8 +199,6 @@ struct amdgpu_framebuffer; | |||
199 | struct amdgpu_display_manager; | 199 | struct amdgpu_display_manager; |
200 | struct dc_validation_set; | 200 | struct dc_validation_set; |
201 | struct dc_plane_state; | 201 | struct dc_plane_state; |
202 | /* TODO rename to dc_stream_state */ | ||
203 | struct dc_stream; | ||
204 | 202 | ||
205 | struct dm_plane_state { | 203 | struct dm_plane_state { |
206 | struct drm_plane_state base; | 204 | struct drm_plane_state base; |
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 43e9a9959288..1ee1717f2e6f 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | |||
@@ -1373,7 +1373,7 @@ static enum bp_result get_firmware_info_v3_1( | |||
1373 | bp->cmd_tbl.get_smu_clock_info(bp) * 10; | 1373 | bp->cmd_tbl.get_smu_clock_info(bp) * 10; |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | return BP_RESULT_OK; | 1376 | return BP_RESULT_OK; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | static enum bp_result bios_parser_get_encoder_cap_info( | 1379 | static enum bp_result bios_parser_get_encoder_cap_info( |
diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c index 64eab356d336..ba68693758a7 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/command_table2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/command_table2.c | |||
@@ -373,15 +373,15 @@ static void init_set_crtc_timing(struct bios_parser *bp) | |||
373 | uint32_t dtd_version = | 373 | uint32_t dtd_version = |
374 | BIOS_CMD_TABLE_PARA_REVISION(setcrtc_usingdtdtiming); | 374 | BIOS_CMD_TABLE_PARA_REVISION(setcrtc_usingdtdtiming); |
375 | 375 | ||
376 | switch (dtd_version) { | 376 | switch (dtd_version) { |
377 | case 3: | 377 | case 3: |
378 | bp->cmd_tbl.set_crtc_timing = | 378 | bp->cmd_tbl.set_crtc_timing = |
379 | set_crtc_using_dtd_timing_v3; | 379 | set_crtc_using_dtd_timing_v3; |
380 | break; | 380 | break; |
381 | default: | 381 | default: |
382 | bp->cmd_tbl.set_crtc_timing = NULL; | 382 | bp->cmd_tbl.set_crtc_timing = NULL; |
383 | break; | 383 | break; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | static enum bp_result set_crtc_using_dtd_timing_v3( | 387 | static enum bp_result set_crtc_using_dtd_timing_v3( |
diff --git a/drivers/gpu/drm/amd/display/dc/bios/dce110/command_table_helper_dce110.c b/drivers/gpu/drm/amd/display/dc/bios/dce110/command_table_helper_dce110.c index 8049320e8b03..ca24154468c7 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/dce110/command_table_helper_dce110.c +++ b/drivers/gpu/drm/amd/display/dc/bios/dce110/command_table_helper_dce110.c | |||
@@ -358,7 +358,7 @@ static const struct command_table_helper command_table_helper_funcs = { | |||
358 | * const struct command_table_helper **h - [out] struct of functions | 358 | * const struct command_table_helper **h - [out] struct of functions |
359 | * | 359 | * |
360 | */ | 360 | */ |
361 | const struct command_table_helper *dal_cmd_tbl_helper_dce110_get_table() | 361 | const struct command_table_helper *dal_cmd_tbl_helper_dce110_get_table(void) |
362 | { | 362 | { |
363 | return &command_table_helper_funcs; | 363 | return &command_table_helper_funcs; |
364 | } | 364 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper2_dce112.c b/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper2_dce112.c index d342cdecba11..0237ae575068 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper2_dce112.c +++ b/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper2_dce112.c | |||
@@ -412,7 +412,7 @@ static const struct command_table_helper command_table_helper_funcs = { | |||
412 | * const struct command_table_helper **h - [out] struct of functions | 412 | * const struct command_table_helper **h - [out] struct of functions |
413 | * | 413 | * |
414 | */ | 414 | */ |
415 | const struct command_table_helper *dal_cmd_tbl_helper_dce112_get_table2() | 415 | const struct command_table_helper *dal_cmd_tbl_helper_dce112_get_table2(void) |
416 | { | 416 | { |
417 | return &command_table_helper_funcs; | 417 | return &command_table_helper_funcs; |
418 | } | 418 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper_dce112.c b/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper_dce112.c index 48e59963dad4..452034f83e4c 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper_dce112.c +++ b/drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper_dce112.c | |||
@@ -412,7 +412,7 @@ static const struct command_table_helper command_table_helper_funcs = { | |||
412 | * const struct command_table_helper **h - [out] struct of functions | 412 | * const struct command_table_helper **h - [out] struct of functions |
413 | * | 413 | * |
414 | */ | 414 | */ |
415 | const struct command_table_helper *dal_cmd_tbl_helper_dce112_get_table() | 415 | const struct command_table_helper *dal_cmd_tbl_helper_dce112_get_table(void) |
416 | { | 416 | { |
417 | return &command_table_helper_funcs; | 417 | return &command_table_helper_funcs; |
418 | } | 418 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/bios/dce80/command_table_helper_dce80.c b/drivers/gpu/drm/amd/display/dc/bios/dce80/command_table_helper_dce80.c index 295e16ef3f73..8b30b558cf1f 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/dce80/command_table_helper_dce80.c +++ b/drivers/gpu/drm/amd/display/dc/bios/dce80/command_table_helper_dce80.c | |||
@@ -348,7 +348,7 @@ static const struct command_table_helper command_table_helper_funcs = { | |||
348 | dal_cmd_table_helper_encoder_mode_bp_to_atom, | 348 | dal_cmd_table_helper_encoder_mode_bp_to_atom, |
349 | }; | 349 | }; |
350 | 350 | ||
351 | const struct command_table_helper *dal_cmd_tbl_helper_dce80_get_table() | 351 | const struct command_table_helper *dal_cmd_tbl_helper_dce80_get_table(void) |
352 | { | 352 | { |
353 | return &command_table_helper_funcs; | 353 | return &command_table_helper_funcs; |
354 | } | 354 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c index 4f8a95368ffc..6347712db834 100644 --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | |||
@@ -2794,6 +2794,8 @@ bool bw_calcs(struct dc_context *ctx, | |||
2794 | { | 2794 | { |
2795 | struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data), | 2795 | struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data), |
2796 | GFP_KERNEL); | 2796 | GFP_KERNEL); |
2797 | if (!data) | ||
2798 | return false; | ||
2797 | 2799 | ||
2798 | populate_initial_data(pipe, pipe_count, data); | 2800 | populate_initial_data(pipe, pipe_count, data); |
2799 | 2801 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c index e1515230c661..3dce35e66b09 100644 --- a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +++ b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | |||
@@ -1155,7 +1155,7 @@ static unsigned int dcn_find_normalized_clock_vdd_Level( | |||
1155 | unsigned factor = (ddr4_dram_factor_single_Channel * dc->dcn_soc->number_of_channels); | 1155 | unsigned factor = (ddr4_dram_factor_single_Channel * dc->dcn_soc->number_of_channels); |
1156 | 1156 | ||
1157 | if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vmax0p9*1000000/factor) { | 1157 | if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vmax0p9*1000000/factor) { |
1158 | vdd_level = dcn_bw_v_max0p91; | 1158 | vdd_level = dcn_bw_v_max0p91; |
1159 | BREAK_TO_DEBUGGER(); | 1159 | BREAK_TO_DEBUGGER(); |
1160 | } else if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vnom0p8*1000000/factor) { | 1160 | } else if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vnom0p8*1000000/factor) { |
1161 | vdd_level = dcn_bw_v_max0p9; | 1161 | vdd_level = dcn_bw_v_max0p9; |
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index a71392ffc46d..ce3c57b38bc0 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c | |||
@@ -952,6 +952,14 @@ bool dc_commit_planes_to_stream( | |||
952 | scaling_info = kcalloc(MAX_SURFACES, sizeof(struct dc_scaling_info), | 952 | scaling_info = kcalloc(MAX_SURFACES, sizeof(struct dc_scaling_info), |
953 | GFP_KERNEL); | 953 | GFP_KERNEL); |
954 | 954 | ||
955 | if (!flip_addr || !plane_info || !scaling_info) { | ||
956 | kfree(flip_addr); | ||
957 | kfree(plane_info); | ||
958 | kfree(scaling_info); | ||
959 | kfree(stream_update); | ||
960 | return false; | ||
961 | } | ||
962 | |||
955 | memset(updates, 0, sizeof(updates)); | 963 | memset(updates, 0, sizeof(updates)); |
956 | 964 | ||
957 | stream_update->src = dc_stream->src; | 965 | stream_update->src = dc_stream->src; |
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c index 572b885195c7..de04b95e103a 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c | |||
@@ -182,11 +182,11 @@ bool dc_stream_set_cursor_attributes( | |||
182 | 182 | ||
183 | if (NULL == stream) { | 183 | if (NULL == stream) { |
184 | dm_error("DC: dc_stream is NULL!\n"); | 184 | dm_error("DC: dc_stream is NULL!\n"); |
185 | return false; | 185 | return false; |
186 | } | 186 | } |
187 | if (NULL == attributes) { | 187 | if (NULL == attributes) { |
188 | dm_error("DC: attributes is NULL!\n"); | 188 | dm_error("DC: attributes is NULL!\n"); |
189 | return false; | 189 | return false; |
190 | } | 190 | } |
191 | 191 | ||
192 | if (attributes->address.quad_part == 0) { | 192 | if (attributes->address.quad_part == 0) { |
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c index 5aa2270f36fd..ade5b8ee9c3c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c | |||
@@ -145,7 +145,7 @@ void dc_gamma_release(struct dc_gamma **gamma) | |||
145 | *gamma = NULL; | 145 | *gamma = NULL; |
146 | } | 146 | } |
147 | 147 | ||
148 | struct dc_gamma *dc_create_gamma() | 148 | struct dc_gamma *dc_create_gamma(void) |
149 | { | 149 | { |
150 | struct dc_gamma *gamma = kzalloc(sizeof(*gamma), GFP_KERNEL); | 150 | struct dc_gamma *gamma = kzalloc(sizeof(*gamma), GFP_KERNEL); |
151 | 151 | ||
@@ -175,7 +175,7 @@ void dc_transfer_func_release(struct dc_transfer_func *tf) | |||
175 | kref_put(&tf->refcount, dc_transfer_func_free); | 175 | kref_put(&tf->refcount, dc_transfer_func_free); |
176 | } | 176 | } |
177 | 177 | ||
178 | struct dc_transfer_func *dc_create_transfer_func() | 178 | struct dc_transfer_func *dc_create_transfer_func(void) |
179 | { | 179 | { |
180 | struct dc_transfer_func *tf = kzalloc(sizeof(*tf), GFP_KERNEL); | 180 | struct dc_transfer_func *tf = kzalloc(sizeof(*tf), GFP_KERNEL); |
181 | 181 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c index 526ec5c8eafd..d882adf746a5 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c | |||
@@ -179,19 +179,19 @@ static void check_audio_bandwidth_hdmi( | |||
179 | /* Number of Audio Packets (multiplied by 10) per Line (for 8 ch number | 179 | /* Number of Audio Packets (multiplied by 10) per Line (for 8 ch number |
180 | * of Audio samples per line multiplied by 10 - Layout 1) | 180 | * of Audio samples per line multiplied by 10 - Layout 1) |
181 | */ | 181 | */ |
182 | samples /= 32; | 182 | samples /= 32; |
183 | samples *= crtc_info->v_active; | 183 | samples *= crtc_info->v_active; |
184 | /*Number of samples multiplied by 10, per second */ | 184 | /*Number of samples multiplied by 10, per second */ |
185 | samples *= crtc_info->refresh_rate; | 185 | samples *= crtc_info->refresh_rate; |
186 | /*Number of Audio samples per second */ | 186 | /*Number of Audio samples per second */ |
187 | samples /= 10; | 187 | samples /= 10; |
188 | 188 | ||
189 | /* @todo do it after deep color is implemented | 189 | /* @todo do it after deep color is implemented |
190 | * 8xx - deep color bandwidth scaling | 190 | * 8xx - deep color bandwidth scaling |
191 | * Extra bandwidth is avaliable in deep color b/c link runs faster than | 191 | * Extra bandwidth is avaliable in deep color b/c link runs faster than |
192 | * pixel rate. This has the effect of allowing more tmds characters to | 192 | * pixel rate. This has the effect of allowing more tmds characters to |
193 | * be transmitted during blank | 193 | * be transmitted during blank |
194 | */ | 194 | */ |
195 | 195 | ||
196 | switch (crtc_info->color_depth) { | 196 | switch (crtc_info->color_depth) { |
197 | case COLOR_DEPTH_888: | 197 | case COLOR_DEPTH_888: |
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c b/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c index 3691c7498d08..fd77df573b61 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c | |||
@@ -130,14 +130,14 @@ static void dce_dmcu_set_psr_enable(struct dmcu *dmcu, bool enable, bool wait) | |||
130 | if (wait == true) { | 130 | if (wait == true) { |
131 | for (retryCount = 0; retryCount <= 100; retryCount++) { | 131 | for (retryCount = 0; retryCount <= 100; retryCount++) { |
132 | dce_get_dmcu_psr_state(dmcu, &psr_state); | 132 | dce_get_dmcu_psr_state(dmcu, &psr_state); |
133 | if (enable) { | 133 | if (enable) { |
134 | if (psr_state != 0) | 134 | if (psr_state != 0) |
135 | break; | 135 | break; |
136 | } else { | 136 | } else { |
137 | if (psr_state == 0) | 137 | if (psr_state == 0) |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | udelay(10); | 140 | udelay(10); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index 399a5984ada3..1229a3315018 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | |||
@@ -775,8 +775,8 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx) | |||
775 | * connect DIG back_end to front_end while enable_stream and | 775 | * connect DIG back_end to front_end while enable_stream and |
776 | * disconnect them during disable_stream | 776 | * disconnect them during disable_stream |
777 | * BY this, it is logic clean to separate stream and link */ | 777 | * BY this, it is logic clean to separate stream and link */ |
778 | link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, | 778 | link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, |
779 | pipe_ctx->stream_res.stream_enc->id, true); | 779 | pipe_ctx->stream_res.stream_enc->id, true); |
780 | 780 | ||
781 | } | 781 | } |
782 | 782 | ||
@@ -1306,7 +1306,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( | |||
1306 | stream->timing.display_color_depth, | 1306 | stream->timing.display_color_depth, |
1307 | pipe_ctx->stream->signal); | 1307 | pipe_ctx->stream->signal); |
1308 | 1308 | ||
1309 | pipe_ctx->stream_res.opp->funcs->opp_program_fmt( | 1309 | pipe_ctx->stream_res.opp->funcs->opp_program_fmt( |
1310 | pipe_ctx->stream_res.opp, | 1310 | pipe_ctx->stream_res.opp, |
1311 | &stream->bit_depth_params, | 1311 | &stream->bit_depth_params, |
1312 | &stream->clamping); | 1312 | &stream->clamping); |
@@ -2594,21 +2594,21 @@ uint32_t dce110_get_min_vblank_time_us(const struct dc_state *context) | |||
2594 | uint8_t j; | 2594 | uint8_t j; |
2595 | uint32_t min_vertical_blank_time = -1; | 2595 | uint32_t min_vertical_blank_time = -1; |
2596 | 2596 | ||
2597 | for (j = 0; j < context->stream_count; j++) { | 2597 | for (j = 0; j < context->stream_count; j++) { |
2598 | struct dc_stream_state *stream = context->streams[j]; | 2598 | struct dc_stream_state *stream = context->streams[j]; |
2599 | uint32_t vertical_blank_in_pixels = 0; | 2599 | uint32_t vertical_blank_in_pixels = 0; |
2600 | uint32_t vertical_blank_time = 0; | 2600 | uint32_t vertical_blank_time = 0; |
2601 | 2601 | ||
2602 | vertical_blank_in_pixels = stream->timing.h_total * | 2602 | vertical_blank_in_pixels = stream->timing.h_total * |
2603 | (stream->timing.v_total | 2603 | (stream->timing.v_total |
2604 | - stream->timing.v_addressable); | 2604 | - stream->timing.v_addressable); |
2605 | 2605 | ||
2606 | vertical_blank_time = vertical_blank_in_pixels | 2606 | vertical_blank_time = vertical_blank_in_pixels |
2607 | * 1000 / stream->timing.pix_clk_khz; | 2607 | * 1000 / stream->timing.pix_clk_khz; |
2608 | 2608 | ||
2609 | if (min_vertical_blank_time > vertical_blank_time) | 2609 | if (min_vertical_blank_time > vertical_blank_time) |
2610 | min_vertical_blank_time = vertical_blank_time; | 2610 | min_vertical_blank_time = vertical_blank_time; |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | return min_vertical_blank_time; | 2613 | return min_vertical_blank_time; |
2614 | } | 2614 | } |
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c index 95d871be3a0b..2502182d5e82 100644 --- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c +++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c | |||
@@ -293,10 +293,9 @@ void dce120_timing_generator_tear_down_global_swap_lock( | |||
293 | FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_SYNC_SOURCE), 0, | 293 | FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_SYNC_SOURCE), 0, |
294 | FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_DELAY_SURFACE_UPDATE_PENDING), 0); | 294 | FD(DCP0_DCP_GSL_CONTROL__DCP_GSL_DELAY_SURFACE_UPDATE_PENDING), 0); |
295 | 295 | ||
296 | CRTC_REG_SET_2( | 296 | CRTC_REG_SET_2(CRTC0_CRTC_GSL_CONTROL, |
297 | CRTC0_CRTC_GSL_CONTROL, | 297 | CRTC_GSL_CHECK_LINE_NUM, 0, |
298 | CRTC_GSL_CHECK_LINE_NUM, 0, | 298 | CRTC_GSL_FORCE_DELAY, 0x2); /*TODO Why this value here ?*/ |
299 | CRTC_GSL_FORCE_DELAY, 0x2); /*TODO Why this value here ?*/ | ||
300 | } | 299 | } |
301 | 300 | ||
302 | /* Reset slave controllers on master VSync */ | 301 | /* Reset slave controllers on master VSync */ |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c index 7784001c3a17..40627c244bf5 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c | |||
@@ -124,7 +124,7 @@ static void program_gamut_remap( | |||
124 | const uint16_t *regval, | 124 | const uint16_t *regval, |
125 | enum gamut_remap_select select) | 125 | enum gamut_remap_select select) |
126 | { | 126 | { |
127 | uint16_t selection = 0; | 127 | uint16_t selection = 0; |
128 | struct color_matrices_reg gam_regs; | 128 | struct color_matrices_reg gam_regs; |
129 | 129 | ||
130 | if (regval == NULL || select == GAMUT_REMAP_BYPASS) { | 130 | if (regval == NULL || select == GAMUT_REMAP_BYPASS) { |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c index d911590d08bc..4c4bd72d4e40 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | |||
@@ -725,10 +725,8 @@ static void destruct(struct dcn10_resource_pool *pool) | |||
725 | } | 725 | } |
726 | } | 726 | } |
727 | 727 | ||
728 | for (i = 0; i < pool->base.stream_enc_count; i++) { | 728 | for (i = 0; i < pool->base.stream_enc_count; i++) |
729 | if (pool->base.stream_enc[i] != NULL) | 729 | kfree(pool->base.stream_enc[i]); |
730 | kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i])); | ||
731 | } | ||
732 | 730 | ||
733 | for (i = 0; i < pool->base.audio_count; i++) { | 731 | for (i = 0; i < pool->base.audio_count; i++) { |
734 | if (pool->base.audios[i]) | 732 | if (pool->base.audios[i]) |
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c index 1994865d4351..c7333cdf1802 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_timing_generator.c | |||
@@ -236,13 +236,10 @@ static void tgn10_program_timing( | |||
236 | if (tg->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT || | 236 | if (tg->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT || |
237 | tg->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT_MST || | 237 | tg->dlg_otg_param.signal == SIGNAL_TYPE_DISPLAY_PORT_MST || |
238 | tg->dlg_otg_param.signal == SIGNAL_TYPE_EDP) { | 238 | tg->dlg_otg_param.signal == SIGNAL_TYPE_EDP) { |
239 | v_init = asic_blank_start; | ||
240 | start_point = 1; | 239 | start_point = 1; |
241 | if (patched_crtc_timing.flags.INTERLACE == 1) | 240 | if (patched_crtc_timing.flags.INTERLACE == 1) |
242 | field_num = 1; | 241 | field_num = 1; |
243 | } | 242 | } |
244 | if (v_init < 0) | ||
245 | v_init = 0; | ||
246 | v_fp2 = 0; | 243 | v_fp2 = 0; |
247 | if (tg->dlg_otg_param.vstartup_start > asic_blank_end) | 244 | if (tg->dlg_otg_param.vstartup_start > asic_blank_end) |
248 | v_fp2 = tg->dlg_otg_param.vstartup_start > asic_blank_end; | 245 | v_fp2 = tg->dlg_otg_param.vstartup_start > asic_blank_end; |
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c index 0c4bbc10510d..81f9f3e34c10 100644 --- a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c +++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c | |||
@@ -318,7 +318,7 @@ static void process_channel_reply( | |||
318 | REG_GET(AUX_SW_DATA, | 318 | REG_GET(AUX_SW_DATA, |
319 | AUX_SW_DATA, &aux_sw_data_val); | 319 | AUX_SW_DATA, &aux_sw_data_val); |
320 | 320 | ||
321 | reply->data[i] = aux_sw_data_val; | 321 | reply->data[i] = aux_sw_data_val; |
322 | ++i; | 322 | ++i; |
323 | } | 323 | } |
324 | 324 | ||
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c index 1a5b3f70ddc9..56e25b3d65fd 100644 --- a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c +++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c | |||
@@ -133,13 +133,13 @@ static void release_engine( | |||
133 | safe_to_reset = (i2c_sw_status == 1); | 133 | safe_to_reset = (i2c_sw_status == 1); |
134 | } | 134 | } |
135 | 135 | ||
136 | if (safe_to_reset) | 136 | if (safe_to_reset) |
137 | REG_UPDATE_2( | 137 | REG_UPDATE_2( |
138 | DC_I2C_CONTROL, | 138 | DC_I2C_CONTROL, |
139 | DC_I2C_SOFT_RESET, 1, | 139 | DC_I2C_SOFT_RESET, 1, |
140 | DC_I2C_SW_STATUS_RESET, 1); | 140 | DC_I2C_SW_STATUS_RESET, 1); |
141 | else | 141 | else |
142 | REG_UPDATE(DC_I2C_CONTROL, DC_I2C_SW_STATUS_RESET, 1); | 142 | REG_UPDATE(DC_I2C_CONTROL, DC_I2C_SW_STATUS_RESET, 1); |
143 | 143 | ||
144 | /* HW I2c engine - clock gating feature */ | 144 | /* HW I2c engine - clock gating feature */ |
145 | if (!hw_engine->engine_keep_power_up_count) | 145 | if (!hw_engine->engine_keep_power_up_count) |
@@ -301,16 +301,16 @@ static bool process_transaction( | |||
301 | * For an I2C send operation, the LSB must be programmed to 0; | 301 | * For an I2C send operation, the LSB must be programmed to 0; |
302 | * for I2C receive operation, the LSB must be programmed to 1. */ | 302 | * for I2C receive operation, the LSB must be programmed to 1. */ |
303 | if (hw_engine->transaction_count == 0) { | 303 | if (hw_engine->transaction_count == 0) { |
304 | value = REG_SET_4(DC_I2C_DATA, 0, | 304 | value = REG_SET_4(DC_I2C_DATA, 0, |
305 | DC_I2C_DATA_RW, false, | 305 | DC_I2C_DATA_RW, false, |
306 | DC_I2C_DATA, request->address, | 306 | DC_I2C_DATA, request->address, |
307 | DC_I2C_INDEX, 0, | 307 | DC_I2C_INDEX, 0, |
308 | DC_I2C_INDEX_WRITE, 1); | 308 | DC_I2C_INDEX_WRITE, 1); |
309 | hw_engine->buffer_used_write = 0; | 309 | hw_engine->buffer_used_write = 0; |
310 | } else | 310 | } else |
311 | value = REG_SET_2(DC_I2C_DATA, 0, | 311 | value = REG_SET_2(DC_I2C_DATA, 0, |
312 | DC_I2C_DATA_RW, false, | 312 | DC_I2C_DATA_RW, false, |
313 | DC_I2C_DATA, request->address); | 313 | DC_I2C_DATA, request->address); |
314 | 314 | ||
315 | hw_engine->buffer_used_write++; | 315 | hw_engine->buffer_used_write++; |
316 | 316 | ||