https://switchbrew.org/w/api.php?action=feedcontributions&user=Furoryan&feedformat=atom
Nintendo Switch Brew - User contributions [en]
2024-03-29T15:50:23Z
User contributions
MediaWiki 1.35.8
https://switchbrew.org/w/index.php?title=Display_services&diff=4557
Display services
2018-05-01T18:47:03Z
<p>Furoryan: Add 2nd parameter to SetLayerScalingMode</p>
<hr />
<div>The only image data contained in this sysmodule is basically a saved display framebuffer, no image data for actively-used layers/framebuffers.<br />
<br />
= caps:sc =<br />
This is "nn::capsrv::sf::IScreenShotControlService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 ||<br />
|-<br />
| 2 ||<br />
|-<br />
| 1001 ||<br />
|-<br />
| 1002 ||<br />
|-<br />
| 1003 ||<br />
|-<br />
| 1011 ||<br />
|-<br />
| 1012 ||<br />
|-<br />
| 1201 ||<br />
|-<br />
| 1202 ||<br />
|-<br />
| 1203 ||<br />
|}<br />
<br />
= caps:ss =<br />
This is "nn::capsrv::sf::IScreenShotService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 201 ||<br />
|-<br />
| 202 ||<br />
|-<br />
| 203 ||<br />
|-<br />
| 204 ||<br />
|}<br />
<br />
= caps:su =<br />
This is "nn::capsrv::sf::IScreenShotApplicationService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 201 || SaveScreenShot<br />
|-<br />
| 203 || SaveScreenShotEx0<br />
|}<br />
<br />
= cec-mgr =<br />
This is "nn::cec::ICecManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 ||<br />
|-<br />
| 1 ||<br />
|-<br />
| 2 ||<br />
|-<br />
| 3 ||<br />
|-<br />
| 4 ||<br />
|-<br />
| 5 ||<br />
|-<br />
| 6 ||<br />
|}<br />
<br />
= mm:u =<br />
This is "nn::mmnv::IRequest".<br />
<br />
NVIDIA multimedia (NvMM) platform service.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|-<br />
| 2 || <br />
|-<br />
| 3 || <br />
|-<br />
| 4 || Initialize<br />
|-<br />
| 5 || Finalize<br />
|-<br />
| 6 || SetAndWait<br />
|-<br />
| 7 || Get<br />
|}<br />
<br />
= vi:u =<br />
This is "nn::visrv::sf::IApplicationRootService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#vi:u|GetDisplayService]]<br />
|-<br />
|}<br />
<br />
== GetDisplayService ==<br />
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).<br />
<br />
= vi:s =<br />
This is "nn::visrv::sf::ISystemRootService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || [[#vi:s|GetDisplayService]]<br />
|-<br />
| 3 || [[#vi:s|GetDisplayServiceWithProxyNameExchange]]<br />
|-<br />
|}<br />
<br />
== GetDisplayService ==<br />
Returns an [[#IApplicationDisplayService]]. Same input as vi:u.<br />
<br />
== GetDisplayServiceWithProxyNameExchange ==<br />
Returns an [[#IApplicationDisplayService]].<br />
<br />
= vi:m =<br />
This is "nn::visrv::sf::IManagerRootService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2 || [[#vi:m|GetDisplayService]]<br />
|-<br />
| 3 || [[#vi:m|GetDisplayServiceWithProxyNameExchange]]<br />
|-<br />
|}<br />
<br />
== GetDisplayService ==<br />
Returns an [[#IApplicationDisplayService]]. Same input as vi:u.<br />
<br />
== GetDisplayServiceWithProxyNameExchange ==<br />
Takes an input u64 and u32. Returns an [[#IApplicationDisplayService]].<br />
<br />
= IApplicationDisplayService =<br />
This is "nn::visrv::sf::IApplicationDisplayService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 100 || [[#GetRelayService]]<br />
|-<br />
| 101 || [[#GetSystemDisplayService]]<br />
|-<br />
| 102 || [[#GetManagerDisplayService]]<br />
|-<br />
| 103 || [2.0.0+] [[#GetIndirectDisplayTransactionService]]<br />
|-<br />
| 1000 || [[#ListDisplays]]<br />
|-<br />
| 1010 || [[#OpenDisplay]]<br />
|-<br />
| 1011 || [[#OpenDefaultDisplay]]<br />
|-<br />
| 1020 || [[#CloseDisplay]]<br />
|-<br />
| 1101 || [[#SetDisplayEnabled]]<br />
|-<br />
| 1102 || [[#GetDisplayResolution]]<br />
|-<br />
| 2020 || [[#OpenLayer]]<br />
|-<br />
| 2021 || [[#CloseLayer]]<br />
|-<br />
| 2030 || [[#CreateStrayLayer]]<br />
|-<br />
| 2031 || [[#DestroyStrayLayer]]<br />
|-<br />
| 2101 || [[#SetLayerScalingMode]]<br />
|-<br />
| 2102 || [5.0.0+] ConvertScalingMode<br />
|-<br />
| 2450 || [[#GetIndirectLayerImageMap]]<br />
|-<br />
| 2451 || [[#GetIndirectLayerImageCropMap]]<br />
|-<br />
| 2460 || [[#GetIndirectLayerImageRequiredMemoryInfo]]<br />
|-<br />
| 5202 || [[#GetDisplayVsyncEvent]]<br />
|-<br />
| 5203 || [[#GetDisplayVsyncEventForDebug]]<br />
|-<br />
|}<br />
<br />
Available sessions for each service:<br />
* "vi:u": Only GetRelayService.<br />
* "vi:s": Everything except GetManagerDisplayService.<br />
* "vi:m": All.<br />
<br />
When attempting to use a get-session cmd with a service it's not available with, error 0xA72 is returned.<br />
<br />
These commands using PIDs have AppletResourceUserId as the last input u64, hence AppletResourceUserId must [[IPC_Marshalling|match]] the user-process PID(no special handling for value 0).<br />
<br />
== GetRelayService ==<br />
Returns an [[Nvnflinger_services#dispdrv|IHOSBinderDriver]] interface which abstracts "nn::visrv::service::RelayServiceImpl".<br />
<br />
== GetIndirectDisplayTransactionService ==<br />
Returns an [[Nvnflinger_services#dispdrv|IHOSBinderDriver]] interface which abstracts "nn::visrv::service::IndirectDisplayTransactionServiceImpl".<br />
<br />
== GetSystemDisplayService ==<br />
Returns an [[#ISystemDisplayService]].<br />
<br />
== GetManagerDisplayService ==<br />
Returns an [[#IManagerDisplayService]].<br />
<br />
== ListDisplays ==<br />
Takes a type-0x6 output buffer containing the array of [[#DisplayInfo]] output entries. Returns an output u64: total number of output entries.<br />
<br />
Normally(?) this only returns the "Default" display.<br />
<br />
== OpenDisplay ==<br />
Takes a [[#DisplayName]] as input. Returns an output u64, the DisplayId.<br />
<br />
To open the default display, input string "Default" can be used.<br />
<br />
== OpenDefaultDisplay ==<br />
Returns an output u64.<br />
<br />
Probably not (?) used by newer official user-processes, since those use OpenDisplay with the default string instead.<br />
<br />
== CloseDisplay ==<br />
Takes an input u64, DisplayId.<br />
<br />
== SetDisplayEnabled ==<br />
Takes an input u32 boolean, and an u64(DisplayId?).<br />
<br />
== GetDisplayResolution ==<br />
Takes an input u64 DisplayId and returns two output u64s: width and height.<br />
<br />
== OpenLayer ==<br />
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 [[AM_services|AppletResourceUserId]]. Returns an output u64 NativeWindow_Size.<br />
<br />
Official user-processes use a LayerId stored in a global state field("...ExternalLayerId") if non-zero, otherwise:<br />
* When AppletResourceUserId==0, [[#CreateStrayLayer]] is used instead of the OpenLayer cmd.<br />
* When AppletResourceUserId!=0, [[AM_services#CreateManagedDisplayLayer]] is used and the output from that is used for LayerId with the OpenLayer cmd.<br />
<br />
This OpenLayer command returns error 0x272 when the AppletResourceUserId is invalid.<br />
<br />
== CloseLayer ==<br />
Takes an input u64: LayerId which was used with [[#OpenLayer]].<br />
<br />
== CreateStrayLayer ==<br />
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.<br />
<br />
== DestroyStrayLayer ==<br />
Takes an input u64: LayerId from [[#CreateStrayLayer]].<br />
<br />
== SetLayerScalingMode ==<br />
Takes an input u64("ScalingMode") and u64 ("LayerId").<br />
<br />
== GetIndirectLayerImageMap ==<br />
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.<br />
<br />
== GetIndirectLayerImageCropMap ==<br />
Takes a PID-descriptor, an type-0x46 buffer, four floats, four u64s(last u64 is [[AM_services|AppletResourceUserId]]). Returns two output u64s. The floats are stored immediately after each other(32bits).<br />
<br />
== GetIndirectLayerImageRequiredMemoryInfo ==<br />
Takes two input u64s: with and height. Returns two output u64s. First u64 is the buffer size to use with the ImageMap cmds.<br />
<br />
== GetDisplayVsyncEvent ==<br />
Takes an input u64 DisplayId and returns a handle.<br />
<br />
== GetDisplayVsyncEventForDebug ==<br />
Takes an input u64 DisplayId and returns a handle.<br />
<br />
== ISystemDisplayService ==<br />
This is "nn::visrv::sf::ISystemDisplayService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1200 || GetZOrderCountMin<br />
|-<br />
| 1202 || GetZOrderCountMax<br />
|-<br />
| 1203 || GetDisplayLogicalResolution<br />
|-<br />
| 1204 || SetDisplayMagnification<br />
|-<br />
| 2201 || SetLayerPosition<br />
|-<br />
| 2203 || SetLayerSize<br />
|-<br />
| 2204 || GetLayerZ<br />
|-<br />
| 2205 || SetLayerZ<br />
|-<br />
| 2207 || SetLayerVisibility<br />
|-<br />
| 2209 || SetLayerAlpha<br />
|-<br />
| 2312 || CreateStrayLayer<br />
|-<br />
| 2400 || OpenIndirectLayer<br />
|-<br />
| 2401 || CloseIndirectLayer<br />
|-<br />
| 2402 || FlipIndirectLayer<br />
|-<br />
| 3000 || ListDisplayModes<br />
|-<br />
| 3001 || ListDisplayRgbRanges<br />
|-<br />
| 3002 || ListDisplayContentTypes<br />
|-<br />
| 3200 || GetDisplayMode<br />
|-<br />
| 3201 || SetDisplayMode<br />
|-<br />
| 3202 || GetDisplayUnderscan<br />
|-<br />
| 3203 || SetDisplayUnderscan<br />
|-<br />
| 3204 || GetDisplayContentType<br />
|-<br />
| 3205 || SetDisplayContentType<br />
|-<br />
| 3206 || GetDisplayRgbRange<br />
|-<br />
| 3207 || SetDisplayRgbRange<br />
|-<br />
| 3208 || GetDisplayCmuMode<br />
|-<br />
| 3209 || SetDisplayCmuMode<br />
|-<br />
| 3210 || GetDisplayContrastRatio<br />
|-<br />
| 3211 || SetDisplayContrastRatio<br />
|-<br />
| 3214 || GetDisplayGamma<br />
|-<br />
| 3215 || SetDisplayGamma<br />
|-<br />
| 3216 || GetDisplayCmuLuma<br />
|-<br />
| 3217 || SetDisplayCmuLuma<br />
|-<br />
| 8225 || [4.0.0+] GetSharedBufferMemoryHandleId<br />
|-<br />
| 8250 || [4.0.0+] OpenSharedLayer<br />
|-<br />
| 8251 || [4.0.0+] CloseSharedLayer<br />
|-<br />
| 8252 || [4.0.0+] ConnectSharedLayer<br />
|-<br />
| 8253 || [4.0.0+] DisconnectSharedLayer<br />
|-<br />
| 8254 || [4.0.0+] AcquireSharedFrameBuffer<br />
|-<br />
| 8255 || [4.0.0+] PresentSharedFrameBuffer<br />
|-<br />
| 8256 || [4.0.0+] GetSharedFrameBufferAcquirableEvent<br />
|-<br />
| 8257 || [4.0.0+] FillSharedFrameBufferColor<br />
|-<br />
| 8258 || [5.0.0+] CancelSharedFrameBuffer<br />
|}<br />
<br />
== IManagerDisplayService ==<br />
This is "nn::visrv::sf::IManagerDisplayService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 200 || [4.0.0+] AllocateProcessHeapBlock<br />
|-<br />
| 201 || [4.0.0+] FreeProcessHeapBlock<br />
|-<br />
| 1102 || GetDisplayResolution<br />
|-<br />
| 2010 || CreateManagedLayer<br />
|-<br />
| 2011 || DestroyManagedLayer<br />
|-<br />
| 2050 || CreateIndirectLayer<br />
|-<br />
| 2051 || DestroyIndirectLayer<br />
|-<br />
| 2052 || CreateIndirectProducerEndPoint<br />
|-<br />
| 2053 || DestroyIndirectProducerEndPoint<br />
|-<br />
| 2054 || CreateIndirectConsumerEndPoint<br />
|-<br />
| 2055 || DestroyIndirectConsumerEndPoint<br />
|-<br />
| 2300 || AcquireLayerTexturePresentingEvent<br />
|-<br />
| 2301 || ReleaseLayerTexturePresentingEvent<br />
|-<br />
| 2302 || GetDisplayHotplugEvent<br />
|-<br />
| 2402 || GetDisplayHotplugState<br />
|-<br />
| 2501 || [4.0.0+] GetCompositorErrorInfo<br />
|-<br />
| 2601 || [4.0.0+] GetDisplayErrorEvent<br />
|-<br />
| 4201 || SetDisplayAlpha<br />
|-<br />
| 4203 || SetDisplayLayerStack<br />
|-<br />
| 4205 || SetDisplayPowerState<br />
|-<br />
| 4206 || [4.0.0+] SetDefaultDisplay<br />
|-<br />
| 6000 || AddToLayerStack<br />
|-<br />
| 6001 || RemoveFromLayerStack<br />
|-<br />
| 6002 || SetLayerVisibility<br />
|-<br />
| 6003 || [5.0.0+] SetLayerConfig<br />
|-<br />
| 6004 || [5.0.0+] AttachLayerPresentationTracer<br />
|-<br />
| 6005 || [5.0.0+] DetachLayerPresentationTracer<br />
|-<br />
| 6006 || [5.0.0+] StartLayerPresentationRecording<br />
|-<br />
| 6007 || [5.0.0+] StopLayerPresentationRecording<br />
|-<br />
| 6008 || [5.0.0+] StartLayerPresentationFenceWait<br />
|-<br />
| 6009 || [5.0.0+] StopLayerPresentationFenceWait<br />
|-<br />
| 6010 || [5.0.0+] GetLayerPresentationAllFencesExpiredEvent<br />
|-<br />
| 7000 || SetContentVisibility<br />
|-<br />
| 8000 || SetConductorLayer<br />
|-<br />
| 8100 || SetIndirectProducerFlipOffset<br />
|-<br />
| 8200 || [4.0.0+] CreateSharedBufferStaticStorage<br />
|-<br />
| 8201 || [4.0.0+] CreateSharedBufferTransferMemory<br />
|-<br />
| 8202 || [4.0.0+] DestroySharedBuffer<br />
|-<br />
| 8203 || [4.0.0+] BindSharedLowLevelLayerToManagedLayer<br />
|-<br />
| 8204 || [4.0.0+] BindSharedLowLevelLayerToIndirectLayer<br />
|-<br />
| 8207 || [4.0.0+] UnbindSharedLowLevelLayer<br />
|-<br />
| 8208 || [4.0.0+] ConnectSharedLowLevelLayerToSharedBuffer<br />
|-<br />
| 8209 || [4.0.0+] DisconnectSharedLowLevelLayerFromSharedBuffer<br />
|-<br />
| 8210 || [4.0.0+] CreateSharedLayer<br />
|-<br />
| 8211 || [4.0.0+] DestroySharedLayer<br />
|-<br />
| 8216 || [4.0.0+] AttachSharedLayerToLowLevelLayer<br />
|-<br />
| 8217 || [4.0.0+] ForceDetachSharedLayerFromLowLevelLayer<br />
|-<br />
| 8218 || [4.0.0+] StartDetachSharedLayerFromLowLevelLayer<br />
|-<br />
| 8219 || [4.0.0+] FinishDetachSharedLayerFromLowLevelLayer<br />
|-<br />
| 8220 || [4.0.0+] GetSharedLayerDetachReadyEvent<br />
|-<br />
| 8221 || [4.0.0+] GetSharedLowLevelLayerSynchronizedEvent<br />
|-<br />
| 8222 || [4.0.0+] CheckSharedLowLevelLayerSynchronized<br />
|-<br />
| 8223 || [4.0.0+] RegisterSharedBufferImporterAruid<br />
|-<br />
| 8224 || [4.0.0+] UnregisterSharedBufferImporterAruid<br />
|-<br />
| 8227 || [4.0.0+] CreateSharedBufferProcessHeap<br />
|-<br />
| 8228 || [4.0.0+] GetSharedLayerLayerStacks<br />
|-<br />
| 8229 || [4.0.0+] SetSharedLayerLayerStacks<br />
|-<br />
| 8291 || [4.0.0+] PresentDetachedSharedFrameBufferToLowLevelLayer<br />
|-<br />
| 8292 || [4.0.0+] FillDetachedSharedFrameBufferColor<br />
|-<br />
| 8293 || [4.0.0+] GetDetachedSharedFrameBufferImage<br />
|-<br />
| 8294 || [4.0.0+] SetDetachedSharedFrameBufferImage<br />
|-<br />
| 8295 || [4.0.0+] CopyDetachedSharedFrameBufferImage<br />
|-<br />
| 8296 || [4.0.0+] SetDetachedSharedFrameBufferSubImage<br />
|-<br />
| 8297 || [4.0.0+] GetSharedFrameBufferContentParameter<br />
|-<br />
| 8298 || [5.0.0+] ExpandStartupLogoOnSharedFrameBuffer<br />
|}<br />
<br />
= DisplayInfo =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x40 || [[#DisplayName]]<br />
|-<br />
| 0x40 || 0x8? || Normally 0x1 for the "Default" Display?<br />
|-<br />
| 0x48 || 0x8? || Normally 0x1 for the "Default" Display?<br />
|-<br />
| 0x50 || 0x8? || Width<br />
|-<br />
| 0x58 || 0x8? || Height<br />
|}<br />
<br />
This is a 0x60-byte structure.<br />
<br />
The width/height for the "Default" Display is the resolution for 1080p even when in handheld-mode.<br />
<br />
= DisplayName =<br />
This is a 0x40-byte block: a NUL-terminated string.<br />
<br />
Can be "Default", "External", "Edid", "Internal" or "Null".<br />
<br />
= Parcel =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || ParcelDataSize<br />
|-<br />
| 0x4 || 0x4 || ParcelDataOffset<br />
|-<br />
| 0x8 || 0x4 || ParcelObjectsSize<br />
|-<br />
| 0xC || 0x4 || ParcelObjectsOffset<br />
|-<br />
| 0x10 || ? || FlattenedBinder<br />
|}<br />
<br />
= NativeWindow =<br />
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.<br />
<br />
This is a [[#Parcel]].<br />
<br />
== ParcelData ==<br />
This normally contains the following:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || 0x2<br />
|-<br />
| 0x4 || 0x4 || Probably the user-process PID?<br />
|-<br />
| 0x8 || 0x4 || ID<br />
|-<br />
| 0xC || 0xC || All-zero normally?<br />
|-<br />
| 0x18 || 0x8 || NUL-terminated "dispdrv" string.<br />
|-<br />
| 0x20 || 0x8 || All-zero normally?<br />
|}<br />
<br />
The above ID is used for the ID param for the binder commands with [[#GetRelayService|IHOSBinderDriver]].<br />
<br />
== ParcelObjects ==<br />
This normally contains an u32 with value 0?<br />
<br />
= Resolution handling =<br />
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]].<br />
<br />
[[Category:Services]]</div>
Furoryan