Merge tag 'amd-drm-fixes-5.9-2020-08-12' of git://people.freedesktop.org/~agd5f/linux...
authorDave Airlie <airlied@redhat.com>
Wed, 19 Aug 2020 03:56:27 +0000 (13:56 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 19 Aug 2020 03:56:28 +0000 (13:56 +1000)
amd-drm-fixes-5.9-2020-08-12:

amdgpu:
- Fix allocation size
- SR-IOV fixes
- Vega20 SMU feature state caching fix
- Fix custom pptable handling
- Arcturus golden settings update
- Several display fixes

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200813033610.4008-1-alexander.deucher@amd.com
1  2 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

@@@ -2196,6 -2196,7 +2196,7 @@@ void amdgpu_dm_update_connector_after_d
  
                        drm_connector_update_edid_property(connector,
                                                           aconnector->edid);
+                       drm_add_edid_modes(connector, aconnector->edid);
  
                        if (aconnector->dc_link->aux_mode)
                                drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
@@@ -8787,38 -8788,20 +8788,38 @@@ static int amdgpu_dm_atomic_check(struc
                 * the same resource. If we have a new DC context as part of
                 * the DM atomic state from validation we need to free it and
                 * retain the existing one instead.
 +               *
 +               * Furthermore, since the DM atomic state only contains the DC
 +               * context and can safely be annulled, we can free the state
 +               * and clear the associated private object now to free
 +               * some memory and avoid a possible use-after-free later.
                 */
 -              struct dm_atomic_state *new_dm_state, *old_dm_state;
  
 -              new_dm_state = dm_atomic_get_new_state(state);
 -              old_dm_state = dm_atomic_get_old_state(state);
 +              for (i = 0; i < state->num_private_objs; i++) {
 +                      struct drm_private_obj *obj = state->private_objs[i].ptr;
  
 -              if (new_dm_state && old_dm_state) {
 -                      if (new_dm_state->context)
 -                              dc_release_state(new_dm_state->context);
 +                      if (obj->funcs == adev->dm.atomic_obj.funcs) {
 +                              int j = state->num_private_objs-1;
  
 -                      new_dm_state->context = old_dm_state->context;
 +                              dm_atomic_destroy_state(obj,
 +                                              state->private_objs[i].state);
 +
 +                              /* If i is not at the end of the array then the
 +                               * last element needs to be moved to where i was
 +                               * before the array can safely be truncated.
 +                               */
 +                              if (i != j)
 +                                      state->private_objs[i] =
 +                                              state->private_objs[j];
  
 -                      if (old_dm_state->context)
 -                              dc_retain_state(old_dm_state->context);
 +                              state->private_objs[j].ptr = NULL;
 +                              state->private_objs[j].state = NULL;
 +                              state->private_objs[j].old_state = NULL;
 +                              state->private_objs[j].new_state = NULL;
 +
 +                              state->num_private_objs = j;
 +                              break;
 +                      }
                }
        }