From owner-freebsd-hackers@freebsd.org Fri Jun 16 17:21:42 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F4B6C78B9D for ; Fri, 16 Jun 2017 17:21:42 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-vk0-x232.google.com (mail-vk0-x232.google.com [IPv6:2607:f8b0:400c:c05::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 26AA93D80 for ; Fri, 16 Jun 2017 17:21:42 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-vk0-x232.google.com with SMTP id 191so25685625vko.2 for ; Fri, 16 Jun 2017 10:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jVGkpyTj/dgDWQwZXj0+rp8XClAeTpPC779MoCOykNM=; b=gYAQ8B+gFbz9syHIki1ZeXRCnJzKahGPQ38Dwx015IG4+UOiyqwrn2D6bQOj0sStup gYAqdoLXvjVjwBmc35wX/qO4/qO4j+3nkbxIbUz2AMQCE09B2u7E7AeSgCEeIxSQ58MH aDdpaq4z36bk+o+FskKTe2gj6auYYx1qtFn7pblkSnYdabzg1nFbpCd20555r+4hlmID YwGJik+QZQ+M/4dQwzkdQZWCzxFPPv/GIXlrTO1OYV96I8mYbDun37xk/TxHgsZAFvhJ Up9NxXgCphLPUHPvK6vrW7Z0uycs0K/Ct1omNa+LY6T/b105zRXT6Nci65hv6TX+QMU4 O19A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jVGkpyTj/dgDWQwZXj0+rp8XClAeTpPC779MoCOykNM=; b=DdnCPUMz0m8o3nef4yym7jiuAGyf9amucbos4Q/RFFiSnu0cOFge5APTkopIE91mVP IgpLMDUdNzNqzijOYV37lB7ectaDTcsunXoyU/0LIRXDgpggz1I6v4cgHAYg8BMr85XI zpKpa+U5j0SbGN+cPyCHc4FYRpie9vLkjkAZRMcuMKOykammKqNSIGFKemu9qH4/SjLR IkDaBJppPFSXp8BEdakVSK0a6Mg8tn6O8YEygY9clj7kmE166hEQcuzc6lcfsiukwehs 1TodwI4OhY6xat1q1Ah++TcIrMfdjtME6IxsWNLfm6/z2VBA7wJLMy/QINMASM/90ea/ NIyg== X-Gm-Message-State: AKS2vOzMbktIC/4UNsCMqbUspO4HukY5vGyHgqm/5Cf2CEatSfO8JXqu DynBDPgkLZ4vv5zQ0VMIQb5GHd/TzqQ2 X-Received: by 10.31.69.138 with SMTP id s132mr7065901vka.13.1497633701251; Fri, 16 Jun 2017 10:21:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.36.195 with HTTP; Fri, 16 Jun 2017 10:21:40 -0700 (PDT) In-Reply-To: References: From: Oliver Pinter Date: Fri, 16 Jun 2017 19:21:40 +0200 Message-ID: Subject: Re: efifb framebuffer info for NVIDIA driver console restore To: Aaron Plattner Cc: "freebsd-hackers@freebsd.org" , Ed Maste , Aleksandr Rybalko Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 17:21:42 -0000 CC: Ray and Ed. On Friday, June 16, 2017, Aaron Plattner wrote: > Hi FreeBSD hackers, > > My name is Aaron Plattner. I'm a driver developer at NVIDIA working on > the FreeBSD driver, among other things. I was hoping you could help me > out regarding some changes I've been making to the driver. > > Recently, we've revamped how our driver handles switching from > graphical modes to the console mode. For framebuffer consoles, the new > nvidia_modeset module tries to take care of it without having to fall > back to old-school VESA VBE modesets. However, in order for this to > work, the driver needs to know where the framebuffer console is in > physical memory, and its layout. > > On Linux, we get this information from the global 'screen_info' > structure: > > void NV_API_CALL os_get_screen_info( > NvU64 *pPhysicalAddress, > NvU16 *pFbWidth, > NvU16 *pFbHeight, > NvU16 *pFbDepth, > NvU16 *pFbPitch > ) > { > // > // If there is not a framebuffer console, return 0 size. > // > // orig_video_isVGA is set to 1 during early Linux kernel > // initialization, and then will be set to a value, such as > // VIDEO_TYPE_VLFB or VIDEO_TYPE_EFI if an fbdev console is used. > // > if (screen_info.orig_video_isVGA <= 1) > { > *pPhysicalAddress = 0; > *pFbWidth = *pFbHeight = *pFbDepth = *pFbPitch = 0; > return; > } > > *pPhysicalAddress = screen_info.lfb_base; > #if defined(VIDEO_CAPABILITY_64BIT_BASE) > *pPhysicalAddress |= (NvU64)screen_info.ext_lfb_base << 32; > #endif > *pFbWidth = screen_info.lfb_width; > *pFbHeight = screen_info.lfb_height; > *pFbDepth = screen_info.lfb_depth; > *pFbPitch = screen_info.lfb_linelength; > } > > This works for both legacy boot systems with vesafb as well as UEFI > systems that use Linux's efifb. > > On FreeBSD, I was able to find this information on my legacy system: > > void NV_API_CALL os_get_screen_info( > NvU64 *pPhysicalAddress, > NvU16 *pFbWidth, > NvU16 *pFbHeight, > NvU16 *pFbDepth, > NvU16 *pFbPitch > ) > { > const sc_softc_t *sc = sc_get_softc(0, SC_KERNEL_CONSOLE); > > if (sc) > { > const video_adapter_t *adp = sc->adp; > > if (adp) > { > const struct video_info *vi = &adp->va_info; > > if (vi && (vi->vi_flags & V_INFO_LINEAR)) > { > *pPhysicalAddress = vi->vi_buffer; > *pFbWidth = vi->vi_width; > *pFbHeight = vi->vi_height; > *pFbDepth = vi->vi_depth; > *pFbPitch = adp->va_line_width; > return; > } > } > } > > *pPhysicalAddress = 0; > *pFbWidth = *pFbHeight = *pFbDepth = *pFbPitch = 0; > } > > However, this doesn't work on UEFI systems because efifb doesn't go > through the video_adapter_t stuff. Does anyone know how I can get that > information from efifb, or who to talk to about adding an interface > the driver can use to find it? > > Sincerely, > Aaron > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org > " >