提交 e68d14dd 编写于 作者: D Daniel Stone 提交者: Alex Deucher

drm/amdgpu: Move GEM BO to drm_framebuffer

Since drm_framebuffer can now store GEM objects directly, place them
there rather than in our own subclass. As this makes the framebuffer
create_handle and destroy functions the same as the GEM framebuffer
helper, we can reuse those.
Acked-by: NAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: NDaniel Stone <daniels@collabora.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 9a0f0c9d
...@@ -2541,7 +2541,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) ...@@ -2541,7 +2541,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
/* unpin the front buffers and cursors */ /* unpin the front buffers and cursors */
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct amdgpu_framebuffer *rfb = to_amdgpu_framebuffer(crtc->primary->fb); struct drm_framebuffer *fb = crtc->primary->fb;
struct amdgpu_bo *robj; struct amdgpu_bo *robj;
if (amdgpu_crtc->cursor_bo) { if (amdgpu_crtc->cursor_bo) {
...@@ -2553,10 +2553,10 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon) ...@@ -2553,10 +2553,10 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
} }
} }
if (rfb == NULL || rfb->obj == NULL) { if (fb == NULL || fb->obj[0] == NULL) {
continue; continue;
} }
robj = gem_to_amdgpu_bo(rfb->obj); robj = gem_to_amdgpu_bo(fb->obj[0]);
/* don't unpin kernel fb objects */ /* don't unpin kernel fb objects */
if (!amdgpu_fbdev_robj_is_fb(adev, robj)) { if (!amdgpu_fbdev_robj_is_fb(adev, robj)) {
r = amdgpu_bo_reserve(robj, true); r = amdgpu_bo_reserve(robj, true);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h> #include <drm/drm_edid.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
static void amdgpu_display_flip_callback(struct dma_fence *f, 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,8 +152,6 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct amdgpu_device *adev = dev->dev_private; struct amdgpu_device *adev = dev->dev_private;
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct amdgpu_framebuffer *old_amdgpu_fb;
struct amdgpu_framebuffer *new_amdgpu_fb;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct amdgpu_flip_work *work; struct amdgpu_flip_work *work;
struct amdgpu_bo *new_abo; struct amdgpu_bo *new_abo;
...@@ -174,15 +173,13 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc, ...@@ -174,15 +173,13 @@ int amdgpu_display_crtc_page_flip_target(struct drm_crtc *crtc,
work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
/* schedule unpin of the old buffer */ /* schedule unpin of the old buffer */
old_amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); obj = crtc->primary->fb->obj[0];
obj = old_amdgpu_fb->obj;
/* take a reference to the old object */ /* take a reference to the old object */
work->old_abo = gem_to_amdgpu_bo(obj); work->old_abo = gem_to_amdgpu_bo(obj);
amdgpu_bo_ref(work->old_abo); amdgpu_bo_ref(work->old_abo);
new_amdgpu_fb = to_amdgpu_framebuffer(fb); obj = fb->obj[0];
obj = new_amdgpu_fb->obj;
new_abo = gem_to_amdgpu_bo(obj); new_abo = gem_to_amdgpu_bo(obj);
/* pin the new buffer */ /* pin the new buffer */
...@@ -482,28 +479,9 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, ...@@ -482,28 +479,9 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
return true; return true;
} }
static void amdgpu_display_user_framebuffer_destroy(struct drm_framebuffer *fb)
{
struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb);
drm_gem_object_put_unlocked(amdgpu_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(amdgpu_fb);
}
static int amdgpu_display_user_framebuffer_create_handle(
struct drm_framebuffer *fb,
struct drm_file *file_priv,
unsigned int *handle)
{
struct amdgpu_framebuffer *amdgpu_fb = to_amdgpu_framebuffer(fb);
return drm_gem_handle_create(file_priv, amdgpu_fb->obj, handle);
}
static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
.destroy = amdgpu_display_user_framebuffer_destroy, .destroy = drm_gem_fb_destroy,
.create_handle = amdgpu_display_user_framebuffer_create_handle, .create_handle = drm_gem_fb_create_handle,
}; };
uint32_t amdgpu_display_framebuffer_domains(struct amdgpu_device *adev) uint32_t amdgpu_display_framebuffer_domains(struct amdgpu_device *adev)
...@@ -526,11 +504,11 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, ...@@ -526,11 +504,11 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev,
struct drm_gem_object *obj) struct drm_gem_object *obj)
{ {
int ret; int ret;
rfb->obj = obj; rfb->base.obj[0] = obj;
drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd); drm_helper_mode_fill_fb_struct(dev, &rfb->base, mode_cmd);
ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
if (ret) { if (ret) {
rfb->obj = NULL; rfb->base.obj[0] = NULL;
return ret; return ret;
} }
return 0; return 0;
......
...@@ -292,9 +292,9 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfb ...@@ -292,9 +292,9 @@ static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfb
drm_fb_helper_unregister_fbi(&rfbdev->helper); drm_fb_helper_unregister_fbi(&rfbdev->helper);
if (rfb->obj) { if (rfb->base.obj[0]) {
amdgpufb_destroy_pinned_object(rfb->obj); amdgpufb_destroy_pinned_object(rfb->base.obj[0]);
rfb->obj = NULL; rfb->base.obj[0] = NULL;
drm_framebuffer_unregister_private(&rfb->base); drm_framebuffer_unregister_private(&rfb->base);
drm_framebuffer_cleanup(&rfb->base); drm_framebuffer_cleanup(&rfb->base);
} }
...@@ -377,7 +377,7 @@ int amdgpu_fbdev_total_size(struct amdgpu_device *adev) ...@@ -377,7 +377,7 @@ int amdgpu_fbdev_total_size(struct amdgpu_device *adev)
if (!adev->mode_info.rfbdev) if (!adev->mode_info.rfbdev)
return 0; return 0;
robj = gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.obj); robj = gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.base.obj[0]);
size += amdgpu_bo_size(robj); size += amdgpu_bo_size(robj);
return size; return size;
} }
...@@ -386,7 +386,7 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj) ...@@ -386,7 +386,7 @@ bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
{ {
if (!adev->mode_info.rfbdev) if (!adev->mode_info.rfbdev)
return false; return false;
if (robj == gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.obj)) if (robj == gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.base.obj[0]))
return true; return true;
return false; return false;
} }
...@@ -308,7 +308,6 @@ struct amdgpu_display_funcs { ...@@ -308,7 +308,6 @@ struct amdgpu_display_funcs {
struct amdgpu_framebuffer { struct amdgpu_framebuffer {
struct drm_framebuffer base; struct drm_framebuffer base;
struct drm_gem_object *obj;
/* caching for later use */ /* caching for later use */
uint64_t address; uint64_t address;
......
...@@ -1823,7 +1823,6 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1823,7 +1823,6 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct amdgpu_device *adev = dev->dev_private; struct amdgpu_device *adev = dev->dev_private;
struct amdgpu_framebuffer *amdgpu_fb;
struct drm_framebuffer *target_fb; struct drm_framebuffer *target_fb;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
...@@ -1842,18 +1841,15 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1842,18 +1841,15 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
return 0; return 0;
} }
if (atomic) { if (atomic)
amdgpu_fb = to_amdgpu_framebuffer(fb);
target_fb = fb; target_fb = fb;
} else { else
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
target_fb = crtc->primary->fb; target_fb = crtc->primary->fb;
}
/* If atomic, assume fb object is pinned & idle & fenced and /* If atomic, assume fb object is pinned & idle & fenced and
* just update base pointers * just update base pointers
*/ */
obj = amdgpu_fb->obj; obj = target_fb->obj[0];
abo = gem_to_amdgpu_bo(obj); abo = gem_to_amdgpu_bo(obj);
r = amdgpu_bo_reserve(abo, false); r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0)) if (unlikely(r != 0))
...@@ -2043,8 +2039,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2043,8 +2039,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0);
if (!atomic && fb && fb != crtc->primary->fb) { if (!atomic && fb && fb != crtc->primary->fb) {
amdgpu_fb = to_amdgpu_framebuffer(fb); abo = gem_to_amdgpu_bo(fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r != 0)) if (unlikely(r != 0))
return r; return r;
...@@ -2526,11 +2521,9 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc) ...@@ -2526,11 +2521,9 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
dce_v10_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); dce_v10_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) { if (crtc->primary->fb) {
int r; int r;
struct amdgpu_framebuffer *amdgpu_fb;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r)) if (unlikely(r))
DRM_ERROR("failed to reserve abo before unpin\n"); DRM_ERROR("failed to reserve abo before unpin\n");
......
...@@ -1862,7 +1862,6 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1862,7 +1862,6 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct amdgpu_device *adev = dev->dev_private; struct amdgpu_device *adev = dev->dev_private;
struct amdgpu_framebuffer *amdgpu_fb;
struct drm_framebuffer *target_fb; struct drm_framebuffer *target_fb;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
...@@ -1881,18 +1880,15 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1881,18 +1880,15 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
return 0; return 0;
} }
if (atomic) { if (atomic)
amdgpu_fb = to_amdgpu_framebuffer(fb);
target_fb = fb; target_fb = fb;
} else { else
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
target_fb = crtc->primary->fb; target_fb = crtc->primary->fb;
}
/* If atomic, assume fb object is pinned & idle & fenced and /* If atomic, assume fb object is pinned & idle & fenced and
* just update base pointers * just update base pointers
*/ */
obj = amdgpu_fb->obj; obj = target_fb->obj[0];
abo = gem_to_amdgpu_bo(obj); abo = gem_to_amdgpu_bo(obj);
r = amdgpu_bo_reserve(abo, false); r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0)) if (unlikely(r != 0))
...@@ -2082,8 +2078,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2082,8 +2078,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0);
if (!atomic && fb && fb != crtc->primary->fb) { if (!atomic && fb && fb != crtc->primary->fb) {
amdgpu_fb = to_amdgpu_framebuffer(fb); abo = gem_to_amdgpu_bo(fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r != 0)) if (unlikely(r != 0))
return r; return r;
...@@ -2601,11 +2596,9 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc) ...@@ -2601,11 +2596,9 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
dce_v11_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); dce_v11_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) { if (crtc->primary->fb) {
int r; int r;
struct amdgpu_framebuffer *amdgpu_fb;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r)) if (unlikely(r))
DRM_ERROR("failed to reserve abo before unpin\n"); DRM_ERROR("failed to reserve abo before unpin\n");
......
...@@ -1780,7 +1780,6 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1780,7 +1780,6 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct amdgpu_device *adev = dev->dev_private; struct amdgpu_device *adev = dev->dev_private;
struct amdgpu_framebuffer *amdgpu_fb;
struct drm_framebuffer *target_fb; struct drm_framebuffer *target_fb;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
...@@ -1798,18 +1797,15 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1798,18 +1797,15 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
return 0; return 0;
} }
if (atomic) { if (atomic)
amdgpu_fb = to_amdgpu_framebuffer(fb);
target_fb = fb; target_fb = fb;
} else { else
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
target_fb = crtc->primary->fb; target_fb = crtc->primary->fb;
}
/* If atomic, assume fb object is pinned & idle & fenced and /* If atomic, assume fb object is pinned & idle & fenced and
* just update base pointers * just update base pointers
*/ */
obj = amdgpu_fb->obj; obj = target_fb->obj[0];
abo = gem_to_amdgpu_bo(obj); abo = gem_to_amdgpu_bo(obj);
r = amdgpu_bo_reserve(abo, false); r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0)) if (unlikely(r != 0))
...@@ -1978,8 +1974,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1978,8 +1974,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0);
if (!atomic && fb && fb != crtc->primary->fb) { if (!atomic && fb && fb != crtc->primary->fb) {
amdgpu_fb = to_amdgpu_framebuffer(fb); abo = gem_to_amdgpu_bo(fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r != 0)) if (unlikely(r != 0))
return r; return r;
...@@ -2414,11 +2409,9 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc) ...@@ -2414,11 +2409,9 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc)
dce_v6_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); dce_v6_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) { if (crtc->primary->fb) {
int r; int r;
struct amdgpu_framebuffer *amdgpu_fb;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r)) if (unlikely(r))
DRM_ERROR("failed to reserve abo before unpin\n"); DRM_ERROR("failed to reserve abo before unpin\n");
......
...@@ -1754,7 +1754,6 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1754,7 +1754,6 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct amdgpu_device *adev = dev->dev_private; struct amdgpu_device *adev = dev->dev_private;
struct amdgpu_framebuffer *amdgpu_fb;
struct drm_framebuffer *target_fb; struct drm_framebuffer *target_fb;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
...@@ -1773,18 +1772,15 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1773,18 +1772,15 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
return 0; return 0;
} }
if (atomic) { if (atomic)
amdgpu_fb = to_amdgpu_framebuffer(fb);
target_fb = fb; target_fb = fb;
} else { else
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
target_fb = crtc->primary->fb; target_fb = crtc->primary->fb;
}
/* If atomic, assume fb object is pinned & idle & fenced and /* If atomic, assume fb object is pinned & idle & fenced and
* just update base pointers * just update base pointers
*/ */
obj = amdgpu_fb->obj; obj = target_fb->obj[0];
abo = gem_to_amdgpu_bo(obj); abo = gem_to_amdgpu_bo(obj);
r = amdgpu_bo_reserve(abo, false); r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0)) if (unlikely(r != 0))
...@@ -1955,8 +1951,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1955,8 +1951,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0); WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 0);
if (!atomic && fb && fb != crtc->primary->fb) { if (!atomic && fb && fb != crtc->primary->fb) {
amdgpu_fb = to_amdgpu_framebuffer(fb); abo = gem_to_amdgpu_bo(fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r != 0)) if (unlikely(r != 0))
return r; return r;
...@@ -2430,11 +2425,9 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc) ...@@ -2430,11 +2425,9 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
dce_v8_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); dce_v8_0_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) { if (crtc->primary->fb) {
int r; int r;
struct amdgpu_framebuffer *amdgpu_fb;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r)) if (unlikely(r))
DRM_ERROR("failed to reserve abo before unpin\n"); DRM_ERROR("failed to reserve abo before unpin\n");
......
...@@ -168,11 +168,9 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc) ...@@ -168,11 +168,9 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc)
dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); dce_virtual_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
if (crtc->primary->fb) { if (crtc->primary->fb) {
int r; int r;
struct amdgpu_framebuffer *amdgpu_fb;
struct amdgpu_bo *abo; struct amdgpu_bo *abo;
amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); abo = gem_to_amdgpu_bo(crtc->primary->fb->obj[0]);
abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
r = amdgpu_bo_reserve(abo, true); r = amdgpu_bo_reserve(abo, true);
if (unlikely(r)) if (unlikely(r))
DRM_ERROR("failed to reserve abo before unpin\n"); DRM_ERROR("failed to reserve abo before unpin\n");
......
...@@ -1819,7 +1819,7 @@ static bool fill_rects_from_plane_state(const struct drm_plane_state *state, ...@@ -1819,7 +1819,7 @@ static bool fill_rects_from_plane_state(const struct drm_plane_state *state,
static int get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb, static int get_fb_info(const struct amdgpu_framebuffer *amdgpu_fb,
uint64_t *tiling_flags) uint64_t *tiling_flags)
{ {
struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->obj); struct amdgpu_bo *rbo = gem_to_amdgpu_bo(amdgpu_fb->base.obj[0]);
int r = amdgpu_bo_reserve(rbo, false); int r = amdgpu_bo_reserve(rbo, false);
if (unlikely(r)) { if (unlikely(r)) {
...@@ -3028,8 +3028,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, ...@@ -3028,8 +3028,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
} }
afb = to_amdgpu_framebuffer(new_state->fb); afb = to_amdgpu_framebuffer(new_state->fb);
obj = new_state->fb->obj[0];
obj = afb->obj;
rbo = gem_to_amdgpu_bo(obj); rbo = gem_to_amdgpu_bo(obj);
adev = amdgpu_ttm_adev(rbo->tbo.bdev); adev = amdgpu_ttm_adev(rbo->tbo.bdev);
r = amdgpu_bo_reserve(rbo, false); r = amdgpu_bo_reserve(rbo, false);
...@@ -3093,14 +3092,12 @@ static void dm_plane_helper_cleanup_fb(struct drm_plane *plane, ...@@ -3093,14 +3092,12 @@ static void dm_plane_helper_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *old_state) struct drm_plane_state *old_state)
{ {
struct amdgpu_bo *rbo; struct amdgpu_bo *rbo;
struct amdgpu_framebuffer *afb;
int r; int r;
if (!old_state->fb) if (!old_state->fb)
return; return;
afb = to_amdgpu_framebuffer(old_state->fb); rbo = gem_to_amdgpu_bo(old_state->fb->obj[0]);
rbo = gem_to_amdgpu_bo(afb->obj);
r = amdgpu_bo_reserve(rbo, false); r = amdgpu_bo_reserve(rbo, false);
if (unlikely(r)) { if (unlikely(r)) {
DRM_ERROR("failed to reserve rbo before unpin\n"); DRM_ERROR("failed to reserve rbo before unpin\n");
...@@ -3896,7 +3893,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc, ...@@ -3896,7 +3893,7 @@ static void amdgpu_dm_do_flip(struct drm_crtc *crtc,
int r, vpos, hpos; int r, vpos, hpos;
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(fb); struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(fb);
struct amdgpu_bo *abo = gem_to_amdgpu_bo(afb->obj); struct amdgpu_bo *abo = gem_to_amdgpu_bo(fb->obj[0]);
struct amdgpu_device *adev = crtc->dev->dev_private; struct amdgpu_device *adev = crtc->dev->dev_private;
bool async_flip = (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; bool async_flip = (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
struct dc_flip_addrs addr = { {0} }; struct dc_flip_addrs addr = { {0} };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册