tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next-4.21
head:   22666cc1481ae3814d9c7718418cc4a3aa7d90c3
commit: eb3dc8978596a045f469f13bb13271a707623ecb [64/142] drm/amd/display: Use 
private obj helpers for dm_atomic_state

New smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4942 
amdgpu_dm_atomic_commit_tail() error: we previously assumed 'dc_state' could be 
null (see line 4927)

Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2979 
create_stream_for_sink() error: we previously assumed 'preferred_mode' could be 
null (see line 2962)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4998 
amdgpu_dm_atomic_commit_tail() error: we previously assumed 'dm_state' could be 
null (see line 4846)

git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git remote update radeon-alex
git checkout eb3dc8978596a045f469f13bb13271a707623ecb
vim +/dc_state +4942 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

e7b07ceef Harry Wentland      2017-08-10  4817  
b8592b484 Leo Li              2018-09-14  4818  /**
b8592b484 Leo Li              2018-09-14  4819   * 
amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation.
b8592b484 Leo Li              2018-09-14  4820   * @state: The atomic state to 
commit
b8592b484 Leo Li              2018-09-14  4821   *
b8592b484 Leo Li              2018-09-14  4822   * This will tell DC to commit 
the constructed DC state from atomic_check,
b8592b484 Leo Li              2018-09-14  4823   * programming the hardware. 
Any failures here implies a hardware failure, since
b8592b484 Leo Li              2018-09-14  4824   * atomic check should have 
filtered anything non-kosher.
b8592b484 Leo Li              2018-09-14  4825   */
7578ecda1 Alex Deucher        2017-10-10  4826  static void 
amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
e7b07ceef Harry Wentland      2017-08-10  4827  {
e7b07ceef Harry Wentland      2017-08-10  4828          struct drm_device *dev 
= state->dev;
e7b07ceef Harry Wentland      2017-08-10  4829          struct amdgpu_device 
*adev = dev->dev_private;
e7b07ceef Harry Wentland      2017-08-10  4830          struct 
amdgpu_display_manager *dm = &adev->dm;
e7b07ceef Harry Wentland      2017-08-10  4831          struct dm_atomic_state 
*dm_state;
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4832          struct dc_state 
*dc_state = NULL, *dc_state_temp = NULL;
e7b07ceef Harry Wentland      2017-08-10  4833          uint32_t i, j;
5cc6dcbd4 Leo (Sunpeng  Li    2017-10-12  4834)         struct drm_crtc *crtc;
0bc9706db Leo (Sunpeng  Li    2017-10-12  4835)         struct drm_crtc_state 
*old_crtc_state, *new_crtc_state;
e7b07ceef Harry Wentland      2017-08-10  4836          unsigned long flags;
e7b07ceef Harry Wentland      2017-08-10  4837          bool wait_for_vblank = 
true;
e7b07ceef Harry Wentland      2017-08-10  4838          struct drm_connector 
*connector;
c2cea7063 Leo (Sunpeng  Li    2017-10-12  4839)         struct 
drm_connector_state *old_con_state, *new_con_state;
54d765752 Leo (Sunpeng  Li    2017-10-12  4840)         struct dm_crtc_state 
*dm_old_crtc_state, *dm_new_crtc_state;
fe2a19652 Lyude Paul          2018-06-21  4841          int crtc_disable_count 
= 0;
e7b07ceef Harry Wentland      2017-08-10  4842  
e7b07ceef Harry Wentland      2017-08-10  4843          
drm_atomic_helper_update_legacy_modeset_state(dev, state);
e7b07ceef Harry Wentland      2017-08-10  4844  
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4845          dm_state = 
dm_atomic_get_new_state(state);
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4846          if (dm_state && 
dm_state->context) {
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4847                  dc_state = 
dm_state->context;
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4848          } else {
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4849                  /* No state 
changes, retain current state. */
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4850                  dc_state_temp = 
dc_create_state();
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4851                  
ASSERT(dc_state_temp);
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4852                  dc_state = 
dc_state_temp;
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4853                  
dc_resource_state_copy_construct_current(dm->dc, dc_state);
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4854          }

dc_state can't be NULL after this if statement.

e7b07ceef Harry Wentland      2017-08-10  4855  
e7b07ceef Harry Wentland      2017-08-10  4856          /* update changed items 
*/
0bc9706db Leo (Sunpeng  Li    2017-10-12  4857)         
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
e7b07ceef Harry Wentland      2017-08-10  4858                  struct 
amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
b830ebc91 Harry Wentland      2017-07-26  4859  
54d765752 Leo (Sunpeng  Li    2017-10-12  4860)                 
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
54d765752 Leo (Sunpeng  Li    2017-10-12  4861)                 
dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
e7b07ceef Harry Wentland      2017-08-10  4862  
f1ad2f5ef Harry Wentland      2017-09-12  4863                  
DRM_DEBUG_DRIVER(
e7b07ceef Harry Wentland      2017-08-10  4864                          
"amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "
e7b07ceef Harry Wentland      2017-08-10  4865                          
"planes_changed:%d, mode_changed:%d,active_changed:%d,"
e7b07ceef Harry Wentland      2017-08-10  4866                          
"connectors_changed:%d\n",
e7b07ceef Harry Wentland      2017-08-10  4867                          
acrtc->crtc_id,
0bc9706db Leo (Sunpeng  Li    2017-10-12  4868)                         
new_crtc_state->enable,
0bc9706db Leo (Sunpeng  Li    2017-10-12  4869)                         
new_crtc_state->active,
0bc9706db Leo (Sunpeng  Li    2017-10-12  4870)                         
new_crtc_state->planes_changed,
0bc9706db Leo (Sunpeng  Li    2017-10-12  4871)                         
new_crtc_state->mode_changed,
0bc9706db Leo (Sunpeng  Li    2017-10-12  4872)                         
new_crtc_state->active_changed,
0bc9706db Leo (Sunpeng  Li    2017-10-12  4873)                         
new_crtc_state->connectors_changed);
e7b07ceef Harry Wentland      2017-08-10  4874  
27b3f4fc9 Leo (Sunpeng  Li    2017-11-10  4875)                 /* Copy all 
transient state flags into dc state */
27b3f4fc9 Leo (Sunpeng  Li    2017-11-10  4876)                 if 
(dm_new_crtc_state->stream) {
27b3f4fc9 Leo (Sunpeng  Li    2017-11-10  4877)                         
amdgpu_dm_crtc_copy_transient_flags(&dm_new_crtc_state->base,
27b3f4fc9 Leo (Sunpeng  Li    2017-11-10  4878)                                 
                            dm_new_crtc_state->stream);
27b3f4fc9 Leo (Sunpeng  Li    2017-11-10  4879)                 }
27b3f4fc9 Leo (Sunpeng  Li    2017-11-10  4880) 
e7b07ceef Harry Wentland      2017-08-10  4881                  /* handles 
headless hotplug case, updating new_state and
e7b07ceef Harry Wentland      2017-08-10  4882                   * aconnector 
as needed
e7b07ceef Harry Wentland      2017-08-10  4883                   */
e7b07ceef Harry Wentland      2017-08-10  4884  
54d765752 Leo (Sunpeng  Li    2017-10-12  4885)                 if 
(modeset_required(new_crtc_state, dm_new_crtc_state->stream, 
dm_old_crtc_state->stream)) {
e7b07ceef Harry Wentland      2017-08-10  4886  
f1ad2f5ef Harry Wentland      2017-09-12  4887                          
DRM_DEBUG_DRIVER("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, 
acrtc);
e7b07ceef Harry Wentland      2017-08-10  4888  
54d765752 Leo (Sunpeng  Li    2017-10-12  4889)                         if 
(!dm_new_crtc_state->stream) {
e7b07ceef Harry Wentland      2017-08-10  4890                                  
/*
e7b07ceef Harry Wentland      2017-08-10  4891                                  
 * this could happen because of issues with
e7b07ceef Harry Wentland      2017-08-10  4892                                  
 * userspace notifications delivery.
e7b07ceef Harry Wentland      2017-08-10  4893                                  
 * In this case userspace tries to set mode on
1f6010a96 David Francis       2018-08-15  4894                                  
 * display which is disconnected in fact.
1f6010a96 David Francis       2018-08-15  4895                                  
 * dc_sink is NULL in this case on aconnector.
e7b07ceef Harry Wentland      2017-08-10  4896                                  
 * We expect reset mode will come soon.
e7b07ceef Harry Wentland      2017-08-10  4897                                  
 *
e7b07ceef Harry Wentland      2017-08-10  4898                                  
 * This can also happen when unplug is done
e7b07ceef Harry Wentland      2017-08-10  4899                                  
 * during resume sequence ended
e7b07ceef Harry Wentland      2017-08-10  4900                                  
 *
e7b07ceef Harry Wentland      2017-08-10  4901                                  
 * In this case, we want to pretend we still
e7b07ceef Harry Wentland      2017-08-10  4902                                  
 * have a sink to keep the pipe running so that
e7b07ceef Harry Wentland      2017-08-10  4903                                  
 * hw state is consistent with the sw state
e7b07ceef Harry Wentland      2017-08-10  4904                                  
 */
f1ad2f5ef Harry Wentland      2017-09-12  4905                                  
DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n",
e7b07ceef Harry Wentland      2017-08-10  4906                                  
                __func__, acrtc->base.base.id);
e7b07ceef Harry Wentland      2017-08-10  4907                                  
continue;
e7b07ceef Harry Wentland      2017-08-10  4908                          }
e7b07ceef Harry Wentland      2017-08-10  4909  
54d765752 Leo (Sunpeng  Li    2017-10-12  4910)                         if 
(dm_old_crtc_state->stream)
54d765752 Leo (Sunpeng  Li    2017-10-12  4911)                                 
remove_stream(adev, acrtc, dm_old_crtc_state->stream);
e7b07ceef Harry Wentland      2017-08-10  4912  
97028037a Lyude Paul          2018-06-04  4913                          
pm_runtime_get_noresume(dev->dev);
97028037a Lyude Paul          2018-06-04  4914  
e7b07ceef Harry Wentland      2017-08-10  4915                          
acrtc->enabled = true;
0bc9706db Leo (Sunpeng  Li    2017-10-12  4916)                         
acrtc->hw_mode = new_crtc_state->mode;
0bc9706db Leo (Sunpeng  Li    2017-10-12  4917)                         
crtc->hwmode = new_crtc_state->mode;
0bc9706db Leo (Sunpeng  Li    2017-10-12  4918)                 } else if 
(modereset_required(new_crtc_state)) {
f1ad2f5ef Harry Wentland      2017-09-12  4919                          
DRM_DEBUG_DRIVER("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, 
acrtc);
e7b07ceef Harry Wentland      2017-08-10  4920  
e7b07ceef Harry Wentland      2017-08-10  4921                          /* i.e. 
reset mode */
54d765752 Leo (Sunpeng  Li    2017-10-12  4922)                         if 
(dm_old_crtc_state->stream)
54d765752 Leo (Sunpeng  Li    2017-10-12  4923)                                 
remove_stream(adev, acrtc, dm_old_crtc_state->stream);
e7b07ceef Harry Wentland      2017-08-10  4924                  }
e7b07ceef Harry Wentland      2017-08-10  4925          } /* 
for_each_crtc_in_state() */
e7b07ceef Harry Wentland      2017-08-10  4926  
eb3dc8978 Nicholas Kazlauskas 2018-11-22 @4927          if (dc_state) {
                                                            ^^^^^^^^
So this check can be removed.

eb3dc8978 Nicholas Kazlauskas 2018-11-22  4928                  
dm_enable_per_frame_crtc_master_sync(dc_state);
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4929                  
WARN_ON(!dc_commit_state(dm->dc, dc_state));
fa2123dbc Mikita Lipski       2017-10-17  4930          }
e7b07ceef Harry Wentland      2017-08-10  4931  
0bc9706db Leo (Sunpeng  Li    2017-10-12  4932)         
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
e7b07ceef Harry Wentland      2017-08-10  4933                  struct 
amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
b830ebc91 Harry Wentland      2017-07-26  4934  
54d765752 Leo (Sunpeng  Li    2017-10-12  4935)                 
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
e7b07ceef Harry Wentland      2017-08-10  4936  
54d765752 Leo (Sunpeng  Li    2017-10-12  4937)                 if 
(dm_new_crtc_state->stream != NULL) {
e7b07ceef Harry Wentland      2017-08-10  4938                          const 
struct dc_stream_status *status =
54d765752 Leo (Sunpeng  Li    2017-10-12  4939)                                 
        dc_stream_get_status(dm_new_crtc_state->stream);
e7b07ceef Harry Wentland      2017-08-10  4940  
e7b07ceef Harry Wentland      2017-08-10  4941                          if 
(!status)
eb3dc8978 Nicholas Kazlauskas 2018-11-22 @4942                                  
status = dc_state_get_stream_status(dc_state,
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4943                                  
                                    dm_new_crtc_state->stream);
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4944  
eb3dc8978 Nicholas Kazlauskas 2018-11-22  4945                          if 
(!status)
54d765752 Leo (Sunpeng  Li    2017-10-12  4946)                                 
DC_ERR("got no status for stream %p on acrtc%p\n", dm_new_crtc_state->stream, 
acrtc);
e7b07ceef Harry Wentland      2017-08-10  4947                          else
e7b07ceef Harry Wentland      2017-08-10  4948                                  
acrtc->otg_inst = status->primary_otg_inst;
e7b07ceef Harry Wentland      2017-08-10  4949                  }
e7b07ceef Harry Wentland      2017-08-10  4950          }
e7b07ceef Harry Wentland      2017-08-10  4951  
c1ee92f94 David Francis       2018-11-26  4952          /* Handle scaling, 
underscan, and abm changes*/
c2cea7063 Leo (Sunpeng  Li    2017-10-12  4953)         
for_each_oldnew_connector_in_state(state, connector, old_con_state, 
new_con_state, i) {
54d765752 Leo (Sunpeng  Li    2017-10-12  4954)                 struct 
dm_connector_state *dm_new_con_state = to_dm_connector_state(new_con_state);
54d765752 Leo (Sunpeng  Li    2017-10-12  4955)                 struct 
dm_connector_state *dm_old_con_state = to_dm_connector_state(old_con_state);
54d765752 Leo (Sunpeng  Li    2017-10-12  4956)                 struct 
amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
e7b07ceef Harry Wentland      2017-08-10  4957                  struct 
dc_stream_status *status = NULL;
e7b07ceef Harry Wentland      2017-08-10  4958  
44d09c6a5 Harry Wentland      2018-03-15  4959                  if (acrtc) {
0bc9706db Leo (Sunpeng  Li    2017-10-12  4960)                         
new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base);
44d09c6a5 Harry Wentland      2018-03-15  4961                          
old_crtc_state = drm_atomic_get_old_crtc_state(state, &acrtc->base);
44d09c6a5 Harry Wentland      2018-03-15  4962                  }
0bc9706db Leo (Sunpeng  Li    2017-10-12  4963) 
e7b07ceef Harry Wentland      2017-08-10  4964                  /* Skip any 
modesets/resets */
0bc9706db Leo (Sunpeng  Li    2017-10-12  4965)                 if (!acrtc || 
drm_atomic_crtc_needs_modeset(new_crtc_state))
e7b07ceef Harry Wentland      2017-08-10  4966                          
continue;
e7b07ceef Harry Wentland      2017-08-10  4967  
e7b07ceef Harry Wentland      2017-08-10  4968  
54d765752 Leo (Sunpeng  Li    2017-10-12  4969)                 
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
c1ee92f94 David Francis       2018-11-26  4970                  
dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
c1ee92f94 David Francis       2018-11-26  4971  
c1ee92f94 David Francis       2018-11-26  4972                  /* Skip 
anything that is not scaling or underscan changes */
c1ee92f94 David Francis       2018-11-26  4973                  if 
(!is_scaling_state_different(dm_new_con_state, dm_old_con_state) &&
c1ee92f94 David Francis       2018-11-26  4974                                  
(dm_new_crtc_state->abm_level == dm_old_crtc_state->abm_level))
c1ee92f94 David Francis       2018-11-26  4975                          
continue;
e7b07ceef Harry Wentland      2017-08-10  4976  
54d765752 Leo (Sunpeng  Li    2017-10-12  4977)                 
update_stream_scaling_settings(&dm_new_con_state->base.crtc->mode,
54d765752 Leo (Sunpeng  Li    2017-10-12  4978)                                 
dm_new_con_state, (struct dc_stream_state *)dm_new_crtc_state->stream);
e7b07ceef Harry Wentland      2017-08-10  4979  
70e8ffc55 Harry Wentland      2017-11-10  4980                  if 
(!dm_new_crtc_state->stream)
70e8ffc55 Harry Wentland      2017-11-10  4981                          
continue;
70e8ffc55 Harry Wentland      2017-11-10  4982  
54d765752 Leo (Sunpeng  Li    2017-10-12  4983)                 status = 
dc_stream_get_status(dm_new_crtc_state->stream);
e7b07ceef Harry Wentland      2017-08-10  4984                  
WARN_ON(!status);
3be5262e3 Harry Wentland      2017-07-27  4985                  
WARN_ON(!status->plane_count);
e7b07ceef Harry Wentland      2017-08-10  4986  
98e6436d3 Anthony Koo         2018-08-21  4987                  
dm_new_crtc_state->stream->adjust = dm_new_crtc_state->adjust;
98e6436d3 Anthony Koo         2018-08-21  4988                  
dm_new_crtc_state->stream->vrr_infopacket = dm_new_crtc_state->vrr_infopacket;
c1ee92f94 David Francis       2018-11-26  4989                  
dm_new_crtc_state->stream->abm_level = dm_new_crtc_state->abm_level;
98e6436d3 Anthony Koo         2018-08-21  4990  
e7b07ceef Harry Wentland      2017-08-10  4991                  /*TODO How it 
works with MPO ?*/
44d09c6a5 Harry Wentland      2018-03-15  4992                  if 
(!commit_planes_to_stream(
e7b07ceef Harry Wentland      2017-08-10  4993                                  
dm->dc,
3be5262e3 Harry Wentland      2017-07-27  4994                                  
status->plane_states,
3be5262e3 Harry Wentland      2017-07-27  4995                                  
status->plane_count,
44d09c6a5 Harry Wentland      2018-03-15  4996                                  
dm_new_crtc_state,
44d09c6a5 Harry Wentland      2018-03-15  4997                                  
to_dm_crtc_state(old_crtc_state),
bc6828e0e Bhawanpreet Lakha   2017-09-12  4998                                  
dm_state->context))
e7b07ceef Harry Wentland      2017-08-10  4999                          
dm_error("%s: Failed to update stream scaling!\n", __func__);
e7b07ceef Harry Wentland      2017-08-10  5000          }
e7b07ceef Harry Wentland      2017-08-10  5001  
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5002)         
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5003)                         
new_crtc_state, i) {
e7b07ceef Harry Wentland      2017-08-10  5004                  /*
e7b07ceef Harry Wentland      2017-08-10  5005                   * loop to 
enable interrupts on newly arrived crtc
e7b07ceef Harry Wentland      2017-08-10  5006                   */
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5007)                 struct 
amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5008)                 bool 
modeset_needed;
b830ebc91 Harry Wentland      2017-07-26  5009  
fe2a19652 Lyude Paul          2018-06-21  5010                  if 
(old_crtc_state->active && !new_crtc_state->active)
fe2a19652 Lyude Paul          2018-06-21  5011                          
crtc_disable_count++;
fe2a19652 Lyude Paul          2018-06-21  5012  
54d765752 Leo (Sunpeng  Li    2017-10-12  5013)                 
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5014)                 
dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5015)                 modeset_needed 
= modeset_required(
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5016)                                 
new_crtc_state,
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5017)                                 
dm_new_crtc_state->stream,
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5018)                                 
dm_old_crtc_state->stream);
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5019) 
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5020)                 if 
(dm_new_crtc_state->stream == NULL || !modeset_needed)
e1fc2dca1 Leo (Sunpeng  Li    2017-10-18  5021)                         
continue;
e7b07ceef Harry Wentland      2017-08-10  5022  
e7b07ceef Harry Wentland      2017-08-10  5023                  
manage_dm_interrupts(adev, acrtc, true);
e7b07ceef Harry Wentland      2017-08-10  5024          }
e7b07ceef Harry Wentland      2017-08-10  5025  
e7b07ceef Harry Wentland      2017-08-10  5026          /* update planes when 
needed per crtc*/
5cc6dcbd4 Leo (Sunpeng  Li    2017-10-12  5027)         
for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) {
54d765752 Leo (Sunpeng  Li    2017-10-12  5028)                 
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
e7b07ceef Harry Wentland      2017-08-10  5029  
54d765752 Leo (Sunpeng  Li    2017-10-12  5030)                 if 
(dm_new_crtc_state->stream)
eb3dc8978 Nicholas Kazlauskas 2018-11-22  5031                          
amdgpu_dm_commit_planes(state, dc_state, dev,
eb3dc8978 Nicholas Kazlauskas 2018-11-22  5032                                  
                dm, crtc, &wait_for_vblank);
e7b07ceef Harry Wentland      2017-08-10  5033          }
e7b07ceef Harry Wentland      2017-08-10  5034  
e7b07ceef Harry Wentland      2017-08-10  5035  
e7b07ceef Harry Wentland      2017-08-10  5036          /*
e7b07ceef Harry Wentland      2017-08-10  5037           * send vblank event on 
all events not handled in flip and
e7b07ceef Harry Wentland      2017-08-10  5038           * mark consumed event 
for drm_atomic_helper_commit_hw_done
e7b07ceef Harry Wentland      2017-08-10  5039           */
e7b07ceef Harry Wentland      2017-08-10  5040          
spin_lock_irqsave(&adev->ddev->event_lock, flags);
0bc9706db Leo (Sunpeng  Li    2017-10-12  5041)         
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
e7b07ceef Harry Wentland      2017-08-10  5042  
0bc9706db Leo (Sunpeng  Li    2017-10-12  5043)                 if 
(new_crtc_state->event)
0bc9706db Leo (Sunpeng  Li    2017-10-12  5044)                         
drm_send_event_locked(dev, &new_crtc_state->event->base);
e7b07ceef Harry Wentland      2017-08-10  5045  
0bc9706db Leo (Sunpeng  Li    2017-10-12  5046)                 
new_crtc_state->event = NULL;
e7b07ceef Harry Wentland      2017-08-10  5047          }
e7b07ceef Harry Wentland      2017-08-10  5048          
spin_unlock_irqrestore(&adev->ddev->event_lock, flags);
e7b07ceef Harry Wentland      2017-08-10  5049  
e7b07ceef Harry Wentland      2017-08-10  5050  
e7b07ceef Harry Wentland      2017-08-10  5051          if (wait_for_vblank)
320a12743 Andrey Grodzovsky   2017-11-14  5052                  
drm_atomic_helper_wait_for_flip_done(dev, state);
e7b07ceef Harry Wentland      2017-08-10  5053  
717276b92 Shirish S           2018-09-24  5054          /*
717276b92 Shirish S           2018-09-24  5055           * FIXME:
717276b92 Shirish S           2018-09-24  5056           * Delay hw_done() 
until flip_done() is signaled. This is to block
717276b92 Shirish S           2018-09-24  5057           * another commit from 
freeing the CRTC state while we're still
717276b92 Shirish S           2018-09-24  5058           * waiting on flip_done.
717276b92 Shirish S           2018-09-24  5059           */
717276b92 Shirish S           2018-09-24  5060          
drm_atomic_helper_commit_hw_done(state);
717276b92 Shirish S           2018-09-24  5061  
e7b07ceef Harry Wentland      2017-08-10  5062          
drm_atomic_helper_cleanup_planes(dev, state);
97028037a Lyude Paul          2018-06-04  5063  
1f6010a96 David Francis       2018-08-15  5064          /*
1f6010a96 David Francis       2018-08-15  5065           * Finally, drop a 
runtime PM reference for each newly disabled CRTC,
97028037a Lyude Paul          2018-06-04  5066           * so we can put the 
GPU into runtime suspend if we're not driving any
97028037a Lyude Paul          2018-06-04  5067           * displays anymore
97028037a Lyude Paul          2018-06-04  5068           */
fe2a19652 Lyude Paul          2018-06-21  5069          for (i = 0; i < 
crtc_disable_count; i++)
97028037a Lyude Paul          2018-06-04  5070                  
pm_runtime_put_autosuspend(dev->dev);
fe2a19652 Lyude Paul          2018-06-21  5071          
pm_runtime_mark_last_busy(dev->dev);
eb3dc8978 Nicholas Kazlauskas 2018-11-22  5072  
eb3dc8978 Nicholas Kazlauskas 2018-11-22  5073          if (dc_state_temp)
eb3dc8978 Nicholas Kazlauskas 2018-11-22  5074                  
dc_release_state(dc_state_temp);
e7b07ceef Harry Wentland      2017-08-10  5075  }
e7b07ceef Harry Wentland      2017-08-10  5076  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to