Page MenuHomeFreeBSD

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

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



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

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped

Event Timeline

dumbbell retitled this revision from to vt(4): Add support to "downgrade" from eg. vt_fb to vt_vga.Aug 26 2014, 10:33 AM
dumbbell updated this object.
dumbbell edited the test plan for this revision. (Show Details)
dumbbell added reviewers: emaste, ray.
dumbbell updated this revision to Diff 1259.
emaste edited edge metadata.Nov 10 2014, 3:35 PM
emaste added a subscriber: jhb.

Adding jhb as a subscriber to look at vga_pci.c

294 ↗(On Diff #1259)

Why do we need vga_pci_repost both here and in vt_kms_reset?

dumbbell added inline comments.Nov 10 2014, 3:48 PM
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 :)

What's next here?

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.Jan 13 2015, 11:40 PM
dumbbell updated this revision to Diff 3163.

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

dumbbell added inline comments.Jan 13 2015, 11:44 PM
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.

jhb added inline comments.Jan 14 2015, 2:00 PM
130 ↗(On Diff #3163)

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

dumbbell updated this revision to Diff 3176.Jan 14 2015, 9:52 PM

Rename vd_old_* to vd_prev_*

dumbbell added a reviewer: jhb.Feb 7 2015, 4:24 PM

Do you have any comment on this?

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


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


dumbbell updated this revision to Diff 4047.Mar 1 2015, 11:40 AM

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 closed this revision.Mar 1 2015, 12:48 PM
dumbbell updated this revision to Diff 4048.

Closed by commit rS279487 (authored by @dumbbell).