From owner-svn-src-all@FreeBSD.ORG Thu Mar 6 18:31:02 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8DAD11B; Thu, 6 Mar 2014 18:31:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D16909CD; Thu, 6 Mar 2014 18:31:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s26IV2Dr037391; Thu, 6 Mar 2014 18:31:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s26IUvJG037341; Thu, 6 Mar 2014 18:30:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201403061830.s26IUvJG037341@svn.freebsd.org> From: John Baldwin Date: Thu, 6 Mar 2014 18:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r262861 - in stable/10: sys/amd64/conf sys/conf sys/dev/drm2 sys/dev/drm2/i915 sys/dev/drm2/radeon sys/dev/fb sys/dev/syscons sys/dev/vt sys/dev/vt/font sys/dev/vt/hw/fb sys/dev/vt/hw/o... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2014 18:31:03 -0000 Author: jhb Date: Thu Mar 6 18:30:56 2014 New Revision: 262861 URL: http://svnweb.freebsd.org/changeset/base/262861 Log: MFC 259016,259019,259049,259071,259102,259110,259129,259130,259178,259179, 259203,259221,259261,259532,259615,259650,259651,259667,259680,259727, 259761,259772,259776,259777,259830,259882,259915,260160,260449,260450, 260688,260888,260953,261269,261547,261551,261552,261553,261585: Merge the vt(4) driver (newcons) to stable/10. Approved by: ray Added: stable/10/sys/amd64/conf/VT - copied unchanged from r260888, head/sys/amd64/conf/VT stable/10/sys/dev/fb/fb_if.m - copied unchanged from r259016, head/sys/dev/fb/fb_if.m stable/10/sys/dev/fb/fbd.c - copied, changed from r259016, head/sys/dev/fb/fbd.c stable/10/sys/dev/vt/ - copied from r259016, head/sys/dev/vt/ stable/10/sys/i386/conf/VT - copied unchanged from r260888, head/sys/i386/conf/VT stable/10/sys/kern/subr_terminal.c - copied, changed from r259016, head/sys/kern/subr_terminal.c stable/10/sys/sys/terminal.h - copied, changed from r259016, head/sys/sys/terminal.h stable/10/tools/tools/vt/ - copied from r259019, head/tools/tools/vt/ Modified: stable/10/sys/conf/files stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.arm stable/10/sys/conf/files.i386 stable/10/sys/conf/files.powerpc stable/10/sys/conf/files.sparc64 stable/10/sys/conf/kmod.mk stable/10/sys/conf/options stable/10/sys/dev/drm2/drmP.h stable/10/sys/dev/drm2/drm_fb_helper.c stable/10/sys/dev/drm2/drm_os_freebsd.h stable/10/sys/dev/drm2/i915/i915_drv.c stable/10/sys/dev/drm2/i915/intel_fb.c stable/10/sys/dev/drm2/radeon/radeon.h stable/10/sys/dev/drm2/radeon/radeon_drv.c stable/10/sys/dev/drm2/radeon/radeon_fb.c stable/10/sys/dev/drm2/radeon/radeon_pm.c stable/10/sys/dev/syscons/scterm-teken.c stable/10/sys/dev/vt/font/vt_font_default.c stable/10/sys/dev/vt/font/vt_mouse_cursor.c stable/10/sys/dev/vt/hw/fb/vt_fb.c stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c (contents, props changed) stable/10/sys/dev/vt/hw/vga/vga.c stable/10/sys/dev/vt/hw/xboxfb/xboxfb.c stable/10/sys/dev/vt/vt.h stable/10/sys/dev/vt/vt_buf.c stable/10/sys/dev/vt/vt_consolectl.c stable/10/sys/dev/vt/vt_core.c stable/10/sys/dev/vt/vt_font.c stable/10/sys/dev/vt/vt_sysmouse.c stable/10/sys/modules/drm2/drm2/Makefile stable/10/sys/modules/drm2/i915kms/Makefile stable/10/sys/modules/drm2/radeonkms/Makefile stable/10/sys/sparc64/sparc64/machdep.c stable/10/sys/sys/consio.h stable/10/sys/sys/eventhandler.h stable/10/sys/sys/fbio.h stable/10/sys/sys/tty.h stable/10/sys/teken/demo/teken_demo.c stable/10/sys/teken/teken.c stable/10/sys/teken/teken.h stable/10/sys/teken/teken_subr.h stable/10/tools/tools/vt/fontcvt/fontcvt.c stable/10/tools/tools/vt/mkkfont/mkkfont.c stable/10/tools/tools/vt/setfont/setfont.c Directory Properties: stable/10/ (props changed) Copied: stable/10/sys/amd64/conf/VT (from r260888, head/sys/amd64/conf/VT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/amd64/conf/VT Thu Mar 6 18:30:56 2014 (r262861, copy of r260888, head/sys/amd64/conf/VT) @@ -0,0 +1,14 @@ +# VT -- kernel config using the vt(9) system console instead of legacy syscons +# +# For more information see https://wiki.freebsd.org/Newcons +# +# $FreeBSD$ + +include GENERIC +ident VT + +nodevice sc +nodevice vga + +device vt +device vt_vga Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/files Thu Mar 6 18:30:56 2014 (r262861) @@ -87,7 +87,7 @@ pccarddevs.h standard \ compile-with "${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" -teken_state.h optional sc \ +teken_state.h optional sc | vt \ dependency "$S/teken/gensequences $S/teken/sequences" \ compile-with "${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \ no-obj no-implicit-rule before-depend \ @@ -1400,7 +1400,9 @@ dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex pccard dev/exca/exca.c optional cbb dev/fatm/if_fatm.c optional fatm pci -dev/fb/splash.c optional splash +dev/fb/fbd.c optional fbd | vt +dev/fb/fb_if.m standard +dev/fb/splash.c optional sc splash dev/fdt/fdt_common.c optional fdt dev/fdt/fdt_ic_if.m optional fdt dev/fdt/fdt_pci.c optional fdt pci @@ -2500,6 +2502,17 @@ dev/vge/if_vge.c optional vge dev/vkbd/vkbd.c optional vkbd dev/vr/if_vr.c optional vr pci +dev/vt/colors/vt_termcolors.c optional vt +dev/vt/font/vt_font_default.c optional vt +dev/vt/font/vt_mouse_cursor.c optional vt +dev/vt/hw/fb/vt_fb.c optional vt +dev/vt/hw/vga/vga.c optional vt vt_vga +dev/vt/logo/logo_freebsd.c optional vt splash +dev/vt/vt_buf.c optional vt +dev/vt/vt_consolectl.c optional vt +dev/vt/vt_core.c optional vt +dev/vt/vt_font.c optional vt +dev/vt/vt_sysmouse.c optional vt dev/vte/if_vte.c optional vte pci dev/vx/if_vx.c optional vx dev/vx/if_vx_eisa.c optional vx eisa @@ -2936,6 +2949,7 @@ kern/subr_sleepqueue.c standard kern/subr_smp.c standard kern/subr_stack.c optional ddb | stack | ktr kern/subr_taskqueue.c standard +kern/subr_terminal.c optional vt kern/subr_trap.c standard kern/subr_turnstile.c standard kern/subr_uio.c standard @@ -3842,7 +3856,7 @@ security/mac_portacl/mac_portacl.c optio security/mac_seeotheruids/mac_seeotheruids.c optional mac_seeotheruids security/mac_stub/mac_stub.c optional mac_stub security/mac_test/mac_test.c optional mac_test -teken/teken.c optional sc +teken/teken.c optional sc | vt ufs/ffs/ffs_alloc.c optional ffs ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_inode.c optional ffs Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/files.amd64 Thu Mar 6 18:30:56 2014 (r262861) @@ -241,7 +241,7 @@ dev/hyperv/vmbus/hv_connection.c optio dev/hyperv/vmbus/hv_hv.c optional hyperv dev/hyperv/vmbus/hv_ring_buffer.c optional hyperv dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c optional hyperv -dev/kbd/kbd.c optional atkbd | sc | ukbd +dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/lindev/full.c optional lindev dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci Modified: stable/10/sys/conf/files.arm ============================================================================== --- stable/10/sys/conf/files.arm Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/files.arm Thu Mar 6 18:30:56 2014 (r262861) @@ -62,7 +62,7 @@ crypto/blowfish/bf_enc.c optional crypto crypto/des/des_enc.c optional crypto | ipsec | netsmb dev/fb/fb.c optional sc dev/hwpmc/hwpmc_arm.c optional hwpmc -dev/kbd/kbd.c optional sc +dev/kbd/kbd.c optional sc | vt dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/files.i386 Thu Mar 6 18:30:56 2014 (r262861) @@ -249,7 +249,7 @@ dev/ipmi/ipmi_smbios.c optional ipmi dev/ipmi/ipmi_ssif.c optional ipmi smbus dev/ipmi/ipmi_pci.c optional ipmi pci dev/ipmi/ipmi_linux.c optional ipmi compat_linux -dev/kbd/kbd.c optional atkbd | sc | ukbd +dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/le/if_le_isa.c optional le isa dev/lindev/full.c optional lindev dev/lindev/lindev.c optional lindev @@ -293,6 +293,7 @@ dev/viawd/viawd.c optional viawd dev/vmware/vmxnet3/if_vmx.c optional vmx dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard +dev/vt/hw/xboxfb/xboxfb.c optional vt_xboxfb dev/wbwd/wbwd.c optional wbwd dev/wpi/if_wpi.c optional wpi dev/isci/isci.c optional isci Modified: stable/10/sys/conf/files.powerpc ============================================================================== --- stable/10/sys/conf/files.powerpc Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/files.powerpc Thu Mar 6 18:30:56 2014 (r262861) @@ -35,7 +35,7 @@ dev/iicbus/ad7417.c optional ad7417 pow dev/iicbus/ds1631.c optional ds1631 powermac dev/iicbus/ds1775.c optional ds1775 powermac dev/iicbus/max6690.c optional max6690 powermac -dev/kbd/kbd.c optional sc +dev/kbd/kbd.c optional sc | vt dev/nand/nfc_fsl.c optional nand mpc85xx # ofw can be either aim or fdt: fdt case handled in files. aim only powerpc specific. dev/ofw/openfirm.c optional aim @@ -65,6 +65,7 @@ dev/tsec/if_tsec_fdt.c optional tsec fd dev/uart/uart_cpu_fdt.c optional uart fdt dev/uart/uart_cpu_powerpc.c optional uart aim dev/usb/controller/ehci_fsl.c optional ehci mpc85xx +dev/vt/hw/ofwfb/ofwfb.c optional vt aim kern/kern_clocksource.c standard kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr Modified: stable/10/sys/conf/files.sparc64 ============================================================================== --- stable/10/sys/conf/files.sparc64 Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/files.sparc64 Thu Mar 6 18:30:56 2014 (r262861) @@ -39,7 +39,7 @@ dev/fb/fb.c optional sc dev/fb/gallant12x22.c optional sc dev/fb/machfb.c optional machfb sc dev/hwpmc/hwpmc_sparc64.c optional hwpmc -dev/kbd/kbd.c optional atkbd | sc | ukbd +dev/kbd/kbd.c optional atkbd | sc | ukbd | vt dev/le/if_le_lebuffer.c optional le sbus dev/le/if_le_ledma.c optional le sbus dev/le/lebuffer_sbus.c optional le sbus @@ -59,7 +59,8 @@ dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc dev/uart/uart_cpu_sparc64.c optional uart -dev/uart/uart_kbd_sun.c optional uart sc +dev/uart/uart_kbd_sun.c optional uart sc | vt +dev/vt/hw/ofwfb/ofwfb.c optional vt kern/kern_clocksource.c standard kern/subr_dummy_vdso_tc.c standard kern/syscalls.c optional ktr Modified: stable/10/sys/conf/kmod.mk ============================================================================== --- stable/10/sys/conf/kmod.mk Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/kmod.mk Thu Mar 6 18:30:56 2014 (r262861) @@ -340,7 +340,7 @@ CFLAGS+= ${CONF_CFLAGS} MFILES?= dev/acpica/acpi_if.m dev/acpi_support/acpi_wmi_if.m \ dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \ - dev/gpio/gpio_if.m dev/gpio/gpiobus_if.m \ + dev/fb/fb_if.m dev/gpio/gpio_if.m dev/gpio/gpiobus_if.m \ dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \ dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \ dev/mii/miibus_if.m dev/mvs/mvs_if.m dev/ofw/ofw_bus_if.m \ Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/conf/options Thu Mar 6 18:30:56 2014 (r262861) @@ -732,8 +732,10 @@ SAFE_DEBUG opt_safe.h SAFE_NO_RNG opt_safe.h SAFE_RNDTEST opt_safe.h -# syscons options +# syscons/vt options MAXCONS opt_syscons.h +VT_FB_DEFAULT_WIDTH opt_syscons.h +VT_FB_DEFAULT_HEIGHT opt_syscons.h SC_ALT_MOUSE_IMAGE opt_syscons.h SC_CUT_SPACES2TABS opt_syscons.h SC_CUT_SEPCHARS opt_syscons.h @@ -756,6 +758,9 @@ SC_NORM_REV_ATTR opt_syscons.h SC_PIXEL_MODE opt_syscons.h SC_RENDER_DEBUG opt_syscons.h SC_TWOBUTTON_MOUSE opt_syscons.h +DEV_SC opt_syscons.h +DEV_VT opt_syscons.h + # teken terminal emulator options TEKEN_CONS25 opt_teken.h Modified: stable/10/sys/dev/drm2/drmP.h ============================================================================== --- stable/10/sys/dev/drm2/drmP.h Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/drmP.h Thu Mar 6 18:30:56 2014 (r262861) @@ -113,6 +113,7 @@ struct drm_device; #include "opt_compat.h" #include "opt_drm.h" +#include "opt_syscons.h" #ifdef DRM_DEBUG #undef DRM_DEBUG #define DRM_DEBUG_DEFAULT_ON 1 Modified: stable/10/sys/dev/drm2/drm_fb_helper.c ============================================================================== --- stable/10/sys/dev/drm2/drm_fb_helper.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/drm_fb_helper.c Thu Mar 6 18:30:56 2014 (r262861) @@ -36,6 +36,41 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(__FreeBSD__) +struct vt_kms_softc { + struct drm_fb_helper *fb_helper; + struct task fb_mode_task; +}; + +static fb_enter_t vt_kms_postswitch; +static void vt_restore_fbdev_mode(void *, int); + +/* Call restore out of vt(9) locks. */ +static void +vt_restore_fbdev_mode(void *arg, int pending) +{ + struct drm_fb_helper *fb_helper; + struct vt_kms_softc *sc; + + sc = (struct vt_kms_softc *)arg; + fb_helper = sc->fb_helper; + sx_xlock(&fb_helper->dev->mode_config.mutex); + drm_fb_helper_restore_fbdev_mode(fb_helper); + sx_xunlock(&fb_helper->dev->mode_config.mutex); +} + +static int +vt_kms_postswitch(void *arg) +{ + struct vt_kms_softc *sc; + + sc = (struct vt_kms_softc *)arg; + taskqueue_enqueue_fast(taskqueue_thread, &sc->fb_mode_task); + + return (0); +} +#endif + static DRM_LIST_HEAD(kernel_fb_helper_list); /* simple single crtc case helper function */ @@ -216,6 +251,10 @@ static int fb_get_options(const char *connector_name, char **option) { + /* + * TODO: store mode options pointer in ${option} for connector with + * name ${connector_name} + */ return (1); } @@ -892,11 +931,13 @@ int drm_fb_helper_single_fb_probe(struct int new_fb = 0; int crtc_count = 0; int i; -#if 0 struct fb_info *info; -#endif struct drm_fb_helper_surface_size sizes; int gamma_size = 0; +#if defined(__FreeBSD__) + struct vt_kms_softc *sc; + device_t kdev; +#endif memset(&sizes, 0, sizeof(struct drm_fb_helper_surface_size)); sizes.surface_depth = 24; @@ -973,8 +1014,21 @@ int drm_fb_helper_single_fb_probe(struct if (new_fb < 0) return new_fb; -#if 0 +#if defined(__FreeBSD__) + sc = malloc(sizeof(struct vt_kms_softc), DRM_MEM_KMS, + M_WAITOK | M_ZERO); + sc->fb_helper = fb_helper; + TASK_INIT(&sc->fb_mode_task, 0, vt_restore_fbdev_mode, sc); + info = fb_helper->fbdev; + + info->fb_name = device_get_nameunit(fb_helper->dev->device); + info->fb_depth = fb_helper->fb->bits_per_pixel; + info->fb_height = fb_helper->fb->height; + info->fb_width = fb_helper->fb->width; + info->fb_stride = fb_helper->fb->pitches[0]; + info->fb_priv = sc; + info->enter = &vt_kms_postswitch; #endif /* set the fb pointer */ @@ -982,7 +1036,23 @@ int drm_fb_helper_single_fb_probe(struct fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; } -#if 0 +#if defined(__FreeBSD__) + if (new_fb) { + device_t fbd; + int ret; + + kdev = fb_helper->dev->device; + fbd = device_add_child(kdev, "fbd", device_get_unit(kdev)); + if (fbd != NULL) + ret = device_probe_and_attach(fbd); + else + ret = ENODEV; +#ifdef DEV_VT + if (ret != 0) + DRM_ERROR("Failed to attach fbd device: %d\n", ret); +#endif + } +#else if (new_fb) { info->var.pixclock = 0; if (register_framebuffer(info) < 0) { @@ -1006,7 +1076,6 @@ int drm_fb_helper_single_fb_probe(struct if (new_fb) list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list); #endif - return 0; } Modified: stable/10/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- stable/10/sys/dev/drm2/drm_os_freebsd.h Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/drm_os_freebsd.h Thu Mar 6 18:30:56 2014 (r262861) @@ -6,6 +6,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #if _BYTE_ORDER == _BIG_ENDIAN #define __BIG_ENDIAN 4321 #else Modified: stable/10/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- stable/10/sys/dev/drm2/i915/i915_drv.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/i915/i915_drv.c Thu Mar 6 18:30:56 2014 (r262861) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "fb_if.h" + /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */ static drm_pci_id_list_t i915_pciidlist[] = { i915_PCI_IDS @@ -380,6 +382,25 @@ i915_attach(device_t kdev) return (drm_attach(kdev, i915_pciidlist)); } +static struct fb_info * +i915_fb_helper_getinfo(device_t kdev) +{ + struct intel_fbdev *ifbdev; + drm_i915_private_t *dev_priv; + struct drm_device *dev; + struct fb_info *info; + + dev = device_get_softc(kdev); + dev_priv = dev->dev_private; + ifbdev = dev_priv->fbdev; + if (ifbdev == NULL) + return (NULL); + + info = ifbdev->helper.fbdev; + + return (info); +} + const struct intel_device_info * i915_get_device_id(int device) { @@ -400,6 +421,10 @@ static device_method_t i915_methods[] = DEVMETHOD(device_suspend, i915_suspend), DEVMETHOD(device_resume, i915_resume), DEVMETHOD(device_detach, drm_detach), + + /* Framebuffer service methods */ + DEVMETHOD(fb_getinfo, i915_fb_helper_getinfo), + DEVMETHOD_END }; Modified: stable/10/sys/dev/drm2/i915/intel_fb.c ============================================================================== --- stable/10/sys/dev/drm2/i915/intel_fb.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/i915/intel_fb.c Thu Mar 6 18:30:56 2014 (r262861) @@ -41,8 +41,8 @@ static int intelfb_create(struct intel_f struct drm_device *dev = ifbdev->helper.dev; #if 0 struct drm_i915_private *dev_priv = dev->dev_private; - struct fb_info *info; #endif + struct fb_info *info; struct drm_framebuffer *fb; struct drm_mode_fb_cmd2 mode_cmd; struct drm_i915_gem_object *obj; @@ -86,6 +86,16 @@ static int intelfb_create(struct intel_f } info->par = ifbdev; +#else + info = malloc(sizeof(struct fb_info), DRM_MEM_KMS, M_WAITOK | M_ZERO); + info->fb_size = size; + info->fb_bpp = sizes->surface_bpp; + info->fb_width = sizes->fb_width; + info->fb_height = sizes->fb_height; + info->fb_pbase = dev->agp->base + obj->gtt_offset; + info->fb_vbase = (vm_offset_t)pmap_mapdev_attr(info->fb_pbase, size, + PAT_WRITE_COMBINING); + #endif ret = intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, obj); @@ -95,8 +105,8 @@ static int intelfb_create(struct intel_f fb = &ifbdev->ifb.base; ifbdev->helper.fb = fb; -#if 0 ifbdev->helper.fbdev = info; +#if 0 strcpy(info->fix.id, "inteldrmfb"); @@ -135,9 +145,8 @@ static int intelfb_create(struct intel_f /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ #endif - - DRM_DEBUG_KMS("allocated %dx%d fb: 0x%08x, bo %p\n", - fb->width, fb->height, + DRM_DEBUG_KMS("allocated %dx%d (s %dbits) fb: 0x%08x, bo %p\n", + fb->width, fb->height, fb->depth, obj->gtt_offset, obj); DRM_UNLOCK(dev); Modified: stable/10/sys/dev/drm2/radeon/radeon.h ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon.h Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/radeon/radeon.h Thu Mar 6 18:30:56 2014 (r262861) @@ -2041,6 +2041,9 @@ void radeon_pm_acpi_event_handler(struct int radeon_ttm_init(struct radeon_device *rdev); void radeon_ttm_fini(struct radeon_device *rdev); +/* radeon_fb.c */ +struct fb_info * radeon_fb_helper_getinfo(device_t kdev); + /* r600.c */ int r600_ih_ring_alloc(struct radeon_device *rdev); void r600_ih_ring_fini(struct radeon_device *rdev); Modified: stable/10/sys/dev/drm2/radeon/radeon_drv.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_drv.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/radeon/radeon_drv.c Thu Mar 6 18:30:56 2014 (r262861) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include +#include "fb_if.h" /* * KMS wrapper. @@ -495,6 +496,8 @@ radeon_resume(device_t kdev) return (-ret); } +extern struct fb_info * radeon_fb_helper_getinfo(device_t kdev); + static device_method_t radeon_methods[] = { /* Device interface */ DEVMETHOD(device_probe, radeon_probe), @@ -502,6 +505,10 @@ static device_method_t radeon_methods[] DEVMETHOD(device_suspend, radeon_suspend), DEVMETHOD(device_resume, radeon_resume), DEVMETHOD(device_detach, drm_detach), + + /* Framebuffer service methods */ + DEVMETHOD(fb_getinfo, radeon_fb_helper_getinfo), + DEVMETHOD_END }; Modified: stable/10/sys/dev/drm2/radeon/radeon_fb.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_fb.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/radeon/radeon_fb.c Thu Mar 6 18:30:56 2014 (r262861) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include @@ -46,7 +48,7 @@ struct radeon_fbdev { struct radeon_device *rdev; }; -#ifdef DUMBBELL_WIP +#if defined(__linux__) static struct fb_ops radeonfb_ops = { .owner = THIS_MODULE, .fb_check_var = drm_fb_helper_check_var, @@ -60,7 +62,7 @@ static struct fb_ops radeonfb_ops = { .fb_debug_enter = drm_fb_helper_debug_enter, .fb_debug_leave = drm_fb_helper_debug_leave, }; -#endif /* DUMBBELL_WIP */ +#endif int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) @@ -191,20 +193,13 @@ static int radeonfb_create(struct radeon struct drm_fb_helper_surface_size *sizes) { struct radeon_device *rdev = rfbdev->rdev; -#ifdef DUMBBELL_WIP struct fb_info *info; -#endif /* DUMBBELL_WIP */ struct drm_framebuffer *fb = NULL; struct drm_mode_fb_cmd2 mode_cmd; struct drm_gem_object *gobj = NULL; struct radeon_bo *rbo = NULL; -#ifdef DUMBBELL_WIP - device_t device = rdev->dev; -#endif /* DUMBBELL_WIP */ int ret; -#ifdef DUMBBELL_WIP unsigned long tmp; -#endif /* DUMBBELL_WIP */ mode_cmd.width = sizes->surface_width; mode_cmd.height = sizes->surface_height; @@ -224,16 +219,7 @@ static int radeonfb_create(struct radeon rbo = gem_to_radeon_bo(gobj); -#ifdef DUMBBELL_WIP - /* okay we have an object now allocate the framebuffer */ - info = framebuffer_alloc(0, device); - if (info == NULL) { - ret = -ENOMEM; - goto out_unref; - } - - info->par = rfbdev; -#endif /* DUMBBELL_WIP */ + info = malloc(sizeof(*info), DRM_MEM_KMS, M_WAITOK | M_ZERO); ret = radeon_framebuffer_init(rdev->ddev, &rfbdev->rfb, &mode_cmd, gobj); if (ret) { @@ -245,61 +231,29 @@ static int radeonfb_create(struct radeon /* setup helper */ rfbdev->helper.fb = fb; -#ifdef DUMBBELL_WIP rfbdev->helper.fbdev = info; - memset_io(rbo->kptr, 0x0, radeon_bo_size(rbo)); - - strcpy(info->fix.id, "radeondrmfb"); - - drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); - - info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; - info->fbops = &radeonfb_ops; + memset(rbo->kptr, 0x0, radeon_bo_size(rbo)); tmp = radeon_bo_gpu_offset(rbo) - rdev->mc.vram_start; - info->fix.smem_start = rdev->mc.aper_base + tmp; - info->fix.smem_len = radeon_bo_size(rbo); - info->screen_base = rbo->kptr; - info->screen_size = radeon_bo_size(rbo); - - drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height); - - /* setup aperture base/size for vesafb takeover */ - info->apertures = alloc_apertures(1); - if (!info->apertures) { - ret = -ENOMEM; - goto out_unref; - } - info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base; - info->apertures->ranges[0].size = rdev->mc.aper_size; + info->fb_size = radeon_bo_size(rbo); + info->fb_bpp = sizes->surface_bpp; + info->fb_width = sizes->surface_width; + info->fb_height = sizes->surface_height; + info->fb_pbase = rdev->mc.aper_base + tmp; + info->fb_vbase = (vm_offset_t)rbo->kptr; - /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ - - if (info->screen_base == NULL) { - ret = -ENOSPC; - goto out_unref; - } - - ret = fb_alloc_cmap(&info->cmap, 256, 0); - if (ret) { - ret = -ENOMEM; - goto out_unref; - } - - DRM_INFO("fb mappable at 0x%lX\n", info->fix.smem_start); + DRM_INFO("fb mappable at 0x%" PRIXPTR "\n", info->fb_pbase); DRM_INFO("vram apper at 0x%lX\n", (unsigned long)rdev->mc.aper_base); DRM_INFO("size %lu\n", (unsigned long)radeon_bo_size(rbo)); DRM_INFO("fb depth is %d\n", fb->depth); DRM_INFO(" pitch is %d\n", fb->pitches[0]); - vga_switcheroo_client_fb_set(rdev->ddev->pdev, info); -#endif /* DUMBBELL_WIP */ return 0; out_unref: if (rbo) { - + /* TODO? dumbbell@ */ } if (fb && ret) { drm_gem_object_unreference(gobj); @@ -332,21 +286,13 @@ void radeon_fb_output_poll_changed(struc static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev) { -#ifdef DUMBBELL_WIP struct fb_info *info; -#endif /* DUMBBELL_WIP */ struct radeon_framebuffer *rfb = &rfbdev->rfb; -#ifdef DUMBBELL_WIP if (rfbdev->helper.fbdev) { info = rfbdev->helper.fbdev; - - unregister_framebuffer(info); - if (info->cmap.len) - fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); + free(info, DRM_MEM_KMS); } -#endif /* DUMBBELL_WIP */ if (rfb->obj) { DRM_UNLOCK(dev); /* Work around lock recursion. dumbbell@ */ @@ -431,3 +377,22 @@ bool radeon_fbdev_robj_is_fb(struct rade return true; return false; } + +struct fb_info * +radeon_fb_helper_getinfo(device_t kdev) +{ + struct drm_device *dev; + struct radeon_device *rdev; + struct radeon_fbdev *rfbdev; + struct fb_info *info; + + dev = device_get_softc(kdev); + rdev = dev->dev_private; + rfbdev = rdev->mode_info.rfbdev; + if (rfbdev == NULL) + return (NULL); + + info = rfbdev->helper.fbdev; + + return (info); +} Modified: stable/10/sys/dev/drm2/radeon/radeon_pm.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/radeon_pm.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/drm2/radeon/radeon_pm.c Thu Mar 6 18:30:56 2014 (r262861) @@ -248,7 +248,7 @@ static void radeon_pm_set_clocks(struct (rdev->pm.requested_power_state_index == rdev->pm.current_power_state_index)) return; - DRM_LOCK(rdev->ddev); + //DRM_LOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@ sx_xlock(&rdev->pm.mclk_lock); sx_xlock(&rdev->ring_lock); @@ -263,7 +263,7 @@ static void radeon_pm_set_clocks(struct /* needs a GPU reset dont reset here */ sx_xunlock(&rdev->ring_lock); sx_xunlock(&rdev->pm.mclk_lock); - DRM_UNLOCK(rdev->ddev); + //DRM_UNLOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@ return; } } @@ -299,7 +299,7 @@ static void radeon_pm_set_clocks(struct sx_xunlock(&rdev->ring_lock); sx_xunlock(&rdev->pm.mclk_lock); - DRM_UNLOCK(rdev->ddev); + //DRM_UNLOCK(rdev->ddev); XXX Recursion, already locked in drm_attach/drm_load -- dumbbell@ } static void radeon_pm_print_states(struct radeon_device *rdev) Copied: stable/10/sys/dev/fb/fb_if.m (from r259016, head/sys/dev/fb/fb_if.m) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/fb/fb_if.m Thu Mar 6 18:30:56 2014 (r262861, copy of r259016, head/sys/dev/fb/fb_if.m) @@ -0,0 +1,13 @@ +#include +#include + +INTERFACE fb; + +METHOD int pin_max { + device_t dev; + int *npins; +}; + +METHOD struct fb_info * getinfo { + device_t dev; +}; Copied and modified: stable/10/sys/dev/fb/fbd.c (from r259016, head/sys/dev/fb/fbd.c) ============================================================================== --- head/sys/dev/fb/fbd.c Thu Dec 5 22:38:53 2013 (r259016, copy source) +++ stable/10/sys/dev/fb/fbd.c Thu Mar 6 18:30:56 2014 (r262861) @@ -255,8 +255,12 @@ fb_probe(struct fb_info *info) info->wr4 = &vt_fb_indir_wr4; info->copy = &vt_fb_indir_copy; } else if (info->fb_vbase != 0) { - if (info->fb_pbase == 0) + if (info->fb_pbase == 0) { info->fb_flags |= FB_FLAG_NOMMAP; + } else { + if (info->fb_mmap == NULL) + info->fb_mmap = &fb_mmap; + } info->wr1 = &vt_fb_mem_wr1; info->wr2 = &vt_fb_mem_wr2; info->wr4 = &vt_fb_mem_wr4; @@ -264,6 +268,10 @@ fb_probe(struct fb_info *info) } else return (ENXIO); + if (info->fb_ioctl == NULL) + info->fb_ioctl = &fb_ioctl; + + return (0); } @@ -277,6 +285,7 @@ fb_init(struct fb_list_entry *entry, int entry->fb_si = make_dev(&fb_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, "fb%d", unit); entry->fb_si->si_drv1 = info; + info->fb_cdev = entry->fb_si; return (0); } Modified: stable/10/sys/dev/syscons/scterm-teken.c ============================================================================== --- stable/10/sys/dev/syscons/scterm-teken.c Thu Mar 6 17:33:27 2014 (r262860) +++ stable/10/sys/dev/syscons/scterm-teken.c Thu Mar 6 18:30:56 2014 (r262861) @@ -553,7 +553,14 @@ scteken_putchar(void *arg, const teken_p vm_offset_t p; int cursor, attr; + /* + * No support for printing right hand sides for CJK fullwidth + * characters. Simply print a space and assume that the left + * hand side describes the entire character. + */ attr = scteken_attr(a) << 8; + if (a->ta_format & TF_CJK_RIGHT) + c = ' '; #ifdef TEKEN_UTF8 scteken_get_cp437(&c, &attr); #endif /* TEKEN_UTF8 */ Modified: stable/10/sys/dev/vt/font/vt_font_default.c ============================================================================== --- head/sys/dev/vt/font/vt_font_default.c Thu Dec 5 22:38:53 2013 (r259016) +++ stable/10/sys/dev/vt/font/vt_font_default.c Thu Mar 6 18:30:56 2014 (r262861) @@ -2194,9 +2194,12 @@ struct vt_font vt_font_default = { .vf_width = 8, .vf_height = 16, .vf_bytes = font_bytes, - .vf_normal = font_mapping_normal, - .vf_normal_length = 248, - .vf_bold = font_mapping_bold, - .vf_bold_length = 260, + .vf_map = { + font_mapping_normal, + NULL, + font_mapping_bold, + NULL, + }, + .vf_map_count = { 248, 0, 260, 0 }, .vf_refcount = 1, }; Modified: stable/10/sys/dev/vt/font/vt_mouse_cursor.c ============================================================================== --- head/sys/dev/vt/font/vt_mouse_cursor.c Thu Dec 5 22:38:53 2013 (r259016) +++ stable/10/sys/dev/vt/font/vt_mouse_cursor.c Thu Mar 6 18:30:56 2014 (r262861) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#ifndef SC_NO_CUTPASTE struct mouse_cursor vt_default_mouse_pointer = { .map = { 0x00, /* "__ " */ @@ -66,3 +67,4 @@ struct mouse_cursor vt_default_mouse_poi .w = 8, .h = 13, }; +#endif Modified: stable/10/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_fb.c Thu Dec 5 22:38:53 2013 (r259016) +++ stable/10/sys/dev/vt/hw/fb/vt_fb.c Thu Mar 6 18:30:56 2014 (r262861) @@ -41,14 +41,103 @@ __FBSDID("$FreeBSD$"); #include #include +static int vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, + struct thread *td); +static int vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, + vm_paddr_t *paddr, int prot, vm_memattr_t *memattr); +void vt_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, + int fill, term_color_t color); +void vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color); + static struct vt_driver vt_fb_driver = { .vd_init = vt_fb_init, .vd_blank = vt_fb_blank, .vd_bitbltchr = vt_fb_bitbltchr, + .vd_drawrect = vt_fb_drawrect, + .vd_setpixel = vt_fb_setpixel, .vd_postswitch = vt_fb_postswitch, .vd_priority = VD_PRIORITY_GENERIC+10, + .vd_fb_ioctl = vt_fb_ioctl, + .vd_fb_mmap = vt_fb_mmap, }; +static int +vt_fb_ioctl(struct vt_device *vd, u_long cmd, caddr_t data, struct thread *td) +{ + struct fb_info *info; + + info = vd->vd_softc; + + if (info->fb_ioctl == NULL) + return (-1); + + return (info->fb_ioctl(info->fb_cdev, cmd, data, 0, td)); +} + +static int +vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) +{ + struct fb_info *info; + + info = vd->vd_softc; + + if (info->fb_ioctl == NULL) + return (ENXIO); + + return (info->fb_mmap(info->fb_cdev, offset, paddr, prot, memattr)); +} + +void +vt_fb_setpixel(struct vt_device *vd, int x, int y, term_color_t color) +{ + struct fb_info *info; + uint32_t c; + u_int o; + + info = vd->vd_softc; + c = info->fb_cmap[color]; + o = info->fb_stride * y + x * FBTYPE_GET_BYTESPP(info); + + switch (FBTYPE_GET_BYTESPP(info)) { + case 1: + info->wr1(info, o, c); + break; + case 2: + info->wr2(info, o, c); + break; + case 3: + info->wr1(info, o, (c >> 16) & 0xff); + info->wr1(info, o + 1, (c >> 8) & 0xff); + info->wr1(info, o + 2, c & 0xff); + break; + case 4: + info->wr4(info, o, c); + break; + default: + /* panic? */ + return; + } + +} + +void +vt_fb_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, int fill, + term_color_t color) +{ + int x, y; + + for (y = y1; y <= y2; y++) { + if (fill || (y == y1) || (y == y2)) { + for (x = x1; x <= x2; x++) + vt_fb_setpixel(vd, x, y, color); + } else { + vt_fb_setpixel(vd, x1, y, color); + vt_fb_setpixel(vd, x2, y, color); + } + } +} + void vt_fb_blank(struct vt_device *vd, term_color_t color) { Modified: stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c ============================================================================== --- head/sys/dev/vt/hw/ofwfb/ofwfb.c Thu Dec 5 22:38:53 2013 (r259016) +++ stable/10/sys/dev/vt/hw/ofwfb/ofwfb.c Thu Mar 6 18:30:56 2014 (r262861) @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: user/ed/newcons/sys/dev/vt/hw/ofwfb/ofwfb.c 219888 2011-03-22 21:31:31Z ed $"); +__FBSDID("$FreeBSD$"); #include #include @@ -78,17 +78,19 @@ static void ofwfb_blank(struct vt_device *vd, term_color_t color) { struct ofwfb_softc *sc = vd->vd_softc; - u_int ofs; + u_int ofs, size; uint32_t c; + size = sc->sc_stride * vd->vd_height; switch (sc->sc_depth) { case 8: - for (ofs = 0; ofs < sc->sc_stride*vd->vd_height; ofs++) - *(uint8_t *)(sc->sc_addr + ofs) = color; + c = (color << 24) | (color << 16) | (color << 8) | color; + for (ofs = 0; ofs < size/4; ofs++) + *(uint32_t *)(sc->sc_addr + 4*ofs) = c; break; case 32: c = sc->sc_colormap[color]; - for (ofs = 0; ofs < sc->sc_stride*vd->vd_height; ofs++) + for (ofs = 0; ofs < size; ofs++) *(uint32_t *)(sc->sc_addr + 4*ofs) = c; break; default: Modified: stable/10/sys/dev/vt/hw/vga/vga.c ============================================================================== --- head/sys/dev/vt/hw/vga/vga.c Thu Dec 5 22:38:53 2013 (r259016) +++ stable/10/sys/dev/vt/hw/vga/vga.c Thu Mar 6 18:30:56 2014 (r262861) @@ -74,13 +74,19 @@ struct vga_softc { static vd_init_t vga_init; static vd_blank_t vga_blank; static vd_bitbltchr_t vga_bitbltchr; +static vd_drawrect_t vga_drawrect; +static vd_setpixel_t vga_setpixel; static vd_putchar_t vga_putchar; +static vd_postswitch_t vga_postswitch; static const struct vt_driver vt_vga_driver = { .vd_init = vga_init, .vd_blank = vga_blank, .vd_bitbltchr = vga_bitbltchr, + .vd_drawrect = vga_drawrect, + .vd_setpixel = vga_setpixel, .vd_putchar = vga_putchar, + .vd_postswitch = vga_postswitch, .vd_priority = VD_PRIORITY_GENERIC, }; @@ -137,6 +143,31 @@ vga_bitblt_put(struct vt_device *vd, u_l } } +static void +vga_setpixel(struct vt_device *vd, int x, int y, term_color_t color) +{ + + vga_bitblt_put(vd, (y * VT_VGA_WIDTH / 8) + (x / 8), color, + 0x80 >> (x % 8)); +} + +static void +vga_drawrect(struct vt_device *vd, int x1, int y1, int x2, int y2, int fill, + term_color_t color) +{ + int x, y; + + for (y = y1; y <= y2; y++) { + if (fill || (y == y1) || (y == y2)) { + for (x = x1; x <= x2; x++) + vga_setpixel(vd, x, y, color); + } else { + vga_setpixel(vd, x1, y, color); + vga_setpixel(vd, x2, y, color); + } + } +} + static inline void vga_bitblt_draw(struct vt_device *vd, const uint8_t *src, u_long ldst, uint8_t shift, unsigned int width, unsigned int height, @@ -602,3 +633,13 @@ vga_init(struct vt_device *vd) return (CN_INTERNAL); } + +static void +vga_postswitch(struct vt_device *vd) +{ + + /* Reinit VGA mode, to restore view after app which change mode. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***