diff options
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 36 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 |
10 files changed, 40 insertions, 96 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index a53926580b3d..e0d6b1ddd213 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -2541,7 +2541,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) | |||
2541 | /* unpin the front buffers and cursors */ | 2541 | /* unpin the front buffers and cursors */ |
2542 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 2542 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
2543 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 2543 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
2544 | struct amdgpu_framebuffer *rfb = to_amdgpu_framebuffer(crtc->primary->fb); | 2544 | struct drm_framebuffer *fb = crtc->primary->fb; |
2545 | struct amdgpu_bo *robj; | 2545 | struct amdgpu_bo *robj; |
2546 | 2546 | ||
2547 | if (amdgpu_crtc->cursor_bo) { | 2547 | if (amdgpu_crtc->cursor_bo) { |
@@ -2553,10 +2553,10 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) | |||
2553 | } | 2553 | } |
2554 | } | 2554 | } |
2555 | 2555 | ||
2556 | if (rfb == NULL || rfb->obj == NULL) { | 2556 | if (fb == NULL || fb->obj[0] == NULL) { |
2557 | continue; | 2557 | continue; |
2558 | } | 2558 | } |
2559 | robj = gem_to_amdgpu_bo(rfb->obj); | 2559 | robj = gem_to_amdgpu_bo(fb->obj[0]); |
2560 | /* don't unpin kernel fb objects */ | 2560 | /* don't unpin kernel fb objects */ |
2561 | if (!amdgpu_fbdev_robj_is_fb(adev, robj)) { | 2561 | if (!amdgpu_fbdev_robj_is_fb(adev, robj)) { |
2562 | r = amdgpu_bo_reserve(robj, true); | 2562 | r = amdgpu_bo_reserve(robj, true); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index 93f700ab1bfb..b83ae998fe27 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | #include <drm/drm_crtc_helper.h> | 36 | #include <drm/drm_crtc_helper.h> |
37 | #include <drm/drm_edid.h> | 37 | #include <drm/drm_edid.h> |
38 | #include <drm/drm_gem_framebuffer_helper.h> | ||
38 | #include <drm/drm_fb_helper.h> | 39 | #include <drm/drm_fb_helper.h> |
39 | 40 | ||
40 | static void amdgpu_display_flip_callback(struct dma_fence *f, | 41 | static void amdgpu_display_flip_callback(struct dma_fence *f, |
@@ -151,8 +152,6 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, | |||
151 | struct drm_device *dev = crtc->dev; | 152 | struct drm_device *dev = crtc->dev; |
152 | struct amdgpu_device *adev = dev->dev_private; | 153 | struct amdgpu_device *adev = dev->dev_private; |
153 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 154 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
154 | struct amdgpu_framebuffer *old_amdgpu_fb; | ||
155 | struct amdgpu_framebuffer *new_amdgpu_fb; | ||
156 | struct drm_gem_object *obj; | 155 | struct drm_gem_object *obj; |
157 | struct amdgpu_flip_work *work; | 156 | struct amdgpu_flip_work *work; |
158 | struct amdgpu_bo *new_abo; | 157 | struct amdgpu_bo *new_abo; |
@@ -174,15 +173,13 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, | |||
174 | work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; | 173 | work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; |
175 | 174 | ||
176 | /* schedule unpin of the old buffer */ | 175 | /* schedule unpin of the old buffer */ |
177 | old_amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 176 | obj = crtc->primary->fb->obj[0]; |
178 | obj = old_amdgpu_fb->obj; | ||
179 | 177 | ||
180 | /* take a reference to the old object */ | 178 | /* take a reference to the old object */ |
181 | work->old_abo = gem_to_amdgpu_bo(obj); | 179 | work->old_abo = gem_to_amdgpu_bo(obj); |
182 | amdgpu_bo_ref(work->old_abo); | 180 | amdgpu_bo_ref(work->old_abo); |
183 | 181 | ||
184 | new_amdgpu_fb = to_amdgpu_framebuffer(fb); | 182 | obj = fb->obj[0]; |
185 | obj = new_amdgpu_fb->obj; | ||
186 | new_abo = gem_to_amdgpu_bo(obj); | 183 | new_abo = gem_to_amdgpu_bo(obj); |
187 | 184 | ||
188 | /* pin the new buffer */ | 185 | /* pin the new buffer */ |
@@ -482,28 +479,9 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, | |||
482 | return true; | 479 | return true; |
483 | } | 480 | } |
484 | 481 | ||
485 | static void amdgpu_display_user_framebuffer_destroy(struct drm_framebuffer *fb) | ||
486 | { | ||
487 | struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb); | ||
488 | |||
489 | drm_gem_object_put_unlocked(amdgpu_fb->obj); | ||
490 | drm_framebuffer_cleanup(fb); | ||
491 | kfree(amdgpu_fb); | ||
492 | } | ||
493 | |||
494 | static int amdgpu_display_user_framebuffer_create_handle( | ||
495 | struct drm_framebuffer *fb, | ||
496 | struct drm_file *file_priv, | ||
497 | unsigned int *handle) | ||
498 | { | ||
499 | struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb); | ||
500 | |||
501 | return drm_gem_handle_create(file_priv, amdgpu_fb->obj, handle); | ||
502 | } | ||
503 | |||
504 | static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { | 482 | static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { |
505 | .destroy = amdgpu_display_user_framebuffer_destroy, | 483 | .destroy = drm_gem_fb_destroy, |
506 | .create_handle = amdgpu_display_user_framebuffer_create_handle, | 484 | .create_handle = drm_gem_fb_create_handle, |
507 | }; | 485 | }; |
508 | 486 | ||
509 | uint32_t amdgpu_display_framebuffer_domains(struct amdgpu_device *adev) | 487 | uint32_t amdgpu_display_framebuffer_domains(struct amdgpu_device *adev) |
@@ -526,11 +504,11 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, | |||
526 | struct drm_gem_object *obj) | 504 | struct drm_gem_object *obj) |
527 | { | 505 | { |
528 | int ret; | 506 | int ret; |
529 | rfb->obj = obj; | 507 | rfb->base.obj[0] = obj; |
530 | drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd); | 508 | drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd); |
531 | ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); | 509 | ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); |
532 | if (ret) { | 510 | if (ret) { |
533 | rfb->obj = NULL; | 511 | rfb->base.obj[0] = NULL; |
534 | return ret; | 512 | return ret; |
535 | } | 513 | } |
536 | return 0; | 514 | return 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c index 12063019751b..ff89e84b34ce 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | |||
@@ -292,9 +292,9 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfb | |||
292 | 292 | ||
293 | drm_fb_helper_unregister_fbi(&rfbdev->helper); | 293 | drm_fb_helper_unregister_fbi(&rfbdev->helper); |
294 | 294 | ||
295 | if (rfb->obj) { | 295 | if (rfb->base.obj[0]) { |
296 | amdgpufb_destroy_pinned_object(rfb->obj); | 296 | amdgpufb_destroy_pinned_object(rfb->base.obj[0]); |
297 | rfb->obj = NULL; | 297 | rfb->base.obj[0] = NULL; |
298 | drm_framebuffer_unregister_private(&rfb->base); | 298 | drm_framebuffer_unregister_private(&rfb->base); |
299 | drm_framebuffer_cleanup(&rfb->base); | 299 | drm_framebuffer_cleanup(&rfb->base); |
300 | } | 300 | } |
@@ -377,7 +377,7 @@ int amdgpu_fbdev_total_size(struct amdgpu_device *adev) | |||
377 | if (!adev->mode_info.rfbdev) | 377 | if (!adev->mode_info.rfbdev) |
378 | return 0; | 378 | return 0; |
379 | 379 | ||
380 | robj = gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.obj); | 380 | robj = gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.base.obj[0]); |
381 | size += amdgpu_bo_size(robj); | 381 | size += amdgpu_bo_size(robj); |
382 | return size; | 382 | return size; |
383 | } | 383 | } |
@@ -386,7 +386,7 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj) | |||
386 | { | 386 | { |
387 | if (!adev->mode_info.rfbdev) | 387 | if (!adev->mode_info.rfbdev) |
388 | return false; | 388 | return false; |
389 | if (robj == gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.obj)) | 389 | if (robj == gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.base.obj[0])) |
390 | return true; | 390 | return true; |
391 | return false; | 391 | return false; |
392 | } | 392 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index d6416ee52e32..b9e9e8b02fb7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | |||
@@ -308,7 +308,6 @@ struct amdgpu_display_funcs { | |||
308 | 308 | ||
309 | struct amdgpu_framebuffer { | 309 | struct amdgpu_framebuffer { |
310 | struct drm_framebuffer base; | 310 | struct drm_framebuffer base; |
311 | struct drm_gem_object *obj; | ||
312 | 311 | ||
313 | /* caching for later use */ | 312 | /* caching for later use */ |
314 | uint64_t address; | 313 | uint64_t address; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 452f88ea46a2..ada241bfeee9 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | |||
@@ -1823,7 +1823,6 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1823 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 1823 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
1824 | struct drm_device *dev = crtc->dev; | 1824 | struct drm_device *dev = crtc->dev; |
1825 | struct amdgpu_device *adev = dev->dev_private; | 1825 | struct amdgpu_device *adev = dev->dev_private; |
1826 | struct amdgpu_framebuffer *amdgpu_fb; | ||
1827 | struct drm_framebuffer *target_fb; | 1826 | struct drm_framebuffer *target_fb; |
1828 | struct drm_gem_object *obj; | 1827 | struct drm_gem_object *obj; |
1829 | struct amdgpu_bo *abo; | 1828 | struct amdgpu_bo *abo; |
@@ -1842,18 +1841,15 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1842 | return 0; | 1841 | return 0; |
1843 | } | 1842 | } |
1844 | 1843 | ||
1845 | if (atomic) { | 1844 | if (atomic) |
1846 | amdgpu_fb = to_amdgpu_framebuffer(fb); | ||
1847 | target_fb = fb; | 1845 | target_fb = fb; |
1848 | } else { | 1846 | else |
1849 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | ||
1850 | target_fb = crtc->primary->fb; | 1847 | target_fb = crtc->primary->fb; |
1851 | } | ||
1852 | 1848 | ||
1853 | /* If atomic, assume fb object is pinned & idle & fenced and | 1849 | /* If atomic, assume fb object is pinned & idle & fenced and |
1854 | * just update base pointers | 1850 | * just update base pointers |
1855 | */ | 1851 | */ |
1856 | obj = amdgpu_fb->obj; | 1852 | obj = target_fb->obj[0]; |
1857 | abo = gem_to_amdgpu_bo(obj); | 1853 | abo = gem_to_amdgpu_bo(obj); |
1858 | r = amdgpu_bo_reserve(abo, false); | 1854 | r = amdgpu_bo_reserve(abo, false); |
1859 | if (unlikely(r != 0)) | 1855 | if (unlikely(r != 0)) |
@@ -2043,8 +2039,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2043 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); | 2039 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); |
2044 | 2040 | ||
2045 | if (!atomic && fb && fb != crtc->primary->fb) { | 2041 | if (!atomic && fb && fb != crtc->primary->fb) { |
2046 | amdgpu_fb = to_amdgpu_framebuffer(fb); | 2042 | abo = gem_to_amdgpu_bo(fb->obj[0]); |
2047 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
2048 | r = amdgpu_bo_reserve(abo, true); | 2043 | r = amdgpu_bo_reserve(abo, true); |
2049 | if (unlikely(r != 0)) | 2044 | if (unlikely(r != 0)) |
2050 | return r; | 2045 | return r; |
@@ -2526,11 +2521,9 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc) | |||
2526 | dce_v10_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 2521 | dce_v10_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
2527 | if (crtc->primary->fb) { | 2522 | if (crtc->primary->fb) { |
2528 | int r; | 2523 | int r; |
2529 | struct amdgpu_framebuffer *amdgpu_fb; | ||
2530 | struct amdgpu_bo *abo; | 2524 | struct amdgpu_bo *abo; |
2531 | 2525 | ||
2532 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 2526 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); |
2533 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
2534 | r = amdgpu_bo_reserve(abo, true); | 2527 | r = amdgpu_bo_reserve(abo, true); |
2535 | if (unlikely(r)) | 2528 | if (unlikely(r)) |
2536 | DRM_ERROR("failed to reserve abo before unpin\n"); | 2529 | DRM_ERROR("failed to reserve abo before unpin\n"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index a7c1c584a191..d3ae508b2a92 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | |||
@@ -1862,7 +1862,6 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1862 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 1862 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
1863 | struct drm_device *dev = crtc->dev; | 1863 | struct drm_device *dev = crtc->dev; |
1864 | struct amdgpu_device *adev = dev->dev_private; | 1864 | struct amdgpu_device *adev = dev->dev_private; |
1865 | struct amdgpu_framebuffer *amdgpu_fb; | ||
1866 | struct drm_framebuffer *target_fb; | 1865 | struct drm_framebuffer *target_fb; |
1867 | struct drm_gem_object *obj; | 1866 | struct drm_gem_object *obj; |
1868 | struct amdgpu_bo *abo; | 1867 | struct amdgpu_bo *abo; |
@@ -1881,18 +1880,15 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1881 | return 0; | 1880 | return 0; |
1882 | } | 1881 | } |
1883 | 1882 | ||
1884 | if (atomic) { | 1883 | if (atomic) |
1885 | amdgpu_fb = to_amdgpu_framebuffer(fb); | ||
1886 | target_fb = fb; | 1884 | target_fb = fb; |
1887 | } else { | 1885 | else |
1888 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | ||
1889 | target_fb = crtc->primary->fb; | 1886 | target_fb = crtc->primary->fb; |
1890 | } | ||
1891 | 1887 | ||
1892 | /* If atomic, assume fb object is pinned & idle & fenced and | 1888 | /* If atomic, assume fb object is pinned & idle & fenced and |
1893 | * just update base pointers | 1889 | * just update base pointers |
1894 | */ | 1890 | */ |
1895 | obj = amdgpu_fb->obj; | 1891 | obj = target_fb->obj[0]; |
1896 | abo = gem_to_amdgpu_bo(obj); | 1892 | abo = gem_to_amdgpu_bo(obj); |
1897 | r = amdgpu_bo_reserve(abo, false); | 1893 | r = amdgpu_bo_reserve(abo, false); |
1898 | if (unlikely(r != 0)) | 1894 | if (unlikely(r != 0)) |
@@ -2082,8 +2078,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2082 | WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); | 2078 | WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); |
2083 | 2079 | ||
2084 | if (!atomic && fb && fb != crtc->primary->fb) { | 2080 | if (!atomic && fb && fb != crtc->primary->fb) { |
2085 | amdgpu_fb = to_amdgpu_framebuffer(fb); | 2081 | abo = gem_to_amdgpu_bo(fb->obj[0]); |
2086 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
2087 | r = amdgpu_bo_reserve(abo, true); | 2082 | r = amdgpu_bo_reserve(abo, true); |
2088 | if (unlikely(r != 0)) | 2083 | if (unlikely(r != 0)) |
2089 | return r; | 2084 | return r; |
@@ -2601,11 +2596,9 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc) | |||
2601 | dce_v11_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 2596 | dce_v11_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
2602 | if (crtc->primary->fb) { | 2597 | if (crtc->primary->fb) { |
2603 | int r; | 2598 | int r; |
2604 | struct amdgpu_framebuffer *amdgpu_fb; | ||
2605 | struct amdgpu_bo *abo; | 2599 | struct amdgpu_bo *abo; |
2606 | 2600 | ||
2607 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 2601 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); |
2608 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
2609 | r = amdgpu_bo_reserve(abo, true); | 2602 | r = amdgpu_bo_reserve(abo, true); |
2610 | if (unlikely(r)) | 2603 | if (unlikely(r)) |
2611 | DRM_ERROR("failed to reserve abo before unpin\n"); | 2604 | DRM_ERROR("failed to reserve abo before unpin\n"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index 9f67b7fd3487..394cc1e8fe20 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | |||
@@ -1780,7 +1780,6 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1780 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 1780 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
1781 | struct drm_device *dev = crtc->dev; | 1781 | struct drm_device *dev = crtc->dev; |
1782 | struct amdgpu_device *adev = dev->dev_private; | 1782 | struct amdgpu_device *adev = dev->dev_private; |
1783 | struct amdgpu_framebuffer *amdgpu_fb; | ||
1784 | struct drm_framebuffer *target_fb; | 1783 | struct drm_framebuffer *target_fb; |
1785 | struct drm_gem_object *obj; | 1784 | struct drm_gem_object *obj; |
1786 | struct amdgpu_bo *abo; | 1785 | struct amdgpu_bo *abo; |
@@ -1798,18 +1797,15 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1798 | return 0; | 1797 | return 0; |
1799 | } | 1798 | } |
1800 | 1799 | ||
1801 | if (atomic) { | 1800 | if (atomic) |
1802 | amdgpu_fb = to_amdgpu_framebuffer(fb); | ||
1803 | target_fb = fb; | 1801 | target_fb = fb; |
1804 | } else { | 1802 | else |
1805 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | ||
1806 | target_fb = crtc->primary->fb; | 1803 | target_fb = crtc->primary->fb; |
1807 | } | ||
1808 | 1804 | ||
1809 | /* If atomic, assume fb object is pinned & idle & fenced and | 1805 | /* If atomic, assume fb object is pinned & idle & fenced and |
1810 | * just update base pointers | 1806 | * just update base pointers |
1811 | */ | 1807 | */ |
1812 | obj = amdgpu_fb->obj; | 1808 | obj = target_fb->obj[0]; |
1813 | abo = gem_to_amdgpu_bo(obj); | 1809 | abo = gem_to_amdgpu_bo(obj); |
1814 | r = amdgpu_bo_reserve(abo, false); | 1810 | r = amdgpu_bo_reserve(abo, false); |
1815 | if (unlikely(r != 0)) | 1811 | if (unlikely(r != 0)) |
@@ -1978,8 +1974,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1978 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); | 1974 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); |
1979 | 1975 | ||
1980 | if (!atomic && fb && fb != crtc->primary->fb) { | 1976 | if (!atomic && fb && fb != crtc->primary->fb) { |
1981 | amdgpu_fb = to_amdgpu_framebuffer(fb); | 1977 | abo = gem_to_amdgpu_bo(fb->obj[0]); |
1982 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
1983 | r = amdgpu_bo_reserve(abo, true); | 1978 | r = amdgpu_bo_reserve(abo, true); |
1984 | if (unlikely(r != 0)) | 1979 | if (unlikely(r != 0)) |
1985 | return r; | 1980 | return r; |
@@ -2414,11 +2409,9 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc) | |||
2414 | dce_v6_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 2409 | dce_v6_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
2415 | if (crtc->primary->fb) { | 2410 | if (crtc->primary->fb) { |
2416 | int r; | 2411 | int r; |
2417 | struct amdgpu_framebuffer *amdgpu_fb; | ||
2418 | struct amdgpu_bo *abo; | 2412 | struct amdgpu_bo *abo; |
2419 | 2413 | ||
2420 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 2414 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); |
2421 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
2422 | r = amdgpu_bo_reserve(abo, true); | 2415 | r = amdgpu_bo_reserve(abo, true); |
2423 | if (unlikely(r)) | 2416 | if (unlikely(r)) |
2424 | DRM_ERROR("failed to reserve abo before unpin\n"); | 2417 | DRM_ERROR("failed to reserve abo before unpin\n"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index f55422cbd77a..c9b9ab8f1b05 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | |||
@@ -1754,7 +1754,6 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1754 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); | 1754 | struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); |
1755 | struct drm_device *dev = crtc->dev; | 1755 | struct drm_device *dev = crtc->dev; |
1756 | struct amdgpu_device *adev = dev->dev_private; | 1756 | struct amdgpu_device *adev = dev->dev_private; |
1757 | struct amdgpu_framebuffer *amdgpu_fb; | ||
1758 | struct drm_framebuffer *target_fb; | 1757 | struct drm_framebuffer *target_fb; |
1759 | struct drm_gem_object *obj; | 1758 | struct drm_gem_object *obj; |
1760 | struct amdgpu_bo *abo; | 1759 | struct amdgpu_bo *abo; |
@@ -1773,18 +1772,15 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1773 | return 0; | 1772 | return 0; |
1774 | } | 1773 | } |
1775 | 1774 | ||
1776 | if (atomic) { | 1775 | if (atomic) |
1777 | amdgpu_fb = to_amdgpu_framebuffer(fb); | ||
1778 | target_fb = fb; | 1776 | target_fb = fb; |
1779 | } else { | 1777 | else |
1780 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | ||
1781 | target_fb = crtc->primary->fb; | 1778 | target_fb = crtc->primary->fb; |
1782 | } | ||
1783 | 1779 | ||
1784 | /* If atomic, assume fb object is pinned & idle & fenced and | 1780 | /* If atomic, assume fb object is pinned & idle & fenced and |
1785 | * just update base pointers | 1781 | * just update base pointers |
1786 | */ | 1782 | */ |
1787 | obj = amdgpu_fb->obj; | 1783 | obj = target_fb->obj[0]; |
1788 | abo = gem_to_amdgpu_bo(obj); | 1784 | abo = gem_to_amdgpu_bo(obj); |
1789 | r = amdgpu_bo_reserve(abo, false); | 1785 | r = amdgpu_bo_reserve(abo, false); |
1790 | if (unlikely(r != 0)) | 1786 | if (unlikely(r != 0)) |
@@ -1955,8 +1951,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1955 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); | 1951 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); |
1956 | 1952 | ||
1957 | if (!atomic && fb && fb != crtc->primary->fb) { | 1953 | if (!atomic && fb && fb != crtc->primary->fb) { |
1958 | amdgpu_fb = to_amdgpu_framebuffer(fb); | 1954 | abo = gem_to_amdgpu_bo(fb->obj[0]); |
1959 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
1960 | r = amdgpu_bo_reserve(abo, true); | 1955 | r = amdgpu_bo_reserve(abo, true); |
1961 | if (unlikely(r != 0)) | 1956 | if (unlikely(r != 0)) |
1962 | return r; | 1957 | return r; |
@@ -2430,11 +2425,9 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc) | |||
2430 | dce_v8_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 2425 | dce_v8_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
2431 | if (crtc->primary->fb) { | 2426 | if (crtc->primary->fb) { |
2432 | int r; | 2427 | int r; |
2433 | struct amdgpu_framebuffer *amdgpu_fb; | ||
2434 | struct amdgpu_bo *abo; | 2428 | struct amdgpu_bo *abo; |
2435 | 2429 | ||
2436 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 2430 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); |
2437 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
2438 | r = amdgpu_bo_reserve(abo, true); | 2431 | r = amdgpu_bo_reserve(abo, true); |
2439 | if (unlikely(r)) | 2432 | if (unlikely(r)) |
2440 | DRM_ERROR("failed to reserve abo before unpin\n"); | 2433 | DRM_ERROR("failed to reserve abo before unpin\n"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c index b51f05dc9582..89b2286a9d6b 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c | |||
@@ -168,11 +168,9 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc) | |||
168 | dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | 168 | dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); |
169 | if (crtc->primary->fb) { | 169 | if (crtc->primary->fb) { |
170 | int r; | 170 | int r; |
171 | struct amdgpu_framebuffer *amdgpu_fb; | ||
172 | struct amdgpu_bo *abo; | 171 | struct amdgpu_bo *abo; |
173 | 172 | ||
174 | amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 173 | abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]); |
175 | abo = gem_to_amdgpu_bo(amdgpu_fb->obj); | ||
176 | r = amdgpu_bo_reserve(abo, true); | 174 | r = amdgpu_bo_reserve(abo, true); |
177 | if (unlikely(r)) | 175 | if (unlikely(r)) |
178 | DRM_ERROR("failed to reserve abo before unpin\n"); | 176 | DRM_ERROR("failed to reserve abo before unpin\n"); |
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 3ff3905eee9a..077ee6793a1c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
@@ -1819,7 +1819,7 @@ static bool fill_rects_from_plane_state(const struct drm_plane_state *state, | |||
1819 | static int get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb, | 1819 | static int get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb, |
1820 | uint64_t *tiling_flags) | 1820 | uint64_t *tiling_flags) |
1821 | { | 1821 | { |
1822 | struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->obj); | 1822 | struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->base.obj[0]); |
1823 | int r = amdgpu_bo_reserve(rbo, false); | 1823 | int r = amdgpu_bo_reserve(rbo, false); |
1824 | 1824 | ||
1825 | if (unlikely(r)) { | 1825 | if (unlikely(r)) { |
@@ -3028,8 +3028,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, | |||
3028 | } | 3028 | } |
3029 | 3029 | ||
3030 | afb = to_amdgpu_framebuffer(new_state->fb); | 3030 | afb = to_amdgpu_framebuffer(new_state->fb); |
3031 | 3031 | obj = new_state->fb->obj[0]; | |
3032 | obj = afb->obj; | ||
3033 | rbo = gem_to_amdgpu_bo(obj); | 3032 | rbo = gem_to_amdgpu_bo(obj); |
3034 | adev = amdgpu_ttm_adev(rbo->tbo.bdev); | 3033 | adev = amdgpu_ttm_adev(rbo->tbo.bdev); |
3035 | r = amdgpu_bo_reserve(rbo, false); | 3034 | r = amdgpu_bo_reserve(rbo, false); |
@@ -3093,14 +3092,12 @@ static void dm_plane_helper_cleanup_fb(struct drm_plane *plane, | |||
3093 | struct drm_plane_state *old_state) | 3092 | struct drm_plane_state *old_state) |
3094 | { | 3093 | { |
3095 | struct amdgpu_bo *rbo; | 3094 | struct amdgpu_bo *rbo; |
3096 | struct amdgpu_framebuffer *afb; | ||
3097 | int r; | 3095 | int r; |
3098 | 3096 | ||
3099 | if (!old_state->fb) | 3097 | if (!old_state->fb) |
3100 | return; | 3098 | return; |
3101 | 3099 | ||
3102 | afb = to_amdgpu_framebuffer(old_state->fb); | 3100 | rbo = gem_to_amdgpu_bo(old_state->fb->obj[0]); |
3103 | rbo = gem_to_amdgpu_bo(afb->obj); | ||
3104 | r = amdgpu_bo_reserve(rbo, false); | 3101 | r = amdgpu_bo_reserve(rbo, false); |
3105 | if (unlikely(r)) { | 3102 | if (unlikely(r)) { |
3106 | DRM_ERROR("failed to reserve rbo before unpin\n"); | 3103 | DRM_ERROR("failed to reserve rbo before unpin\n"); |
@@ -3896,7 +3893,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, | |||
3896 | int r, vpos, hpos; | 3893 | int r, vpos, hpos; |
3897 | struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); | 3894 | struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); |
3898 | struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(fb); | 3895 | struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(fb); |
3899 | struct amdgpu_bo *abo = gem_to_amdgpu_bo(afb->obj); | 3896 | struct amdgpu_bo *abo = gem_to_amdgpu_bo(fb->obj[0]); |
3900 | struct amdgpu_device *adev = crtc->dev->dev_private; | 3897 | struct amdgpu_device *adev = crtc->dev->dev_private; |
3901 | bool async_flip = (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; | 3898 | bool async_flip = (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; |
3902 | struct dc_flip_addrs addr = { {0} }; | 3899 | struct dc_flip_addrs addr = { {0} }; |