sync with OpenBSD -current

This commit is contained in:
purplerain 2023-11-21 08:46:51 +00:00
parent c22b8a6120
commit 1abf3d5d6c
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
31 changed files with 490 additions and 161 deletions

View file

@ -197,18 +197,18 @@ static const struct pci_matchid amdgpu_devices[] = {
*/
/* GC 10.3.6, DCN 3.1.5, APU, Ryzen 7000 "Raphael" */
{0x1002, 0x164e },
{0x1002, 0x164e }, /* Radeon 610M */
/* GC 10.3.7, DCN 3.1.6, APU, Ryzen 7020 "Mendocino" */
{0x1002, 0x1506 },
{0x1002, 0x1506 }, /* Radeon 610M */
/* GC 11.0.0, DCN 3.2.0, dGPU, "Navi 31" */
{0x1002, 0x7448 }, /* Radeon Pro W7900 */
{0x1002, 0x744c }, /* Radeon RX 7900 XT/XTX/GRE */
{0x1002, 0x744c }, /* Radeon RX 7900 XT/XTX/GRE, 7900M */
{0x1002, 0x745e }, /* Radeon Pro W7800 */
/* GC 11.0.1, DCN 3.1.4, APU, Ryzen 7040 "Phoenix" */
{0x1002, 0x15bf },
{0x1002, 0x15bf }, /* Radeon 740M / 760M / 780M */
/* GC 11.0.2, DCN 3.2.1, dGPU, "Navi 33" */
{0x1002, 0x7480 }, /* Radeon RX 7600S, 7700S, 7600M XT,
@ -221,7 +221,7 @@ static const struct pci_matchid amdgpu_devices[] = {
{0x1002, 0x747e }, /* Radeon RX 7700 XT, 7800 XT */
/* GC 11.0.4, DCN 3.1.4, APU, "Phoenix 2" */
{0x1002, 0x15c8 },
{0x1002, 0x15c8 }, /* Radeon 740M */
/* GC 11.5.0, DCN 3.5.0, APU, linux >= 6.7 */
};

View file

@ -487,11 +487,11 @@ svm_range_validate_svm_bo(struct amdgpu_device *adev, struct svm_range *prange)
/* We need a new svm_bo. Spin-loop to wait for concurrent
* svm_range_bo_release to finish removing this range from
* its range list. After this, it is safe to reuse the
* svm_bo pointer and svm_bo_list head.
* its range list and set prange->svm_bo to null. After this,
* it is safe to reuse the svm_bo pointer and svm_bo_list head.
*/
while (!list_empty_careful(&prange->svm_bo_list))
;
while (!list_empty_careful(&prange->svm_bo_list) || prange->svm_bo)
cond_resched();
return false;
}

View file

@ -9630,16 +9630,27 @@ static void dm_get_oriented_plane_size(struct drm_plane_state *plane_state,
}
}
static void
dm_get_plane_scale(struct drm_plane_state *plane_state,
int *out_plane_scale_w, int *out_plane_scale_h)
{
int plane_src_w, plane_src_h;
dm_get_oriented_plane_size(plane_state, &plane_src_w, &plane_src_h);
*out_plane_scale_w = plane_state->crtc_w * 1000 / plane_src_w;
*out_plane_scale_h = plane_state->crtc_h * 1000 / plane_src_h;
}
static int dm_check_crtc_cursor(struct drm_atomic_state *state,
struct drm_crtc *crtc,
struct drm_crtc_state *new_crtc_state)
{
struct drm_plane *cursor = crtc->cursor, *underlying;
struct drm_plane *cursor = crtc->cursor, *plane, *underlying;
struct drm_plane_state *old_plane_state, *new_plane_state;
struct drm_plane_state *new_cursor_state, *new_underlying_state;
int i;
int cursor_scale_w, cursor_scale_h, underlying_scale_w, underlying_scale_h;
int cursor_src_w, cursor_src_h;
int underlying_src_w, underlying_src_h;
bool any_relevant_change = false;
/* On DCE and DCN there is no dedicated hardware cursor plane. We get a
* cursor per pipe but it's going to inherit the scaling and
@ -9647,13 +9658,50 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
* blending properties match the underlying planes'.
*/
new_cursor_state = drm_atomic_get_new_plane_state(state, cursor);
if (!new_cursor_state || !new_cursor_state->fb)
/* If no plane was enabled or changed scaling, no need to check again */
for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
int new_scale_w, new_scale_h, old_scale_w, old_scale_h;
if (!new_plane_state || !new_plane_state->fb || new_plane_state->crtc != crtc)
continue;
if (!old_plane_state || !old_plane_state->fb || old_plane_state->crtc != crtc) {
any_relevant_change = true;
break;
}
if (new_plane_state->fb == old_plane_state->fb &&
new_plane_state->crtc_w == old_plane_state->crtc_w &&
new_plane_state->crtc_h == old_plane_state->crtc_h)
continue;
dm_get_plane_scale(new_plane_state, &new_scale_w, &new_scale_h);
dm_get_plane_scale(old_plane_state, &old_scale_w, &old_scale_h);
if (new_scale_w != old_scale_w || new_scale_h != old_scale_h) {
any_relevant_change = true;
break;
}
}
if (!any_relevant_change)
return 0;
dm_get_oriented_plane_size(new_cursor_state, &cursor_src_w, &cursor_src_h);
cursor_scale_w = new_cursor_state->crtc_w * 1000 / cursor_src_w;
cursor_scale_h = new_cursor_state->crtc_h * 1000 / cursor_src_h;
new_cursor_state = drm_atomic_get_plane_state(state, cursor);
if (IS_ERR(new_cursor_state))
return PTR_ERR(new_cursor_state);
if (!new_cursor_state->fb)
return 0;
dm_get_plane_scale(new_cursor_state, &cursor_scale_w, &cursor_scale_h);
/* Need to check all enabled planes, even if this commit doesn't change
* their state
*/
i = drm_atomic_add_affected_planes(state, crtc);
if (i)
return i;
for_each_new_plane_in_state_reverse(state, underlying, new_underlying_state, i) {
/* Narrow down to non-cursor planes on the same CRTC as the cursor */
@ -9664,10 +9712,8 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,
if (!new_underlying_state->fb)
continue;
dm_get_oriented_plane_size(new_underlying_state,
&underlying_src_w, &underlying_src_h);
underlying_scale_w = new_underlying_state->crtc_w * 1000 / underlying_src_w;
underlying_scale_h = new_underlying_state->crtc_h * 1000 / underlying_src_h;
dm_get_plane_scale(new_underlying_state,
&underlying_scale_w, &underlying_scale_h);
if (cursor_scale_w != underlying_scale_w ||
cursor_scale_h != underlying_scale_h) {