Difference between revisions of "Display services"

From Nintendo Switch Brew
Jump to navigation Jump to search
 
(64 intermediate revisions by 6 users not shown)
Line 2: Line 2:
  
 
= caps:sc =
 
= caps:sc =
This is "nn::capsrv::sf::IScreenShotControlService". This is available with [2.0.0+].
+
This is "nn::capsrv::sf::IScreenShotControlService".
 +
 
 +
This was added with [2.0.0+].
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 8: Line 10:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 1 ||
+
| 1 || [[#CaptureRawImageRgba32IntoArray]]
 +
|-
 +
| 2 || [[#CaptureRawImageRgba32IntoArrayWithTimeout]]
 +
|-
 +
| 3 || [5.0.0+] [[#AttachSharedBufferToCaptureModule]]
 +
|-
 +
| 5 || [5.0.0+] [[#CaptureRawImageToAttachedSharedBuffer]]
 +
|-
 +
| 210 || [6.0.0+] [[#SaveScreenShotEx2ViaAm]]
 +
|-
 +
| 1001 || [2.0.0-4.1.0] [[#RequestTakingScreenShot]]
 +
|-
 +
| 1002 || [2.0.0-4.1.0] [[#RequestTakingScreenShotWithTimeout]]
 
|-
 
|-
| 2 ||
+
| 1003 || [3.0.0-4.1.0] [[#RequestTakingScreenShotEx]]
 
|-
 
|-
| 1001 ||
+
| 1004 || [5.0.0+] [[#RequestTakingScreenShotEx1]]
 
|-
 
|-
| 1002 ||
+
| 1009 || [5.0.0+] [[#CancelTakingScreenShot]]
 
|-
 
|-
| 1003 ||
+
| 1010 || [5.0.0+] [[#SetTakingScreenShotCancelState]]
 
|-
 
|-
| 1011 ||
+
| 1011 || [[#NotifyTakingScreenShotRefused]]
 
|-
 
|-
| 1012 ||
+
| 1012 || [[#NotifyTakingScreenShotFailed]]
 
|-
 
|-
| 1201 ||
+
| 1100 || [18.0.0+]
 
|-
 
|-
| 1202 ||
+
| 1101 || [4.0.0+] [[#SetupOverlayMovieThumbnail]]
 
|-
 
|-
| 1203 ||
+
| 1106 || [4.0.0+] [[#CreateProtoMovieMetaDataNv12Ex2]]
 +
|-
 +
| 1107 || [4.0.0+] [[#CreateProtoMovieMetaDataRgbaEx2]]
 +
|-
 +
| 1108 || [18.0.0+]
 +
|-
 +
| 1109 || [19.0.0+]
 +
|-
 +
| 1110 || [19.0.0+]
 +
|-
 +
| 1111 || [19.0.0+]
 +
|-
 +
| 1112 || [19.0.0+]
 +
|-
 +
| 1113 || [19.0.0+]
 +
|-
 +
| 1114 || [19.0.0+]
 +
|-
 +
| 1201 || [3.0.0+] [[#OpenRawScreenShotReadStream]]
 +
|-
 +
| 1202 || [3.0.0+] [[#CloseRawScreenShotReadStream]]
 +
|-
 +
| 1203 || [3.0.0+] [[#ReadRawScreenShotReadStream]]
 +
|-
 +
| 1204 || [9.0.0+] [[#CaptureCrashScreenShot]]
 
|}
 
|}
  
== Cmd1 ==
+
The only caps:sc commands used by [[GRC_services|GRC]] are: 1101, 1106, and 1107.
Takes a type-0x46 output buffer, an input u32, two input u64s '''width'''/'''height''', an input s64 '''buffer_count''', and an input s64 '''buffer_index'''.
+
 
 +
== CaptureRawImageRgba32IntoArray ==
 +
Takes a type-0x46 output buffer, an input u32 '''layer_stack''', two input u64s '''width'''/'''height''', an input s64 '''buffer_count''', and an input s64 '''buffer_index'''.
  
 
'''width'''/'''height''' must match 1280/720. '''buffer_index''' must be < '''buffer_count'''. '''buffer_index''' and '''buffer_count''' must not be negative.
 
'''width'''/'''height''' must match 1280/720. '''buffer_index''' must be < '''buffer_count'''. '''buffer_index''' and '''buffer_count''' must not be negative.
Line 42: Line 82:
 
Stubbed with [5.0.0+], where it now returns error 0x7FECE.
 
Stubbed with [5.0.0+], where it now returns error 0x7FECE.
  
== Cmd2 ==
+
== CaptureRawImageRgba32IntoArrayWithTimeout ==
Calls the same internal func as cmd1, where the last param is an additional cmd input u64 instead of hard-coded value 0x5f5e100.
+
Calls the same internal func as [[#CaptureRawImageRgba32IntoArray]], where the last param is an additional cmd input u64 instead of hard-coded value 0x5f5e100.
  
 
Stubbed with [5.0.0+], where it now returns error 0x7FECE.
 
Stubbed with [5.0.0+], where it now returns error 0x7FECE.
 +
 +
== AttachSharedBufferToCaptureModule ==
 +
Takes a total of 8-bytes of input. No output.
 +
 +
== CaptureRawImageToAttachedSharedBuffer ==
 +
Takes a total of 0x10-bytes of input. No output.
 +
 +
== SaveScreenShotEx2ViaAm ==
 +
Takes a total of 0x50-bytes of input, a type-0x15 input buffer, and a type-0x45 input buffer, returns a total of 0x20-bytes of output.
 +
 +
User-processes use hard-coded size 0x88 for the type-0x15 buffer.
 +
 +
[8.0.0+] Now takes an additional type-0x15 input buffer.
 +
 +
== RequestTakingScreenShot ==
 +
Takes a total of 0x10-bytes of input. No output.
 +
 +
== RequestTakingScreenShotWithTimeout ==
 +
Takes a total of 0x18-bytes of input. No output.
 +
 +
== RequestTakingScreenShotEx ==
 +
Takes a total of 0x58-bytes of input. No output.
 +
 +
== RequestTakingScreenShotEx1 ==
 +
Takes a total of 0x60-bytes of input. No output.
 +
 +
[6.0.0+] In addition, this also takes a type-0x15 input buffer.
 +
 +
[8.0.0+] Now takes an additional type-0x15 input buffer.
 +
 +
[11.0.0+] Now takes an additional 8-bytes of input.
 +
 +
[19.0.0+] Now takes another additional 8-bytes of input.
 +
 +
== CancelTakingScreenShot ==
 +
Takes a total of 0x10-bytes of input. No output.
 +
 +
== SetTakingScreenShotCancelState ==
 +
Takes a total of 0x10-bytes of input. No output.
 +
 +
== NotifyTakingScreenShotRefused ==
 +
Takes a total of 8-bytes of input. No output.
 +
 +
== NotifyTakingScreenShotFailed ==
 +
Takes a total of 8-bytes of input. No output.
 +
 +
== SetupOverlayMovieThumbnail ==
 +
Takes two input u64s '''width'''/'''height''', a 0x18-byte input struct, and two type-0x46 output buffers.
 +
 +
For the input struct, [[GRC_services|GRC]] uses the output from [[Capture_services|caps:c]] cmd2101.
 +
 +
'''width'''/'''height''' must be 1280x720. The first buffer address must be 0x400-byte aligned. The size of the first buffer must be at least '''width'''*'''height''', and must be aligned to 0x20000-bytes.
 +
 +
The requirements for the second buffer address/size are the same as the first buffer, except the minimum size is ('''width'''*'''height''')/2.
 +
 +
== CreateProtoMovieMetaDataNv12Ex2 ==
 +
Takes a 0x40-byte input struct, two input u64s '''width'''/'''height''', a 0x18-byte input struct, two type-0x15 input buffers, a type-0x6 output buffer, and two type-0x46 output buffers, returns 3 output u64s.
 +
 +
'''width'''/'''height''' have same requirements as [[#SetupOverlayMovieThumbnail]]. The size of the type-0x6 buffer must be at least 0x7D000. The requirements for the type-0x46 buffers are the same as [[#SetupOverlayMovieThumbnail]].
 +
 +
User-processes use hard-coded sizes 0x400 and 0x404 for the first/second type-0x15 buffers.
 +
 +
[5.0.0+] Now takes a total of 0x68-bytes of input instead of 0x30.
 +
 +
[19.0.0+] Now takes an additional 0x10-bytes of input.
 +
 +
== CreateProtoMovieMetaDataRgbaEx2 ==
 +
Takes a 0x40-byte input struct, two input u64s '''width'''/'''height''', a 0x18-byte input struct, two type-0x15 input buffers, a type-0x6 output buffer, and a type-0x45 input buffer, returns 3 output u64s.
 +
 +
'''width'''/'''height''' have same requirements as [[#SetupOverlayMovieThumbnail]]. The size of the type-0x6 buffer must be at least 0x7D000. The size of the type-0x45 buffer must be at least 0x384000.
 +
 +
User-processes use hard-coded sizes 0x400 and 0x404 for the first/second type-0x15 buffers.
 +
 +
[5.0.0+] Now takes a total of 0x68-bytes of input instead of 0x30.
 +
 +
[19.0.0+] Now takes an additional 0x10-bytes of input.
 +
 +
== Cmd1108 ==
 +
Takes a total of 0x70-bytes of input, three type-0x15 input buffers, a type-0x6 output buffer. Returns a total of 0x18-bytes of output.
 +
 +
[19.0.0+] Now takes an additional 0x10-bytes of input.
 +
 +
== OpenRawScreenShotReadStream ==
 +
Takes a total of 0x10-bytes of input. Returns a total of 0x18-bytes of output.
 +
 +
Only usable when the previously loaded value from [[Settings_services|set:sys GetDebugModeFlag]] is set.
 +
 +
== CloseRawScreenShotReadStream ==
 +
No input/output.
 +
 +
Only usable when the previously loaded value from [[Settings_services|set:sys GetDebugModeFlag]] is set.
 +
 +
== ReadRawScreenShotReadStream ==
 +
Takes a total of 8-bytes of input and a type-0x6 output buffer. Returns a total of 8-bytes of output.
 +
 +
Only usable when the previously loaded value from [[Settings_services|set:sys GetDebugModeFlag]] is set.
 +
 +
== CaptureCrashScreenShot ==
 +
Takes a total of 0x10-bytes of input and a type-0x46 output buffer. Returns a total of 8-bytes of output.
 +
 +
Also required the mentioned debug flag but does no longer as of [10.0.0].
  
 
= caps:ss =
 
= caps:ss =
This is "nn::capsrv::sf::IScreenShotService". This is available with [2.0.0+].
+
This is "nn::capsrv::sf::IScreenShotService".
 +
 
 +
This was added with [2.0.0+].
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 54: Line 197:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 201 ||
+
| 201 || SaveScreenShot
 +
|-
 +
| 202 || SaveEditedScreenShot
 +
|-
 +
| 203 || [3.0.0+] SaveScreenShotEx0
 
|-
 
|-
| 202 ||
+
| 204 || [3.0.0+] SaveEditedScreenShotEx0
 
|-
 
|-
| 203 ||
+
| 206 || [4.0.0+] SaveEditedScreenShotEx1
 
|-
 
|-
| 204 ||
+
| 208 || [5.0.0+] SaveScreenShotOfMovieEx1
 +
|-
 +
| 1000 || [13.0.0+] [[#RequestTakingScreenShotForApplet]]
 
|}
 
|}
 +
 +
== RequestTakingScreenShotForApplet ==
 +
Takes a total of 0x68-bytes of input, two type-0x15 input buffers. Returns a total of 0x20-bytes of output.
 +
 +
[19.0.0+] Now takes an additional 8-bytes of input.
  
 
= caps:su =
 
= caps:su =
 
This is "nn::capsrv::sf::IScreenShotApplicationService".
 
This is "nn::capsrv::sf::IScreenShotApplicationService".
 +
 +
This was added with [3.0.0+].
 +
 +
[6.0.0+] This was moved to [[Applet_Manager_services|AM]].
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 73: Line 231:
 
|-
 
|-
 
| 203 || SaveScreenShotEx0
 
| 203 || SaveScreenShotEx0
|-
 
| 210 || [6.0.0+] SaveScreenShotEx2
 
 
|}
 
|}
  
Line 84: Line 240:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || RegisterCallback
 
|-
 
|-
| 1 ||
+
| 1 || UnregisterCallback
 
|-
 
|-
| 2 ||
+
| 2 || TriggerSystemEvent
 
|-
 
|-
| 3 ||
+
| 3 || PerformAction
 
|-
 
|-
| 4 ||
+
| 4 || QueryState
 
|-
 
|-
| 5 ||
+
| 5 || OnSystemEvent
 
|-
 
|-
| 6 ||
+
| 6 || [2.0.0+] CancelCurrentCall
 +
|-
 +
| 100 || [4.0.0+] [[#GetHdcpServiceObject]]
 +
|}
 +
 
 +
== GetHdcpServiceObject ==
 +
No input. Returns a [[#IHdcpController]].
 +
 
 +
= IHdcpController =
 +
This is "nn::hdcp::detail::IHdcpController".
 +
 
 +
This was added with [4.0.0+].
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || GetHdcpStateTransitionEvent
 +
|-
 +
| 1 || GetHdcpAuthenticationState
 +
|-
 +
| 2 || SetCurrentHdcpMode
 +
|-
 +
| 3 || GetCurrentHdcpMode
 
|}
 
|}
  
 
= mm:u =
 
= mm:u =
 
This is "nn::mmnv::IRequest".
 
This is "nn::mmnv::IRequest".
 
NVIDIA multimedia (NvMM) platform service.
 
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 108: Line 285:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || InitializeOld
+
| 0 || [[#InitializeOld]]
 
|-
 
|-
| 1 || FinalizeOld
+
| 1 || [[#FinalizeOld]]
 
|-
 
|-
| 2 || SetAndWaitOld
+
| 2 || [[#SetAndWaitOld]]
 
|-
 
|-
| 3 || GetOld
+
| 3 || [[#GetOld]]
 
|-
 
|-
| 4 || Initialize
+
| 4 || [[#Initialize]]
 
|-
 
|-
| 5 || Finalize
+
| 5 || [[#Finalize]]
 
|-
 
|-
| 6 || SetAndWait
+
| 6 || [[#SetAndWait]]
 
|-
 
|-
| 7 || Get
+
| 7 || [[#Get]]
 
|}
 
|}
 +
 +
== InitializeOld ==
 +
Takes an input [[#Module]], an input [[#Priority]] and an input u32 '''EventClearMode'''. No output.
 +
 +
== FinalizeOld ==
 +
Takes an input [[#Module]]. No output.
 +
 +
== SetAndWaitOld ==
 +
Takes an input [[#Module]] and two input [[#Setting]] '''Min''' and '''Max'''. No output.
 +
 +
== GetOld ==
 +
Takes an input [[#Module]]. Returns an output [[#Setting]] '''Current'''.
 +
 +
== Initialize ==
 +
Same as [[#InitializeOld]], but returns an output u32 '''RequestId'''.
 +
 +
== Finalize ==
 +
Same as [[#FinalizeOld]], but takes an input u32 '''RequestId''' instead of an input [[#Module]].
 +
 +
== SetAndWait ==
 +
Same as [[#SetAndWaitOld]], but takes an input u32 '''RequestId''' instead of an input [[#Module]].
 +
 +
== Get ==
 +
Same as [[#GetOld]], but takes an input u32 '''RequestId''' instead of an input [[#Module]].
  
 
= vi:u =
 
= vi:u =
Line 134: Line 335:
 
| 0 || [[#vi:u|GetDisplayService]]
 
| 0 || [[#vi:u|GetDisplayService]]
 
|-
 
|-
 +
| 1 || [9.0.0+] [[#vi:u|GetDisplayServiceWithProxyNameExchange]]
 
|}
 
|}
  
 
== GetDisplayService ==
 
== GetDisplayService ==
Returns an [[#IApplicationDisplayService]]. Takes an input u32, user-processes use 0 or 1, with 0 for regular-applications normally. 0 = user-service(vi:u), 1 = non-user-service? Returns an error when using value 1 with vi:u(same error listed below for IApplicationDisplayService for unavailable commands).
+
Returns an [[#IApplicationDisplayService]]. Takes an input u32, user-processes use 0 or 1, with 0 for regular-applications normally. 0 = user-service(vi:u), 1 = system/manager service (vi:s/vi:m). Returns an error when using value 1 with vi:u(same error listed below for IApplicationDisplayService for unavailable commands), however passing 1 to vi:s/vi:m results in the IApplicationDisplayService having greater privileges.
 +
 
 +
== GetDisplayServiceWithProxyNameExchange ==
 +
Takes an input u32, and returns an [[#IApplicationDisplayService]].
  
 
= vi:s =
 
= vi:s =
Line 149: Line 354:
 
|-
 
|-
 
| 3 || [[#vi:s|GetDisplayServiceWithProxyNameExchange]]
 
| 3 || [[#vi:s|GetDisplayServiceWithProxyNameExchange]]
|-
 
 
|}
 
|}
  
Line 169: Line 373:
 
| 3 || [[#vi:m|GetDisplayServiceWithProxyNameExchange]]
 
| 3 || [[#vi:m|GetDisplayServiceWithProxyNameExchange]]
 
|-
 
|-
 +
| 100 || [16.0.0+] PrepareFatal
 +
|-
 +
| 101 || [16.0.0+] ShowFatal
 +
|-
 +
| 102 || [16.0.0+] DrawFatalRectangle
 +
|-
 +
| 103 || [16.0.0+] DrawFatalText32
 
|}
 
|}
  
Line 271: Line 482:
  
 
== GetDisplayResolution ==
 
== GetDisplayResolution ==
Takes an input u64 DisplayId and returns two output u64s: width and height.
+
Takes an input u64 DisplayId and returns two output s64s: width and height. Official sw copies these to s32 output fields.
  
 
== OpenLayer ==
 
== OpenLayer ==
Line 295: Line 506:
  
 
== GetIndirectLayerImageMap ==
 
== GetIndirectLayerImageMap ==
Takes a PID-descriptor, an type-0x46 buffer, and four u64s: width(s32), height(s32), <output from [[AM_services|AM]] GetIndirectLayerConsumerHandle>, and [[AM_services|AppletResourceUserId]]. Returns two output u64s.
+
Takes a PID-descriptor, an type-0x46 buffer, two s64s width/height, then two u64s: <output from [[AM_services|AM]] GetIndirectLayerConsumerHandle>, and [[AM_services|AppletResourceUserId]]. Returns two output s64s, which are copied to output u64s by official sw.
 +
 
 +
Official sw sets the width/height using input s32s.
 +
 
 +
Calls the same func as [[#GetIndirectLayerImageCropMap]] internally, with the input floats set to 0.0f, then 1.0f for the rest.
  
 
== GetIndirectLayerImageCropMap ==
 
== GetIndirectLayerImageCropMap ==
Line 301: Line 516:
  
 
== GetIndirectLayerImageRequiredMemoryInfo ==
 
== GetIndirectLayerImageRequiredMemoryInfo ==
Takes two input u64s: with and height. Returns two output u64s. First u64 is the buffer size to use with the ImageMap cmds.
+
Takes two input s64s: width and height. Returns two output s64s, which are copied to output u64s by official sw. First field is the buffer size to use with the ImageMap cmds, second field is the buffer address alignment for those cmds.
 +
 
 +
Official sw sets the width/height using input s32s.
  
 
== GetDisplayVsyncEvent ==
 
== GetDisplayVsyncEvent ==
Line 322: Line 539:
 
| 1203 || GetDisplayLogicalResolution
 
| 1203 || GetDisplayLogicalResolution
 
|-
 
|-
| 1204 || SetDisplayMagnification
+
| 1204 || [3.0.0+] SetDisplayMagnification
 
|-
 
|-
 
| 2201 || SetLayerPosition
 
| 2201 || SetLayerPosition
Line 336: Line 553:
 
| 2209 || SetLayerAlpha
 
| 2209 || SetLayerAlpha
 
|-
 
|-
| 2312 || CreateStrayLayer
+
| 2210 || [11.0.0-11.0.1] SetLayerPositionAndSize
 +
|-
 +
| 2312 || [1.0.0-6.2.0] CreateStrayLayer
 
|-
 
|-
 
| 2400 || OpenIndirectLayer
 
| 2400 || OpenIndirectLayer
Line 381: Line 600:
 
|-
 
|-
 
| 3217 || SetDisplayCmuLuma
 
| 3217 || SetDisplayCmuLuma
 +
|-
 +
| 3218 || [11.0.0+] SetDisplayCrcMode
 +
|-
 +
| 6013 || [10.0.0+] GetLayerPresentationSubmissionTimestamps
 
|-
 
|-
 
| 8225 || [4.0.0+] GetSharedBufferMemoryHandleId
 
| 8225 || [4.0.0+] GetSharedBufferMemoryHandleId
Line 401: Line 624:
 
|-
 
|-
 
| 8258 || [5.0.0+] CancelSharedFrameBuffer
 
| 8258 || [5.0.0+] CancelSharedFrameBuffer
 +
|-
 +
| 9000 || [11.0.0+] [[#GetDp2hdmiController]]
 +
|}
 +
 +
=== GetDp2hdmiController ===
 +
No input, returns an [[#IDp2hdmiController]].
 +
 +
=== IDp2hdmiController ===
 +
This is "nn::dp2hdmi::detail::IDp2hdmiController".
 +
 +
This was added with [11.0.0+].
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || GetFirmwareVersion
 +
|-
 +
| 1 || GetAvailableFirmwareVersion
 +
|-
 +
| 2 || CheckFirmwareUpdateRequired
 +
|-
 +
| 3 || StartFirmwareUpdate
 +
|-
 +
| 4 || StartFirmwareUpdateWithSpecifiedImage
 +
|-
 +
| 5 || GetFirmwareUpdateState ([11.0.0-11.0.1] OverwriteFirmware)
 +
|-
 +
| 6 || ResetDevice ([11.0.0-11.0.1] OverwriteFirmwareWithSpecifiedImage)
 +
|-
 +
| 7 || [16.0.0-18.1.0] StartBootFirmwareUpdate ([11.0.0-11.0.1] GetFirmwareUpdateState)
 +
|-
 +
| 8 || [16.0.0+] StartBootFirmwareUpdateWithSpecifiedImage ([11.0.0-11.0.1] ResetDevice)
 +
|-
 +
| 9 || [17.0.0+] GetBootFirmwareVersion
 
|}
 
|}
  
Line 414: Line 672:
 
| 201 || [4.0.0+] FreeProcessHeapBlock
 
| 201 || [4.0.0+] FreeProcessHeapBlock
 
|-
 
|-
| 1102 || GetDisplayResolution
+
| 1102 || [3.0.0+] GetDisplayResolution
 
|-
 
|-
 
| 2010 || CreateManagedLayer
 
| 2010 || CreateManagedLayer
 
|-
 
|-
 
| 2011 || DestroyManagedLayer
 
| 2011 || DestroyManagedLayer
 +
|-
 +
| 2012 || [7.0.0+] CreateStrayLayer
 
|-
 
|-
 
| 2050 || CreateIndirectLayer
 
| 2050 || CreateIndirectLayer
Line 431: Line 691:
 
|-
 
|-
 
| 2055 || DestroyIndirectConsumerEndPoint
 
| 2055 || DestroyIndirectConsumerEndPoint
 +
|-
 +
| 2060 || [16.0.0+] CreateWatermarkCompositor
 +
|-
 +
| 2062 || [16.0.0+] SetWatermarkText
 +
|-
 +
| 2063 || [16.0.0+] SetWatermarkLayerStacks
 
|-
 
|-
 
| 2300 || AcquireLayerTexturePresentingEvent
 
| 2300 || AcquireLayerTexturePresentingEvent
Line 437: Line 703:
 
|-
 
|-
 
| 2302 || GetDisplayHotplugEvent
 
| 2302 || GetDisplayHotplugEvent
 +
|-
 +
| 2303 || [5.1.0+] GetDisplayModeChangedEvent
 
|-
 
|-
 
| 2402 || GetDisplayHotplugState
 
| 2402 || GetDisplayHotplugState
Line 443: Line 711:
 
|-
 
|-
 
| 2601 || [4.0.0+] GetDisplayErrorEvent
 
| 2601 || [4.0.0+] GetDisplayErrorEvent
 +
|-
 +
| 2701 || [11.0.0+] GetDisplayFatalErrorEvent
 
|-
 
|-
 
| 4201 || SetDisplayAlpha
 
| 4201 || SetDisplayAlpha
Line 451: Line 721:
 
|-
 
|-
 
| 4206 || [4.0.0+] SetDefaultDisplay
 
| 4206 || [4.0.0+] SetDefaultDisplay
 +
|-
 +
| 4207 || [11.0.0+] ResetDisplayPanel
 +
|-
 +
| 4208 || [11.0.0+] [[#SetDisplayFatalErrorEnabled]] ([11.0.0-11.0.1] EnableDisplayFatalError)
 +
|-
 +
| 4209 || [12.0.0+] IsDisplayPanelOn
 +
|-
 +
| 4300 || [11.0.0+] GetInternalPanelId
 
|-
 
|-
 
| 6000 || AddToLayerStack
 
| 6000 || AddToLayerStack
Line 473: Line 751:
 
|-
 
|-
 
| 6010 || [5.0.0+] GetLayerPresentationAllFencesExpiredEvent
 
| 6010 || [5.0.0+] GetLayerPresentationAllFencesExpiredEvent
 +
|-
 +
| 6011 || [7.0.0+] EnableLayerAutoClearTransitionBuffer
 +
|-
 +
| 6012 || [7.0.0+] DisableLayerAutoClearTransitionBuffer
 +
|-
 +
| 6013 || [13.0.0+] SetLayerOpacity
 +
|-
 +
| 6014 || [16.0.0+] AttachLayerWatermarkCompositor
 +
|-
 +
| 6015 || [16.0.0+] DetachLayerWatermarkCompositor
 
|-
 
|-
 
| 7000 || SetContentVisibility
 
| 7000 || SetContentVisibility
 
|-
 
|-
 
| 8000 || SetConductorLayer
 
| 8000 || SetConductorLayer
 +
|-
 +
| 8001 || [8.0.0+] SetTimestampTracking
 
|-
 
|-
 
| 8100 || SetIndirectProducerFlipOffset
 
| 8100 || SetIndirectProducerFlipOffset
Line 528: Line 818:
 
| 8292 || [4.0.0+] FillDetachedSharedFrameBufferColor
 
| 8292 || [4.0.0+] FillDetachedSharedFrameBufferColor
 
|-
 
|-
| 8293 || [4.0.0+] GetDetachedSharedFrameBufferImage
+
| 8293 || [4.0.0+] [[#GetDetachedSharedFrameBufferImage]]
 
|-
 
|-
 
| 8294 || [4.0.0+] SetDetachedSharedFrameBufferImage
 
| 8294 || [4.0.0+] SetDetachedSharedFrameBufferImage
Line 540: Line 830:
 
| 8298 || [5.0.0+] ExpandStartupLogoOnSharedFrameBuffer
 
| 8298 || [5.0.0+] ExpandStartupLogoOnSharedFrameBuffer
 
|}
 
|}
 +
 +
[10.0.0+] AttachLayerPresentationTracer now takes an additional 8-bytes of input.
 +
 +
[5.0.0+] SetDetachedSharedFrameBufferImage now takes an additional 0x10-bytes of input. CopyDetachedSharedFrameBufferImage now takes an additional 0x18-bytes of input. SetDetachedSharedFrameBufferSubImage now takes an additional 0x10-bytes of input, and the buffer type was changed from 0x5 to 0x45.
 +
 +
=== GetDetachedSharedFrameBufferImage ===
 +
Takes a total of 0x10-bytes of input and a type-0x6 output buffer, returns a total of 8-bytes of output.
 +
 +
[15.0.0+] Now takes a total of 0x28-bytes of input and a type-0x6 output buffer, returns a total of 8-bytes of output.
 +
 +
== SetDisplayFatalErrorEnabled ==
 +
Takes an input u64, no output.
 +
 +
[12.0.0+] Takes an input bool and u64, no output.
 +
 +
= lbl =
 +
This is "nn::lbl::detail::ILblController".
 +
 +
[11.0.0+] this was moved from [[PTM_services|ptm]].
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Cmd || Name
 +
|-
 +
| 0 || SaveCurrentSetting
 +
|-
 +
| 1 || LoadCurrentSetting
 +
|-
 +
| 2 || SetCurrentBrightnessSetting
 +
|-
 +
| 3 || GetCurrentBrightnessSetting
 +
|-
 +
| 4 || ApplyCurrentBrightnessSettingToBacklight
 +
|-
 +
| 5 || GetBrightnessSettingAppliedToBacklight
 +
|-
 +
| 6 || SwitchBacklightOn
 +
|-
 +
| 7 || SwitchBacklightOff
 +
|-
 +
| 8 || GetBacklightSwitchStatus
 +
|-
 +
| 9 || EnableDimming
 +
|-
 +
| 10 || DisableDimming
 +
|-
 +
| 11 || IsDimmingEnabled
 +
|-
 +
| 12 || EnableAutoBrightnessControl
 +
|-
 +
| 13 || DisableAutoBrightnessControl
 +
|-
 +
| 14 || IsAutoBrightnessControlEnabled
 +
|-
 +
| 15 || SetAmbientLightSensorValue
 +
|-
 +
| 16 || [[#GetAmbientLightSensorValue]]
 +
|-
 +
| 17 || SetBrightnessReflectionDelayLevel
 +
|-
 +
| 18 || GetBrightnessReflectionDelayLevel
 +
|-
 +
| 19 || SetCurrentBrightnessMapping
 +
|-
 +
| 20 || GetCurrentBrightnessMapping
 +
|-
 +
| 21 || SetCurrentAmbientLightSensorMapping
 +
|-
 +
| 22 || GetCurrentAmbientLightSensorMapping
 +
|-
 +
| 23 || [3.0.0+] IsAmbientLightSensorAvailable
 +
|-
 +
| 24 || [3.0.0+] SetCurrentBrightnessSettingForVrMode
 +
|-
 +
| 25 || [3.0.0+] GetCurrentBrightnessSettingForVrMode
 +
|-
 +
| 26 || [3.0.0+] [[#EnableVrMode]]
 +
|-
 +
| 27 || [3.0.0+] [[#DisableVrMode]]
 +
|-
 +
| 28 || [3.0.0+] [[#IsVrModeEnabled]]
 +
|-
 +
| 29 || [7.0.0+] IsAutoBrightnessControlSupported
 +
|}
 +
 +
== GetAmbientLightSensorValue ==
 +
No input. Outputs lux in float.
 +
 +
[5.0.0+] Now returns an output [[#AmbientLightSensorValue]].
 +
 +
== GetCurrentBrightnessSetting ==
 +
No input. Returns an output u32 int of the current backlight level.
 +
 +
== GetBrightnessSettingAppliedToBacklight ==
 +
No input. Returns an output u32 int of the backlight level computed from the ambient light sensor.
 +
 +
== IsAutoBrightnessControlEnabled ==
 +
No input. Returns an output u8 bool indicating whether auto brightness is enabled.
 +
 +
== EnableVrMode ==
 +
No input/output. Used by [[AM_services#SetVrModeEnabled]].
 +
 +
Sets a global state field to 0x1.
 +
 +
== DisableVrMode ==
 +
No input/output. Used by [[AM_services#SetVrModeEnabled]].
 +
 +
Sets the global state field used by [[#EnableVrMode]] to 0x0.
 +
 +
== IsVrModeEnabled ==
 +
No input. Returns an output u8 bool set by the above commands.
 +
 +
= Module =
 +
This is "nn::mmnv::Module".
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Value || Name
 +
|-
 +
| 0 || Cpu
 +
|-
 +
| 1 || Gpu
 +
|-
 +
| 2 || Emc
 +
|-
 +
| 3 || SysBus
 +
|-
 +
| 4 || Mselect
 +
|-
 +
| 5 || Nvdec
 +
|-
 +
| 6 || Nvenc
 +
|-
 +
| 7 || Nvjpg
 +
|-
 +
| 8 || Test
 +
|}
 +
 +
= Priority =
 +
This is "nn::mmnv::Priority". This is an u32.
 +
 +
= Setting =
 +
This is "nn::mmnv::Setting". This is an u32.
  
 
= DisplayInfo =
 
= DisplayInfo =
 +
This is "nn::vi::DisplayInfo". This is a 0x60-byte structure.
 +
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
 
! Offset || Size || Description
 
! Offset || Size || Description
 
|-
 
|-
| 0x0 || 0x40 || [[#DisplayName]]
+
| 0x0 || 0x40 || [[#DisplayName|Name]]
 
|-
 
|-
| 0x40 || 0x1 || Whether or not the display has a constrained number of layers.
+
| 0x40 || 0x1 || HasLayerLimit
 
|-
 
|-
| 0x41 || 0x7 || Padding/Reserved
+
| 0x41 || 0x7 || Reserved
 
|-
 
|-
| 0x48 || 0x8 || If this display has a constrained number of layers (0x40 is set), indicates the maximum number of layers.
+
| 0x48 || 0x8 || LayerCountMax
 
|-
 
|-
| 0x50 || 0x8 || Width in pixels
+
| 0x50 || 0x8 || LayerWidthPixelCountMax
 
|-  
 
|-  
| 0x58 || 0x8 || Height in pixels
+
| 0x58 || 0x8 || LayerHeightPixelCountMax
 
|}
 
|}
 
This is a 0x60-byte structure.
 
  
 
The width/height for the "Default" Display is the resolution for 1080p even when in handheld-mode.
 
The width/height for the "Default" Display is the resolution for 1080p even when in handheld-mode.
  
 
= DisplayName =
 
= DisplayName =
This is a 0x40-byte block: a NUL-terminated string.
+
This is "nn::vi::DisplayName". This is a 0x40-byte block: a NUL-terminated string.
 +
 
 +
Can be "Default", "External", "[https://en.wikipedia.org/wiki/Extended_Display_Identification_Data Edid]", "Internal" or "Null".
 +
 
 +
= NativeWindow =
 +
Max size of this buffer is 0x100-bytes(outbuf size used by official user-processes). Parsed("...DeserializeNativeWindow()") by a function called by the code described under [[#OpenLayer]], which executes code with Android symbols.
  
Can be "Default", "External", "Edid", "Internal" or "Null".
+
This is a [[#Parcel]].
  
 
= Parcel =
 
= Parcel =
Line 583: Line 1,021:
 
| 0x10 || ? || FlattenedBinder
 
| 0x10 || ? || FlattenedBinder
 
|}
 
|}
 
= NativeWindow =
 
Max size of this buffer is 0x100-bytes(outbuf size used by official user-processes). Parsed("...DeserializeNativeWindow()") by a function called by the code described under [[#OpenLayer]], which executes code with Android symbols.
 
 
This is a [[#Parcel]].
 
  
 
== ParcelData ==
 
== ParcelData ==
Line 614: Line 1,047:
 
This normally contains an u32 with value 0?
 
This normally contains an u32 with value 0?
  
= Resolution handling =
+
= AmbientLightSensorValue =
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x4 || bOverLimit. (u32) Equals to 1 if visible or IR light data is over 65534.
 +
|-
 +
| 0x4 || 0x4 || fLux. (float) Value in lux from the ambient light sensor.
 +
|}
 +
Note: if bOverLimit=1 and the default ALS configuration is used, the measurement of fLux should not be considered and the actual max value depends on the type of light. Ranges from 12.5K - 17.5K.
 +
 
 +
= Notes =
 +
== Resolution Handling ==
 
There doesn't seem to be a way to get the actual TV resolution while using the "Default" Display. Official apps just hard-code what resolution to use depending on the current [[AM_services|OperationMode]].
 
There doesn't seem to be a way to get the actual TV resolution while using the "Default" Display. Official apps just hard-code what resolution to use depending on the current [[AM_services|OperationMode]].
 +
 +
== Ambient Light Sensor ==
 +
The BH1730 outputs 2 values. Visible light and IR light. This is then calculated through an algorithm that checks for Gain, Measurement time, filter qualities and ouputs lux (max correct measurement of 100K lux).
 +
The default values are Gain 64x and ITIME of 38 (256 - 218). This allows for a max lux value of 17972 lux when visible light value is maximum and IR light is 0. When both of them are on their limit, the output is 1192 lux.
 +
The sensor is fully configurable.
  
 
[[Category:Services]]
 
[[Category:Services]]

Latest revision as of 04:13, 23 October 2024

The only image data contained in this sysmodule is basically a saved display framebuffer, no image data for actively-used layers/framebuffers.

caps:sc

This is "nn::capsrv::sf::IScreenShotControlService".

This was added with [2.0.0+].

Cmd Name
1 #CaptureRawImageRgba32IntoArray
2 #CaptureRawImageRgba32IntoArrayWithTimeout
3 [5.0.0+] #AttachSharedBufferToCaptureModule
5 [5.0.0+] #CaptureRawImageToAttachedSharedBuffer
210 [6.0.0+] #SaveScreenShotEx2ViaAm
1001 [2.0.0-4.1.0] #RequestTakingScreenShot
1002 [2.0.0-4.1.0] #RequestTakingScreenShotWithTimeout
1003 [3.0.0-4.1.0] #RequestTakingScreenShotEx
1004 [5.0.0+] #RequestTakingScreenShotEx1
1009 [5.0.0+] #CancelTakingScreenShot
1010 [5.0.0+] #SetTakingScreenShotCancelState
1011 #NotifyTakingScreenShotRefused
1012 #NotifyTakingScreenShotFailed
1100 [18.0.0+]
1101 [4.0.0+] #SetupOverlayMovieThumbnail
1106 [4.0.0+] #CreateProtoMovieMetaDataNv12Ex2
1107 [4.0.0+] #CreateProtoMovieMetaDataRgbaEx2
1108 [18.0.0+]
1109 [19.0.0+]
1110 [19.0.0+]
1111 [19.0.0+]
1112 [19.0.0+]
1113 [19.0.0+]
1114 [19.0.0+]
1201 [3.0.0+] #OpenRawScreenShotReadStream
1202 [3.0.0+] #CloseRawScreenShotReadStream
1203 [3.0.0+] #ReadRawScreenShotReadStream
1204 [9.0.0+] #CaptureCrashScreenShot

The only caps:sc commands used by GRC are: 1101, 1106, and 1107.

CaptureRawImageRgba32IntoArray

Takes a type-0x46 output buffer, an input u32 layer_stack, two input u64s width/height, an input s64 buffer_count, and an input s64 buffer_index.

width/height must match 1280/720. buffer_index must be < buffer_count. buffer_index and buffer_count must not be negative.

buffer_index and buffer_count correspond to buffers with size 0x384000(1280*720*4).

Value 0 is usable for the input u32.

This takes a screenshot, the output buffer contains the RGBA8 image.

Stubbed with [5.0.0+], where it now returns error 0x7FECE.

CaptureRawImageRgba32IntoArrayWithTimeout

Calls the same internal func as #CaptureRawImageRgba32IntoArray, where the last param is an additional cmd input u64 instead of hard-coded value 0x5f5e100.

Stubbed with [5.0.0+], where it now returns error 0x7FECE.

AttachSharedBufferToCaptureModule

Takes a total of 8-bytes of input. No output.

CaptureRawImageToAttachedSharedBuffer

Takes a total of 0x10-bytes of input. No output.

SaveScreenShotEx2ViaAm

Takes a total of 0x50-bytes of input, a type-0x15 input buffer, and a type-0x45 input buffer, returns a total of 0x20-bytes of output.

User-processes use hard-coded size 0x88 for the type-0x15 buffer.

[8.0.0+] Now takes an additional type-0x15 input buffer.

RequestTakingScreenShot

Takes a total of 0x10-bytes of input. No output.

RequestTakingScreenShotWithTimeout

Takes a total of 0x18-bytes of input. No output.

RequestTakingScreenShotEx

Takes a total of 0x58-bytes of input. No output.

RequestTakingScreenShotEx1

Takes a total of 0x60-bytes of input. No output.

[6.0.0+] In addition, this also takes a type-0x15 input buffer.

[8.0.0+] Now takes an additional type-0x15 input buffer.

[11.0.0+] Now takes an additional 8-bytes of input.

[19.0.0+] Now takes another additional 8-bytes of input.

CancelTakingScreenShot

Takes a total of 0x10-bytes of input. No output.

SetTakingScreenShotCancelState

Takes a total of 0x10-bytes of input. No output.

NotifyTakingScreenShotRefused

Takes a total of 8-bytes of input. No output.

NotifyTakingScreenShotFailed

Takes a total of 8-bytes of input. No output.

SetupOverlayMovieThumbnail

Takes two input u64s width/height, a 0x18-byte input struct, and two type-0x46 output buffers.

For the input struct, GRC uses the output from caps:c cmd2101.

width/height must be 1280x720. The first buffer address must be 0x400-byte aligned. The size of the first buffer must be at least width*height, and must be aligned to 0x20000-bytes.

The requirements for the second buffer address/size are the same as the first buffer, except the minimum size is (width*height)/2.

CreateProtoMovieMetaDataNv12Ex2

Takes a 0x40-byte input struct, two input u64s width/height, a 0x18-byte input struct, two type-0x15 input buffers, a type-0x6 output buffer, and two type-0x46 output buffers, returns 3 output u64s.

width/height have same requirements as #SetupOverlayMovieThumbnail. The size of the type-0x6 buffer must be at least 0x7D000. The requirements for the type-0x46 buffers are the same as #SetupOverlayMovieThumbnail.

User-processes use hard-coded sizes 0x400 and 0x404 for the first/second type-0x15 buffers.

[5.0.0+] Now takes a total of 0x68-bytes of input instead of 0x30.

[19.0.0+] Now takes an additional 0x10-bytes of input.

CreateProtoMovieMetaDataRgbaEx2

Takes a 0x40-byte input struct, two input u64s width/height, a 0x18-byte input struct, two type-0x15 input buffers, a type-0x6 output buffer, and a type-0x45 input buffer, returns 3 output u64s.

width/height have same requirements as #SetupOverlayMovieThumbnail. The size of the type-0x6 buffer must be at least 0x7D000. The size of the type-0x45 buffer must be at least 0x384000.

User-processes use hard-coded sizes 0x400 and 0x404 for the first/second type-0x15 buffers.

[5.0.0+] Now takes a total of 0x68-bytes of input instead of 0x30.

[19.0.0+] Now takes an additional 0x10-bytes of input.

Cmd1108

Takes a total of 0x70-bytes of input, three type-0x15 input buffers, a type-0x6 output buffer. Returns a total of 0x18-bytes of output.

[19.0.0+] Now takes an additional 0x10-bytes of input.

OpenRawScreenShotReadStream

Takes a total of 0x10-bytes of input. Returns a total of 0x18-bytes of output.

Only usable when the previously loaded value from set:sys GetDebugModeFlag is set.

CloseRawScreenShotReadStream

No input/output.

Only usable when the previously loaded value from set:sys GetDebugModeFlag is set.

ReadRawScreenShotReadStream

Takes a total of 8-bytes of input and a type-0x6 output buffer. Returns a total of 8-bytes of output.

Only usable when the previously loaded value from set:sys GetDebugModeFlag is set.

CaptureCrashScreenShot

Takes a total of 0x10-bytes of input and a type-0x46 output buffer. Returns a total of 8-bytes of output.

Also required the mentioned debug flag but does no longer as of [10.0.0].

caps:ss

This is "nn::capsrv::sf::IScreenShotService".

This was added with [2.0.0+].

Cmd Name
201 SaveScreenShot
202 SaveEditedScreenShot
203 [3.0.0+] SaveScreenShotEx0
204 [3.0.0+] SaveEditedScreenShotEx0
206 [4.0.0+] SaveEditedScreenShotEx1
208 [5.0.0+] SaveScreenShotOfMovieEx1
1000 [13.0.0+] #RequestTakingScreenShotForApplet

RequestTakingScreenShotForApplet

Takes a total of 0x68-bytes of input, two type-0x15 input buffers. Returns a total of 0x20-bytes of output.

[19.0.0+] Now takes an additional 8-bytes of input.

caps:su

This is "nn::capsrv::sf::IScreenShotApplicationService".

This was added with [3.0.0+].

[6.0.0+] This was moved to AM.

Cmd Name
201 SaveScreenShot
203 SaveScreenShotEx0

cec-mgr

This is "nn::cec::ICecManager".

Cmd Name
0 RegisterCallback
1 UnregisterCallback
2 TriggerSystemEvent
3 PerformAction
4 QueryState
5 OnSystemEvent
6 [2.0.0+] CancelCurrentCall
100 [4.0.0+] #GetHdcpServiceObject

GetHdcpServiceObject

No input. Returns a #IHdcpController.

IHdcpController

This is "nn::hdcp::detail::IHdcpController".

This was added with [4.0.0+].

Cmd Name
0 GetHdcpStateTransitionEvent
1 GetHdcpAuthenticationState
2 SetCurrentHdcpMode
3 GetCurrentHdcpMode

mm:u

This is "nn::mmnv::IRequest".

Cmd Name
0 #InitializeOld
1 #FinalizeOld
2 #SetAndWaitOld
3 #GetOld
4 #Initialize
5 #Finalize
6 #SetAndWait
7 #Get

InitializeOld

Takes an input #Module, an input #Priority and an input u32 EventClearMode. No output.

FinalizeOld

Takes an input #Module. No output.

SetAndWaitOld

Takes an input #Module and two input #Setting Min and Max. No output.

GetOld

Takes an input #Module. Returns an output #Setting Current.

Initialize

Same as #InitializeOld, but returns an output u32 RequestId.

Finalize

Same as #FinalizeOld, but takes an input u32 RequestId instead of an input #Module.

SetAndWait

Same as #SetAndWaitOld, but takes an input u32 RequestId instead of an input #Module.

Get

Same as #GetOld, but takes an input u32 RequestId instead of an input #Module.

vi:u

This is "nn::visrv::sf::IApplicationRootService".

Cmd Name
0 GetDisplayService
1 [9.0.0+] GetDisplayServiceWithProxyNameExchange

GetDisplayService

Returns an #IApplicationDisplayService. Takes an input u32, user-processes use 0 or 1, with 0 for regular-applications normally. 0 = user-service(vi:u), 1 = system/manager service (vi:s/vi:m). Returns an error when using value 1 with vi:u(same error listed below for IApplicationDisplayService for unavailable commands), however passing 1 to vi:s/vi:m results in the IApplicationDisplayService having greater privileges.

GetDisplayServiceWithProxyNameExchange

Takes an input u32, and returns an #IApplicationDisplayService.

vi:s

This is "nn::visrv::sf::ISystemRootService".

Cmd Name
1 GetDisplayService
3 GetDisplayServiceWithProxyNameExchange

GetDisplayService

Returns an #IApplicationDisplayService. Same input as vi:u.

GetDisplayServiceWithProxyNameExchange

Returns an #IApplicationDisplayService.

vi:m

This is "nn::visrv::sf::IManagerRootService".

Cmd Name
2 GetDisplayService
3 GetDisplayServiceWithProxyNameExchange
100 [16.0.0+] PrepareFatal
101 [16.0.0+] ShowFatal
102 [16.0.0+] DrawFatalRectangle
103 [16.0.0+] DrawFatalText32

GetDisplayService

Returns an #IApplicationDisplayService. Same input as vi:u.

GetDisplayServiceWithProxyNameExchange

Takes an input u64 and u32. Returns an #IApplicationDisplayService.

IApplicationDisplayService

This is "nn::visrv::sf::IApplicationDisplayService".

Cmd Name
100 #GetRelayService
101 #GetSystemDisplayService
102 #GetManagerDisplayService
103 [2.0.0+] #GetIndirectDisplayTransactionService
1000 #ListDisplays
1010 #OpenDisplay
1011 #OpenDefaultDisplay
1020 #CloseDisplay
1101 #SetDisplayEnabled
1102 #GetDisplayResolution
2020 #OpenLayer
2021 #CloseLayer
2030 #CreateStrayLayer
2031 #DestroyStrayLayer
2101 #SetLayerScalingMode
2102 [5.0.0+] ConvertScalingMode
2450 #GetIndirectLayerImageMap
2451 #GetIndirectLayerImageCropMap
2460 #GetIndirectLayerImageRequiredMemoryInfo
5202 #GetDisplayVsyncEvent
5203 #GetDisplayVsyncEventForDebug

Available sessions for each service:

  • "vi:u": Only GetRelayService.
  • "vi:s": Everything except GetManagerDisplayService.
  • "vi:m": All.

When attempting to use a get-session cmd with a service it's not available with, error 0xA72 is returned.

These commands using PIDs have AppletResourceUserId as the last input u64, hence AppletResourceUserId must match the user-process PID(no special handling for value 0).

GetRelayService

Returns an IHOSBinderDriver interface which abstracts "nn::visrv::service::RelayServiceImpl".

GetIndirectDisplayTransactionService

Returns an IHOSBinderDriver interface which abstracts "nn::visrv::service::IndirectDisplayTransactionServiceImpl".

GetSystemDisplayService

Returns an #ISystemDisplayService.

GetManagerDisplayService

Returns an #IManagerDisplayService.

ListDisplays

Takes a type-0x6 output buffer containing the array of #DisplayInfo output entries. Returns an output u64: total number of output entries.

Normally(?) this only returns the "Default" display.

OpenDisplay

Takes a #DisplayName as input. Returns an output u64, the DisplayId.

To open the default display, input string "Default" can be used.

OpenDefaultDisplay

Returns an output u64.

Probably not (?) used by newer official user-processes, since those use OpenDisplay with the default string instead.

CloseDisplay

Takes an input u64, DisplayId.

SetDisplayEnabled

Takes an input u32 boolean, and an u64 DisplayId.

GetDisplayResolution

Takes an input u64 DisplayId and returns two output s64s: width and height. Official sw copies these to s32 output fields.

OpenLayer

Takes a PID-descriptor, a type-0x6 buffer for the output #NativeWindow, a #DisplayName(which was previously used with #OpenDisplay), an u64 LayerId, and an u64 AppletResourceUserId. Returns an output u64 NativeWindow_Size.

Official user-processes use a LayerId stored in a global state field("...ExternalLayerId") if non-zero, otherwise:

This OpenLayer command returns error 0x272 when the AppletResourceUserId is invalid.

CloseLayer

Takes an input u64: LayerId which was used with #OpenLayer.

CreateStrayLayer

Takes a type-0x6 buffer for the output #NativeWindow, an u32(LayerFlags bitmask), and an u64 DisplayId. Returns two output u64s: LayerId and NativeWindow_Size.

DestroyStrayLayer

Takes an input u64: LayerId from #CreateStrayLayer.

SetLayerScalingMode

Takes an input u64("ScalingMode") and u64 ("LayerId").

GetIndirectLayerImageMap

Takes a PID-descriptor, an type-0x46 buffer, two s64s width/height, then two u64s: <output from AM GetIndirectLayerConsumerHandle>, and AppletResourceUserId. Returns two output s64s, which are copied to output u64s by official sw.

Official sw sets the width/height using input s32s.

Calls the same func as #GetIndirectLayerImageCropMap internally, with the input floats set to 0.0f, then 1.0f for the rest.

GetIndirectLayerImageCropMap

Takes a PID-descriptor, an type-0x46 buffer, four floats, four u64s(last u64 is AppletResourceUserId). Returns two output u64s. The floats are stored immediately after each other(32bits).

GetIndirectLayerImageRequiredMemoryInfo

Takes two input s64s: width and height. Returns two output s64s, which are copied to output u64s by official sw. First field is the buffer size to use with the ImageMap cmds, second field is the buffer address alignment for those cmds.

Official sw sets the width/height using input s32s.

GetDisplayVsyncEvent

Takes an input u64 DisplayId and returns a handle.

GetDisplayVsyncEventForDebug

Takes an input u64 DisplayId and returns a handle.

ISystemDisplayService

This is "nn::visrv::sf::ISystemDisplayService".

Cmd Name
1200 GetZOrderCountMin
1202 GetZOrderCountMax
1203 GetDisplayLogicalResolution
1204 [3.0.0+] SetDisplayMagnification
2201 SetLayerPosition
2203 SetLayerSize
2204 GetLayerZ
2205 SetLayerZ
2207 SetLayerVisibility
2209 SetLayerAlpha
2210 [11.0.0-11.0.1] SetLayerPositionAndSize
2312 [1.0.0-6.2.0] CreateStrayLayer
2400 OpenIndirectLayer
2401 CloseIndirectLayer
2402 FlipIndirectLayer
3000 ListDisplayModes
3001 ListDisplayRgbRanges
3002 ListDisplayContentTypes
3200 GetDisplayMode
3201 SetDisplayMode
3202 GetDisplayUnderscan
3203 SetDisplayUnderscan
3204 GetDisplayContentType
3205 SetDisplayContentType
3206 GetDisplayRgbRange
3207 SetDisplayRgbRange
3208 GetDisplayCmuMode
3209 SetDisplayCmuMode
3210 GetDisplayContrastRatio
3211 SetDisplayContrastRatio
3214 GetDisplayGamma
3215 SetDisplayGamma
3216 GetDisplayCmuLuma
3217 SetDisplayCmuLuma
3218 [11.0.0+] SetDisplayCrcMode
6013 [10.0.0+] GetLayerPresentationSubmissionTimestamps
8225 [4.0.0+] GetSharedBufferMemoryHandleId
8250 [4.0.0+] OpenSharedLayer
8251 [4.0.0+] CloseSharedLayer
8252 [4.0.0+] ConnectSharedLayer
8253 [4.0.0+] DisconnectSharedLayer
8254 [4.0.0+] AcquireSharedFrameBuffer
8255 [4.0.0+] PresentSharedFrameBuffer
8256 [4.0.0+] GetSharedFrameBufferAcquirableEvent
8257 [4.0.0+] FillSharedFrameBufferColor
8258 [5.0.0+] CancelSharedFrameBuffer
9000 [11.0.0+] #GetDp2hdmiController

GetDp2hdmiController

No input, returns an #IDp2hdmiController.

IDp2hdmiController

This is "nn::dp2hdmi::detail::IDp2hdmiController".

This was added with [11.0.0+].

Cmd Name
0 GetFirmwareVersion
1 GetAvailableFirmwareVersion
2 CheckFirmwareUpdateRequired
3 StartFirmwareUpdate
4 StartFirmwareUpdateWithSpecifiedImage
5 GetFirmwareUpdateState ([11.0.0-11.0.1] OverwriteFirmware)
6 ResetDevice ([11.0.0-11.0.1] OverwriteFirmwareWithSpecifiedImage)
7 [16.0.0-18.1.0] StartBootFirmwareUpdate ([11.0.0-11.0.1] GetFirmwareUpdateState)
8 [16.0.0+] StartBootFirmwareUpdateWithSpecifiedImage ([11.0.0-11.0.1] ResetDevice)
9 [17.0.0+] GetBootFirmwareVersion

IManagerDisplayService

This is "nn::visrv::sf::IManagerDisplayService".

Cmd Name
200 [4.0.0+] AllocateProcessHeapBlock
201 [4.0.0+] FreeProcessHeapBlock
1102 [3.0.0+] GetDisplayResolution
2010 CreateManagedLayer
2011 DestroyManagedLayer
2012 [7.0.0+] CreateStrayLayer
2050 CreateIndirectLayer
2051 DestroyIndirectLayer
2052 CreateIndirectProducerEndPoint
2053 DestroyIndirectProducerEndPoint
2054 CreateIndirectConsumerEndPoint
2055 DestroyIndirectConsumerEndPoint
2060 [16.0.0+] CreateWatermarkCompositor
2062 [16.0.0+] SetWatermarkText
2063 [16.0.0+] SetWatermarkLayerStacks
2300 AcquireLayerTexturePresentingEvent
2301 ReleaseLayerTexturePresentingEvent
2302 GetDisplayHotplugEvent
2303 [5.1.0+] GetDisplayModeChangedEvent
2402 GetDisplayHotplugState
2501 [4.0.0+] GetCompositorErrorInfo
2601 [4.0.0+] GetDisplayErrorEvent
2701 [11.0.0+] GetDisplayFatalErrorEvent
4201 SetDisplayAlpha
4203 SetDisplayLayerStack
4205 SetDisplayPowerState
4206 [4.0.0+] SetDefaultDisplay
4207 [11.0.0+] ResetDisplayPanel
4208 [11.0.0+] #SetDisplayFatalErrorEnabled ([11.0.0-11.0.1] EnableDisplayFatalError)
4209 [12.0.0+] IsDisplayPanelOn
4300 [11.0.0+] GetInternalPanelId
6000 AddToLayerStack
6001 RemoveFromLayerStack
6002 SetLayerVisibility
6003 [5.0.0+] SetLayerConfig
6004 [5.0.0+] AttachLayerPresentationTracer
6005 [5.0.0+] DetachLayerPresentationTracer
6006 [5.0.0+] StartLayerPresentationRecording
6007 [5.0.0+] StopLayerPresentationRecording
6008 [5.0.0+] StartLayerPresentationFenceWait
6009 [5.0.0+] StopLayerPresentationFenceWait
6010 [5.0.0+] GetLayerPresentationAllFencesExpiredEvent
6011 [7.0.0+] EnableLayerAutoClearTransitionBuffer
6012 [7.0.0+] DisableLayerAutoClearTransitionBuffer
6013 [13.0.0+] SetLayerOpacity
6014 [16.0.0+] AttachLayerWatermarkCompositor
6015 [16.0.0+] DetachLayerWatermarkCompositor
7000 SetContentVisibility
8000 SetConductorLayer
8001 [8.0.0+] SetTimestampTracking
8100 SetIndirectProducerFlipOffset
8200 [4.0.0+] CreateSharedBufferStaticStorage
8201 [4.0.0+] CreateSharedBufferTransferMemory
8202 [4.0.0+] DestroySharedBuffer
8203 [4.0.0+] BindSharedLowLevelLayerToManagedLayer
8204 [4.0.0+] BindSharedLowLevelLayerToIndirectLayer
8207 [4.0.0+] UnbindSharedLowLevelLayer
8208 [4.0.0+] ConnectSharedLowLevelLayerToSharedBuffer
8209 [4.0.0+] DisconnectSharedLowLevelLayerFromSharedBuffer
8210 [4.0.0+] CreateSharedLayer
8211 [4.0.0+] DestroySharedLayer
8216 [4.0.0+] AttachSharedLayerToLowLevelLayer
8217 [4.0.0+] ForceDetachSharedLayerFromLowLevelLayer
8218 [4.0.0+] StartDetachSharedLayerFromLowLevelLayer
8219 [4.0.0+] FinishDetachSharedLayerFromLowLevelLayer
8220 [4.0.0+] GetSharedLayerDetachReadyEvent
8221 [4.0.0+] GetSharedLowLevelLayerSynchronizedEvent
8222 [4.0.0+] CheckSharedLowLevelLayerSynchronized
8223 [4.0.0+] RegisterSharedBufferImporterAruid
8224 [4.0.0+] UnregisterSharedBufferImporterAruid
8227 [4.0.0+] CreateSharedBufferProcessHeap
8228 [4.0.0+] GetSharedLayerLayerStacks
8229 [4.0.0+] SetSharedLayerLayerStacks
8291 [4.0.0+] PresentDetachedSharedFrameBufferToLowLevelLayer
8292 [4.0.0+] FillDetachedSharedFrameBufferColor
8293 [4.0.0+] #GetDetachedSharedFrameBufferImage
8294 [4.0.0+] SetDetachedSharedFrameBufferImage
8295 [4.0.0+] CopyDetachedSharedFrameBufferImage
8296 [4.0.0+] SetDetachedSharedFrameBufferSubImage
8297 [4.0.0+] GetSharedFrameBufferContentParameter
8298 [5.0.0+] ExpandStartupLogoOnSharedFrameBuffer

[10.0.0+] AttachLayerPresentationTracer now takes an additional 8-bytes of input.

[5.0.0+] SetDetachedSharedFrameBufferImage now takes an additional 0x10-bytes of input. CopyDetachedSharedFrameBufferImage now takes an additional 0x18-bytes of input. SetDetachedSharedFrameBufferSubImage now takes an additional 0x10-bytes of input, and the buffer type was changed from 0x5 to 0x45.

GetDetachedSharedFrameBufferImage

Takes a total of 0x10-bytes of input and a type-0x6 output buffer, returns a total of 8-bytes of output.

[15.0.0+] Now takes a total of 0x28-bytes of input and a type-0x6 output buffer, returns a total of 8-bytes of output.

SetDisplayFatalErrorEnabled

Takes an input u64, no output.

[12.0.0+] Takes an input bool and u64, no output.

lbl

This is "nn::lbl::detail::ILblController".

[11.0.0+] this was moved from ptm.

Cmd Name
0 SaveCurrentSetting
1 LoadCurrentSetting
2 SetCurrentBrightnessSetting
3 GetCurrentBrightnessSetting
4 ApplyCurrentBrightnessSettingToBacklight
5 GetBrightnessSettingAppliedToBacklight
6 SwitchBacklightOn
7 SwitchBacklightOff
8 GetBacklightSwitchStatus
9 EnableDimming
10 DisableDimming
11 IsDimmingEnabled
12 EnableAutoBrightnessControl
13 DisableAutoBrightnessControl
14 IsAutoBrightnessControlEnabled
15 SetAmbientLightSensorValue
16 #GetAmbientLightSensorValue
17 SetBrightnessReflectionDelayLevel
18 GetBrightnessReflectionDelayLevel
19 SetCurrentBrightnessMapping
20 GetCurrentBrightnessMapping
21 SetCurrentAmbientLightSensorMapping
22 GetCurrentAmbientLightSensorMapping
23 [3.0.0+] IsAmbientLightSensorAvailable
24 [3.0.0+] SetCurrentBrightnessSettingForVrMode
25 [3.0.0+] GetCurrentBrightnessSettingForVrMode
26 [3.0.0+] #EnableVrMode
27 [3.0.0+] #DisableVrMode
28 [3.0.0+] #IsVrModeEnabled
29 [7.0.0+] IsAutoBrightnessControlSupported

GetAmbientLightSensorValue

No input. Outputs lux in float.

[5.0.0+] Now returns an output #AmbientLightSensorValue.

GetCurrentBrightnessSetting

No input. Returns an output u32 int of the current backlight level.

GetBrightnessSettingAppliedToBacklight

No input. Returns an output u32 int of the backlight level computed from the ambient light sensor.

IsAutoBrightnessControlEnabled

No input. Returns an output u8 bool indicating whether auto brightness is enabled.

EnableVrMode

No input/output. Used by AM_services#SetVrModeEnabled.

Sets a global state field to 0x1.

DisableVrMode

No input/output. Used by AM_services#SetVrModeEnabled.

Sets the global state field used by #EnableVrMode to 0x0.

IsVrModeEnabled

No input. Returns an output u8 bool set by the above commands.

Module

This is "nn::mmnv::Module".

Value Name
0 Cpu
1 Gpu
2 Emc
3 SysBus
4 Mselect
5 Nvdec
6 Nvenc
7 Nvjpg
8 Test

Priority

This is "nn::mmnv::Priority". This is an u32.

Setting

This is "nn::mmnv::Setting". This is an u32.

DisplayInfo

This is "nn::vi::DisplayInfo". This is a 0x60-byte structure.

Offset Size Description
0x0 0x40 Name
0x40 0x1 HasLayerLimit
0x41 0x7 Reserved
0x48 0x8 LayerCountMax
0x50 0x8 LayerWidthPixelCountMax
0x58 0x8 LayerHeightPixelCountMax

The width/height for the "Default" Display is the resolution for 1080p even when in handheld-mode.

DisplayName

This is "nn::vi::DisplayName". This is a 0x40-byte block: a NUL-terminated string.

Can be "Default", "External", "Edid", "Internal" or "Null".

NativeWindow

Max size of this buffer is 0x100-bytes(outbuf size used by official user-processes). Parsed("...DeserializeNativeWindow()") by a function called by the code described under #OpenLayer, which executes code with Android symbols.

This is a #Parcel.

Parcel

Offset Size Description
0x0 0x4 ParcelDataSize
0x4 0x4 ParcelDataOffset
0x8 0x4 ParcelObjectsSize
0xC 0x4 ParcelObjectsOffset
0x10 ? FlattenedBinder

ParcelData

This normally contains the following:

Offset Size Description
0x0 0x4 0x2
0x4 0x4 Probably the user-process PID?
0x8 0x4 ID
0xC 0xC All-zero normally?
0x18 0x8 NUL-terminated "dispdrv" string.
0x20 0x8 All-zero normally?

The above ID is used for the ID param for the binder commands with IHOSBinderDriver.

ParcelObjects

This normally contains an u32 with value 0?

AmbientLightSensorValue

Offset Size Description
0x0 0x4 bOverLimit. (u32) Equals to 1 if visible or IR light data is over 65534.
0x4 0x4 fLux. (float) Value in lux from the ambient light sensor.

Note: if bOverLimit=1 and the default ALS configuration is used, the measurement of fLux should not be considered and the actual max value depends on the type of light. Ranges from 12.5K - 17.5K.

Notes

Resolution Handling

There doesn't seem to be a way to get the actual TV resolution while using the "Default" Display. Official apps just hard-code what resolution to use depending on the current OperationMode.

Ambient Light Sensor

The BH1730 outputs 2 values. Visible light and IR light. This is then calculated through an algorithm that checks for Gain, Measurement time, filter qualities and ouputs lux (max correct measurement of 100K lux). The default values are Gain 64x and ITIME of 38 (256 - 218). This allows for a max lux value of 17972 lux when visible light value is maximum and IR light is 0. When both of them are on their limit, the output is 1192 lux. The sensor is fully configurable.