Skip to content
Jordan Rhee edited this page Jan 30, 2016 · 25 revisions

#Windows Graphics Driver Samples Wiki

Building Render Only Sample for Raspberry Pi 2

Installing Render Only Sample driver in a VM

Installing Render Only Sample driver on a Raspberry Pi 2

Building on the command line

The project can be built either in Visual Studio or on the command line. To build on the command line,

  1. Launch Developer Command Prompt for VS2015 from the Start Menu
  2. Change directories to the render-only-sample folder
  3. Invoke msbuild

To build all projects in the solution, run

msbuild ros.sln /p:Configuration=Debug /p:Platform=ARM

This will build the entire solution in the Debug|ARM configuration. To build a single project, pass the project name to the /t parameter. For example, to build only the roskmd project,

msbuild ros.sln /t:roskmd /p:Configuration=Debug /p:Platform=ARM

You can run the command from anywhere in the source tree as long as you pass the path of ros.sln to msbuild. If you were in the roskmd directory, you could run

msbuild ..\ros.sln /t:roskmd /p:Configuration=Debug /p:Platform=ARM

To do a clean, build the 'clean' target:

msbuild ros.sln /t:clean /p:Configuration=Debug /p:Platform=ARM

Viewing trace logs from the kernel mode driver (roskmd)

During development and debugging it is often useful to view log output from a software component. The kernel mode driver is instrumented with WPP logging and has the WPP in-flight recorder enabled. The in-flight recorder saves up to one page of the most recent tracing calls, which can be dumped from the debugger with the following command:

!rcdrkd.rcdrlogdump roskmd

You should see output similar to the following:

Trying to extract TMF information from - C:\debuggers\sym\roskmd.pdb\50607DB595DB494D985FEF3D0B1B6AA61\roskmd.pdb
--- start of log ---
1: RosKmdGlobal::DriverEntry -  [RosKmdGlobal.cpp @ 84] INFO :(pDriverObject=8AA97A10, pRegistryPath=8AACB000)
---- end of log ----

Note that the debugger must have access to the symbols to format the log output. Trace messages can also be sent to the kernel debugger in real time with the following command:

tracelog -start ros -rt -kd -guid #B5B486C1-F57B-4993-8ED7-E3C2F5E4E65A -flags 0xffff -level 5

To stop sending traces, run the following command

tracelog -stop ros

More information about WPP and ETW is available on MSDN.

The dxgkrnl logs can be dumped with the following command:

!dxgkdx.dxglog

Trace Macros

The following table describes the purpose of each trace macro and on which build flavors (debug/release) it is enabled.

Macro Name Description Enabled in Debug Builds Enabled in Release Builds
ROS_LOG_CRITICAL_ERROR Will cause bugcheck in release build. Yes Yes
ROS_LOG_ASSERTION Will cause debug break if debugger is attached. Yes No
ROS_LOG_ERROR Use to log all errors, e.g. before returning failure NTSTATUS. Yes Yes
ROS_LOG_LOW_MEMORY Use before returning STATUS_NO_MEMORY and STATUS_INSUFFICIENT_RESOURCES Yes Yes
ROS_LOG_WARNING Use to log things that are less severe than errors but more severe than information. Yes Yes
ROS_LOG_INFORMATION Use to log interesting events. Yes Yes
ROS_LOG_TRACE Use to log debugging information. Yes No
ROS_CRITICAL_ASSERT Will cause a bugcheck if the assertion expression evaluates to false. Yes Yes
ROS_ASSERT Will cause bugcheck if assertion expression evaluates to false. Yes No

Debugging Tips

Breaking in at driver entry

You can break in to the driver at the earliest possible point (DriverEntry) by using one of these techniques.

Hit Ctrl+Alt+K in windbg anytime before boot. This will break at kernel load. Run

sxe ld:roskmd.sys

This will cause the debugger to break in when the roskmd.sys module is loaded, but before any code is run. You can now load symbols and set a breakpoint on DriverEntry:

bp roskmd!DriverEntry

Assuming your symbol path is set up correctly, a breakpoint should be set.

You could also skip the 'sxe' step above by running the following command any time. This command does not require symbols to be loaded.

bu roskmd!DriverEntry

This sets a deferred breakpoint, which won't try to resolve the symbol to an address until the image is loaded.

Tell roskmd not to load

ed roskmd!RosKmdGlobal::s_bDoNotInstall 1

Skip loading of SiHost

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v ShellInfrastructure /t REG_SZ /d cmd.exe
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Headless /t REG_DWORD  /d 1

Configure driver in render-only mode

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RenderOnlySample" /v RenderOnly /t REG_DWORD /d 1
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" /v DisableAutoAcpiPostDeivce /t REG_DWORD /d 1
reg add HKLM\SOFTWARE\Microsoft\XAML /v ForceWARP /t REG_DWORD /d 1