Page MenuHomeFreeBSD

vt(4): Add support to "downgrade" from eg. vt_fb to vt_vga
ClosedPublic

Authored by dumbbell on Aug 26 2014, 10:33 AM.

Details

Summary

The main purpose is to be able to unload a KMS driver. It's at least useful to me while working on the DRM stack, because it saves me a reboot :)

The patch introduces a new vt_driver callback, vd_reset_t, which is called after the old driver is stopped (old = fbd) and before the new driver is initialized (new = vt_vga). The callback is really implemented in drm_fb_helper.c where vga_pci_repost() is called (a new public function in vga_pci) to restore the VGA state.

Currently, the DRM code in HEAD seems to turn off the screen during shutdown, and re-POSTing the card isn't enough to turn it back on. The problem doesn't occur with my DRM 3.8 development branch (the console comes back with vt_vga and everything works).

Test Plan

kldload radeonkms
kldunload radeonkms

The console should still work

This can't be tested with i915kms which doesn't support unloading.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

dumbbell retitled this revision from to vt(4): Add support to "downgrade" from eg. vt_fb to vt_vga.
dumbbell updated this object.
dumbbell edited the test plan for this revision. (Show Details)
dumbbell added reviewers: emaste, ray.
emaste added a subscriber: jhb.

Adding jhb as a subscriber to look at vga_pci.c

sys/dev/drm2/radeon/radeon_fb.c
294 ↗(On Diff #1259)

Why do we need vga_pci_repost both here and in vt_kms_reset?

sys/dev/drm2/radeon/radeon_fb.c
294 ↗(On Diff #1259)

This is a mistake I don't have locally anymore. I still haven't published a revised patch (which is not finished anyway).

However, I only changed what calls what to address concerns expressed outside of Phabricator. The vga_pci_repost() function is unchanged and it needs review, because I'm not sure of what I do :)

I need to publish a newer version of the patch, but didn't have the time to do it so far. Once xserver 1.14 is committed, I will work on a few vt(4) changes, like D1004 and this one.

dumbbell edited edge metadata.

Each part should be properly isolated now. Only vt_vga nows about repost.

sys/dev/drm2/radeon/radeon_fb.c
295 ↗(On Diff #3163)

Note that the device_delete_child() is moved to a central function in drm_fb_helper.c in my DRM update branch. This avoids to do it in each driver. This function is missing in our current DRM and I didn't want to import new code for now.

sys/dev/vt/vt.h
130 ↗(On Diff #3163)

I would perhaps call these 'vd_prev_*' instead of 'vd_old_*'

Rename vd_old_* to vd_prev_*

Do you have any comment on this?

I'd like to commit it to HEAD to ease the work on i915.

Hi,

I need this for dev/usb/video/udl.c which unloads when the device detaches. Can you please commit it?

--HPS

Regenerated the patch after some changes in vt(4)

If there is no objection, I'm going to commit this patch as I need it to
work on DRM.

dumbbell updated this revision to Diff 4048.

Closed by commit rS279487 (authored by @dumbbell).