forked from Minki/linux
7e1544ae4d
this bug happened when amdgpu load failed. [ 75.740951] BUG: unable to handle kernel paging request at 00000000000031c0 [ 75.748167] IP: [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu] [ 75.755774] PGD 0 [ 75.759185] Oops: 0000 [#1] SMP [ 75.762408] Modules linked in: amdgpu(OE-) ttm(OE) drm_kms_helper(OE) drm(OE) i2c_algo_bit(E) fb_sys_fops(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) rpcsec_gss_krb5(E) nfsv4(E) nfs(E) fscache(E) eeepc_wmi(E) asus_wmi(E) sparse_keymap(E) intel_rapl(E) snd_hda_codec_hdmi(E) snd_hda_codec_realtek(E) snd_hda_codec_generic(E) snd_hda_intel(E) snd_hda_codec(E) snd_hda_core(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) snd_hwdep(E) snd_pcm(E) snd_seq_midi(E) coretemp(E) kvm_intel(E) snd_seq_midi_event(E) snd_rawmidi(E) kvm(E) snd_seq(E) joydev(E) snd_seq_device(E) snd_timer(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) mei_me(E) ghash_clmulni_intel(E) snd(E) aesni_intel(E) mei(E) soundcore(E) aes_x86_64(E) shpchp(E) serio_raw(E) lrw(E) acpi_pad(E) gf128mul(E) glue_helper(E) ablk_helper(E) mac_hid(E) [ 75.835574] cryptd(E) parport_pc(E) ppdev(E) lp(E) nfsd(E) parport(E) auth_rpcgss(E) nfs_acl(E) lockd(E) grace(E) sunrpc(E) autofs4(E) hid_generic(E) usbhid(E) mxm_wmi(E) psmouse(E) e1000e(E) ptp(E) pps_core(E) ahci(E) libahci(E) wmi(E) video(E) i2c_hid(E) hid(E) [ 75.858489] CPU: 5 PID: 1603 Comm: rmmod Tainted: G OE 4.9.0-custom #2 [ 75.866183] Hardware name: System manufacturer System Product Name/Z170-A, BIOS 0901 08/31/2015 [ 75.875050] task: ffff88045d1bbb80 task.stack: ffffc90002de4000 [ 75.881094] RIP: 0010:[<ffffffffa064a0e0>] [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu] [ 75.891238] RSP: 0018:ffffc90002de7d48 EFLAGS: 00010286 [ 75.896648] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001 [ 75.903933] RDX: 0000000000000000 RSI: ffff88045d1bbb80 RDI: 0000000000000286 [ 75.911183] RBP: ffffc90002de7d50 R08: 0000000000000502 R09: 0000000000000004 [ 75.918449] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880464bf0000 [ 75.925675] R13: ffffffffa0853000 R14: 0000000000000000 R15: 0000564e44f88210 [ 75.932980] FS: 00007f13d5400700(0000) GS:ffff880476540000(0000) knlGS:0000000000000000 [ 75.941238] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 75.947088] CR2: 00000000000031c0 CR3: 000000045fd0b000 CR4: 00000000003406e0 [ 75.954332] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 75.961566] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 75.968834] Stack: [ 75.970881] ffff880464bf0000 ffffc90002de7d60 ffffffffa0636592 ffffc90002de7d80 [ 75.978454] ffffffffa059015f ffff880464bf0000 ffff880464bf0000 ffffc90002de7da8 [ 75.986076] ffffffffa0595216 ffff880464bf0000 ffff880460f4d000 ffffffffa0853000 [ 75.993692] Call Trace: [ 75.996177] [<ffffffffa0636592>] amdgpu_driver_lastclose_kms+0x12/0x20 [amdgpu] [ 76.003700] [<ffffffffa059015f>] drm_lastclose+0x2f/0xd0 [drm] [ 76.009777] [<ffffffffa0595216>] drm_dev_unregister+0x16/0xd0 [drm] [ 76.016255] [<ffffffffa0595944>] drm_put_dev+0x34/0x70 [drm] [ 76.022139] [<ffffffffa062f365>] amdgpu_pci_remove+0x15/0x20 [amdgpu] [ 76.028800] [<ffffffff81416499>] pci_device_remove+0x39/0xc0 [ 76.034661] [<ffffffff81531caa>] __device_release_driver+0x9a/0x140 [ 76.041121] [<ffffffff81531e58>] driver_detach+0xb8/0xc0 [ 76.046575] [<ffffffff81530c95>] bus_remove_driver+0x55/0xd0 [ 76.052401] [<ffffffff815325fc>] driver_unregister+0x2c/0x50 [ 76.058244] [<ffffffff81416289>] pci_unregister_driver+0x29/0x90 [ 76.064466] [<ffffffffa0596c5e>] drm_pci_exit+0x9e/0xb0 [drm] [ 76.070507] [<ffffffffa0796d71>] amdgpu_exit+0x1c/0x32 [amdgpu] [ 76.076609] [<ffffffff81104810>] SyS_delete_module+0x1a0/0x200 [ 76.082627] [<ffffffff810e2b1a>] ? rcu_eqs_enter.isra.36+0x4a/0x50 [ 76.089001] [<ffffffff8100392e>] do_syscall_64+0x6e/0x180 [ 76.094583] [<ffffffff817e1d2f>] entry_SYSCALL64_slow_path+0x25/0x25 [ 76.101114] Code: 94 c0 c3 31 c0 5d c3 0f 1f 40 00 0f 1f 44 00 00 55 31 c0 48 89 e5 53 48 89 fb 48 c7 c7 1d 21 84 a0 e8 ab 77 b3 e0 e8 fc 8b d7 e0 <48> 8b bb c0 31 00 00 48 85 ff 74 09 e8 ff eb fc ff 85 c0 75 03 [ 76.121432] RIP [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu] Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
446 lines
11 KiB
C
446 lines
11 KiB
C
/*
|
|
* Copyright © 2007 David Airlie
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including the next
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
* Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
* DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* Authors:
|
|
* David Airlie
|
|
*/
|
|
#include <linux/module.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/pm_runtime.h>
|
|
|
|
#include <drm/drmP.h>
|
|
#include <drm/drm_crtc.h>
|
|
#include <drm/drm_crtc_helper.h>
|
|
#include <drm/amdgpu_drm.h>
|
|
#include "amdgpu.h"
|
|
#include "cikd.h"
|
|
|
|
#include <drm/drm_fb_helper.h>
|
|
|
|
#include <linux/vga_switcheroo.h>
|
|
|
|
/* object hierarchy -
|
|
this contains a helper + a amdgpu fb
|
|
the helper contains a pointer to amdgpu framebuffer baseclass.
|
|
*/
|
|
struct amdgpu_fbdev {
|
|
struct drm_fb_helper helper;
|
|
struct amdgpu_framebuffer rfb;
|
|
struct amdgpu_device *adev;
|
|
};
|
|
|
|
static int
|
|
amdgpufb_open(struct fb_info *info, int user)
|
|
{
|
|
struct amdgpu_fbdev *rfbdev = info->par;
|
|
struct amdgpu_device *adev = rfbdev->adev;
|
|
int ret = pm_runtime_get_sync(adev->ddev->dev);
|
|
if (ret < 0 && ret != -EACCES) {
|
|
pm_runtime_mark_last_busy(adev->ddev->dev);
|
|
pm_runtime_put_autosuspend(adev->ddev->dev);
|
|
return ret;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static int
|
|
amdgpufb_release(struct fb_info *info, int user)
|
|
{
|
|
struct amdgpu_fbdev *rfbdev = info->par;
|
|
struct amdgpu_device *adev = rfbdev->adev;
|
|
|
|
pm_runtime_mark_last_busy(adev->ddev->dev);
|
|
pm_runtime_put_autosuspend(adev->ddev->dev);
|
|
return 0;
|
|
}
|
|
|
|
static struct fb_ops amdgpufb_ops = {
|
|
.owner = THIS_MODULE,
|
|
DRM_FB_HELPER_DEFAULT_OPS,
|
|
.fb_open = amdgpufb_open,
|
|
.fb_release = amdgpufb_release,
|
|
.fb_fillrect = drm_fb_helper_cfb_fillrect,
|
|
.fb_copyarea = drm_fb_helper_cfb_copyarea,
|
|
.fb_imageblit = drm_fb_helper_cfb_imageblit,
|
|
};
|
|
|
|
|
|
int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int cpp, bool tiled)
|
|
{
|
|
int aligned = width;
|
|
int pitch_mask = 0;
|
|
|
|
switch (cpp) {
|
|
case 1:
|
|
pitch_mask = 255;
|
|
break;
|
|
case 2:
|
|
pitch_mask = 127;
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
pitch_mask = 63;
|
|
break;
|
|
}
|
|
|
|
aligned += pitch_mask;
|
|
aligned &= ~pitch_mask;
|
|
return aligned * cpp;
|
|
}
|
|
|
|
static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
|
|
{
|
|
struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
|
|
int ret;
|
|
|
|
ret = amdgpu_bo_reserve(abo, true);
|
|
if (likely(ret == 0)) {
|
|
amdgpu_bo_kunmap(abo);
|
|
amdgpu_bo_unpin(abo);
|
|
amdgpu_bo_unreserve(abo);
|
|
}
|
|
drm_gem_object_unreference_unlocked(gobj);
|
|
}
|
|
|
|
static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
|
|
struct drm_mode_fb_cmd2 *mode_cmd,
|
|
struct drm_gem_object **gobj_p)
|
|
{
|
|
struct amdgpu_device *adev = rfbdev->adev;
|
|
struct drm_gem_object *gobj = NULL;
|
|
struct amdgpu_bo *abo = NULL;
|
|
bool fb_tiled = false; /* useful for testing */
|
|
u32 tiling_flags = 0;
|
|
int ret;
|
|
int aligned_size, size;
|
|
int height = mode_cmd->height;
|
|
u32 cpp;
|
|
|
|
cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0);
|
|
|
|
/* need to align pitch with crtc limits */
|
|
mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp,
|
|
fb_tiled);
|
|
|
|
height = ALIGN(mode_cmd->height, 8);
|
|
size = mode_cmd->pitches[0] * height;
|
|
aligned_size = ALIGN(size, PAGE_SIZE);
|
|
ret = amdgpu_gem_object_create(adev, aligned_size, 0,
|
|
AMDGPU_GEM_DOMAIN_VRAM,
|
|
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
|
|
AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
|
|
AMDGPU_GEM_CREATE_VRAM_CLEARED,
|
|
true, &gobj);
|
|
if (ret) {
|
|
pr_err("failed to allocate framebuffer (%d)\n", aligned_size);
|
|
return -ENOMEM;
|
|
}
|
|
abo = gem_to_amdgpu_bo(gobj);
|
|
|
|
if (fb_tiled)
|
|
tiling_flags = AMDGPU_TILING_SET(ARRAY_MODE, GRPH_ARRAY_2D_TILED_THIN1);
|
|
|
|
ret = amdgpu_bo_reserve(abo, false);
|
|
if (unlikely(ret != 0))
|
|
goto out_unref;
|
|
|
|
if (tiling_flags) {
|
|
ret = amdgpu_bo_set_tiling_flags(abo,
|
|
tiling_flags);
|
|
if (ret)
|
|
dev_err(adev->dev, "FB failed to set tiling flags\n");
|
|
}
|
|
|
|
|
|
ret = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, NULL);
|
|
if (ret) {
|
|
amdgpu_bo_unreserve(abo);
|
|
goto out_unref;
|
|
}
|
|
ret = amdgpu_bo_kmap(abo, NULL);
|
|
amdgpu_bo_unreserve(abo);
|
|
if (ret) {
|
|
goto out_unref;
|
|
}
|
|
|
|
*gobj_p = gobj;
|
|
return 0;
|
|
out_unref:
|
|
amdgpufb_destroy_pinned_object(gobj);
|
|
*gobj_p = NULL;
|
|
return ret;
|
|
}
|
|
|
|
static int amdgpufb_create(struct drm_fb_helper *helper,
|
|
struct drm_fb_helper_surface_size *sizes)
|
|
{
|
|
struct amdgpu_fbdev *rfbdev = (struct amdgpu_fbdev *)helper;
|
|
struct amdgpu_device *adev = rfbdev->adev;
|
|
struct fb_info *info;
|
|
struct drm_framebuffer *fb = NULL;
|
|
struct drm_mode_fb_cmd2 mode_cmd;
|
|
struct drm_gem_object *gobj = NULL;
|
|
struct amdgpu_bo *abo = NULL;
|
|
int ret;
|
|
unsigned long tmp;
|
|
|
|
mode_cmd.width = sizes->surface_width;
|
|
mode_cmd.height = sizes->surface_height;
|
|
|
|
if (sizes->surface_bpp == 24)
|
|
sizes->surface_bpp = 32;
|
|
|
|
mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
|
|
sizes->surface_depth);
|
|
|
|
ret = amdgpufb_create_pinned_object(rfbdev, &mode_cmd, &gobj);
|
|
if (ret) {
|
|
DRM_ERROR("failed to create fbcon object %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
abo = gem_to_amdgpu_bo(gobj);
|
|
|
|
/* okay we have an object now allocate the framebuffer */
|
|
info = drm_fb_helper_alloc_fbi(helper);
|
|
if (IS_ERR(info)) {
|
|
ret = PTR_ERR(info);
|
|
goto out;
|
|
}
|
|
|
|
info->par = rfbdev;
|
|
info->skip_vt_switch = true;
|
|
|
|
ret = amdgpu_framebuffer_init(adev->ddev, &rfbdev->rfb, &mode_cmd, gobj);
|
|
if (ret) {
|
|
DRM_ERROR("failed to initialize framebuffer %d\n", ret);
|
|
goto out;
|
|
}
|
|
|
|
fb = &rfbdev->rfb.base;
|
|
|
|
/* setup helper */
|
|
rfbdev->helper.fb = fb;
|
|
|
|
strcpy(info->fix.id, "amdgpudrmfb");
|
|
|
|
drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
|
|
|
|
info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
|
|
info->fbops = &amdgpufb_ops;
|
|
|
|
tmp = amdgpu_bo_gpu_offset(abo) - adev->mc.vram_start;
|
|
info->fix.smem_start = adev->mc.aper_base + tmp;
|
|
info->fix.smem_len = amdgpu_bo_size(abo);
|
|
info->screen_base = abo->kptr;
|
|
info->screen_size = amdgpu_bo_size(abo);
|
|
|
|
drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
|
|
|
|
/* setup aperture base/size for vesafb takeover */
|
|
info->apertures->ranges[0].base = adev->ddev->mode_config.fb_base;
|
|
info->apertures->ranges[0].size = adev->mc.aper_size;
|
|
|
|
/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
|
|
|
|
if (info->screen_base == NULL) {
|
|
ret = -ENOSPC;
|
|
goto out;
|
|
}
|
|
|
|
DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start);
|
|
DRM_INFO("vram apper at 0x%lX\n", (unsigned long)adev->mc.aper_base);
|
|
DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(abo));
|
|
DRM_INFO("fb depth is %d\n", fb->format->depth);
|
|
DRM_INFO(" pitch is %d\n", fb->pitches[0]);
|
|
|
|
vga_switcheroo_client_fb_set(adev->ddev->pdev, info);
|
|
return 0;
|
|
|
|
out:
|
|
if (abo) {
|
|
|
|
}
|
|
if (fb && ret) {
|
|
drm_gem_object_unreference_unlocked(gobj);
|
|
drm_framebuffer_unregister_private(fb);
|
|
drm_framebuffer_cleanup(fb);
|
|
kfree(fb);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
void amdgpu_fb_output_poll_changed(struct amdgpu_device *adev)
|
|
{
|
|
if (adev->mode_info.rfbdev)
|
|
drm_fb_helper_hotplug_event(&adev->mode_info.rfbdev->helper);
|
|
}
|
|
|
|
static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev)
|
|
{
|
|
struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
|
|
|
|
drm_fb_helper_unregister_fbi(&rfbdev->helper);
|
|
|
|
if (rfb->obj) {
|
|
amdgpufb_destroy_pinned_object(rfb->obj);
|
|
rfb->obj = NULL;
|
|
}
|
|
drm_fb_helper_fini(&rfbdev->helper);
|
|
drm_framebuffer_unregister_private(&rfb->base);
|
|
drm_framebuffer_cleanup(&rfb->base);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/** Sets the color ramps on behalf of fbcon */
|
|
static void amdgpu_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
|
|
u16 blue, int regno)
|
|
{
|
|
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
|
|
|
amdgpu_crtc->lut_r[regno] = red >> 6;
|
|
amdgpu_crtc->lut_g[regno] = green >> 6;
|
|
amdgpu_crtc->lut_b[regno] = blue >> 6;
|
|
}
|
|
|
|
/** Gets the color ramps on behalf of fbcon */
|
|
static void amdgpu_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
|
|
u16 *blue, int regno)
|
|
{
|
|
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
|
|
|
*red = amdgpu_crtc->lut_r[regno] << 6;
|
|
*green = amdgpu_crtc->lut_g[regno] << 6;
|
|
*blue = amdgpu_crtc->lut_b[regno] << 6;
|
|
}
|
|
|
|
static const struct drm_fb_helper_funcs amdgpu_fb_helper_funcs = {
|
|
.gamma_set = amdgpu_crtc_fb_gamma_set,
|
|
.gamma_get = amdgpu_crtc_fb_gamma_get,
|
|
.fb_probe = amdgpufb_create,
|
|
};
|
|
|
|
int amdgpu_fbdev_init(struct amdgpu_device *adev)
|
|
{
|
|
struct amdgpu_fbdev *rfbdev;
|
|
int bpp_sel = 32;
|
|
int ret;
|
|
|
|
/* don't init fbdev on hw without DCE */
|
|
if (!adev->mode_info.mode_config_initialized)
|
|
return 0;
|
|
|
|
/* don't init fbdev if there are no connectors */
|
|
if (list_empty(&adev->ddev->mode_config.connector_list))
|
|
return 0;
|
|
|
|
/* select 8 bpp console on low vram cards */
|
|
if (adev->mc.real_vram_size <= (32*1024*1024))
|
|
bpp_sel = 8;
|
|
|
|
rfbdev = kzalloc(sizeof(struct amdgpu_fbdev), GFP_KERNEL);
|
|
if (!rfbdev)
|
|
return -ENOMEM;
|
|
|
|
rfbdev->adev = adev;
|
|
adev->mode_info.rfbdev = rfbdev;
|
|
|
|
drm_fb_helper_prepare(adev->ddev, &rfbdev->helper,
|
|
&amdgpu_fb_helper_funcs);
|
|
|
|
ret = drm_fb_helper_init(adev->ddev, &rfbdev->helper,
|
|
AMDGPUFB_CONN_LIMIT);
|
|
if (ret) {
|
|
kfree(rfbdev);
|
|
return ret;
|
|
}
|
|
|
|
drm_fb_helper_single_add_all_connectors(&rfbdev->helper);
|
|
|
|
/* disable all the possible outputs/crtcs before entering KMS mode */
|
|
drm_helper_disable_unused_functions(adev->ddev);
|
|
|
|
drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel);
|
|
return 0;
|
|
}
|
|
|
|
void amdgpu_fbdev_fini(struct amdgpu_device *adev)
|
|
{
|
|
if (!adev->mode_info.rfbdev)
|
|
return;
|
|
|
|
amdgpu_fbdev_destroy(adev->ddev, adev->mode_info.rfbdev);
|
|
kfree(adev->mode_info.rfbdev);
|
|
adev->mode_info.rfbdev = NULL;
|
|
}
|
|
|
|
void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state)
|
|
{
|
|
if (adev->mode_info.rfbdev)
|
|
drm_fb_helper_set_suspend(&adev->mode_info.rfbdev->helper,
|
|
state);
|
|
}
|
|
|
|
int amdgpu_fbdev_total_size(struct amdgpu_device *adev)
|
|
{
|
|
struct amdgpu_bo *robj;
|
|
int size = 0;
|
|
|
|
if (!adev->mode_info.rfbdev)
|
|
return 0;
|
|
|
|
robj = gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.obj);
|
|
size += amdgpu_bo_size(robj);
|
|
return size;
|
|
}
|
|
|
|
bool amdgpu_fbdev_robj_is_fb(struct amdgpu_device *adev, struct amdgpu_bo *robj)
|
|
{
|
|
if (!adev->mode_info.rfbdev)
|
|
return false;
|
|
if (robj == gem_to_amdgpu_bo(adev->mode_info.rfbdev->rfb.obj))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
void amdgpu_fbdev_restore_mode(struct amdgpu_device *adev)
|
|
{
|
|
struct amdgpu_fbdev *afbdev;
|
|
struct drm_fb_helper *fb_helper;
|
|
int ret;
|
|
|
|
if (!adev)
|
|
return;
|
|
|
|
afbdev = adev->mode_info.rfbdev;
|
|
|
|
if (!afbdev)
|
|
return;
|
|
|
|
fb_helper = &afbdev->helper;
|
|
|
|
ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);
|
|
if (ret)
|
|
DRM_DEBUG("failed to restore crtc mode\n");
|
|
}
|