Documentation
¶
Overview ¶
Package rdpgfx implements the RDP Graphics Pipeline Extension channel (MS-RDPEGFX), the modern drawing path where a server composites surfaces and sends them as compressed bitmaps.
It is a dynamic virtual channel, so it only starts once the drdynvc layer has created it and both sides have exchanged capabilities.
Index ¶
Constants ¶
const ( CapsVersion8 = 0x00080004 CapsVersion81 = 0x00080105 )
Capability versions. 8.0 and 8.1 are the ones a decoder of RemoteFX and raw bitmaps can honestly claim; the 10.x versions advertise AVC support.
0x00080105 rather than 0x00080100: the low byte is part of the version, not padding. See MS-RDPEGFX 2.2.3.2.
const DVCChannelName = "Microsoft::Windows::RDS::Graphics"
RDPGFX_DVC_CHANNEL_NAME is the dynamic virtual channel name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
Frame is one completed frame: the id the server assigned and the surfaces that were touched. The pixels live on the surfaces.
type GfxClient ¶
GfxClient is the RDPGFX channel handler.
func (*GfxClient) OnData ¶
OnData implements drdynvc.DynChannel. The payload is a ZGFX stream that may hold several PDUs.
type Reset ¶
type Reset struct {
Width, Height int
}
Reset describes a Reset Graphics PDU: the size of the desktop the server will composite into. Any previously known surfaces are gone.
type Surface ¶
type Surface struct {
ID uint16
Width int
Height int
PixelFormat uint8
// contains filtered or unexported fields
}
Surface is a decoded surface: a set of pixels that the server composites into frames. Surfaces are addressed by a 16 bit id.
func (*Surface) CompositePixels ¶ added in v0.5.0
CompositePixels returns the pixels to composite for this surface and the size to composite them at. When the server mapped the surface to the output with a target size (MapSurfaceToScaledOutput), the pixels are resampled to that size so the surface is drawn at the size the server asked for. In every other case the native pixels and size are returned, so a compositor can always draw the result at the size this returns.
The two window mappings carry a target size as well, but they are not resampled: the surface belongs at a position inside a window this client has no model for, and scaling it without a destination would not be faithful. Placement reports what was recorded for them.
func (*Surface) Origin ¶ added in v0.3.0
Origin returns where the surface is mapped on the desktop. A client that composites surfaces itself has to offset them by this, or everything ends up in the top left corner. A window mapping carries no desktop origin, so the last output origin is kept and this never moves a surface to the corner.
func (*Surface) Pixels ¶
Pixels returns a copy of the surface contents as BGRA, top down, at the surface's native size.
func (*Surface) Placement ¶ added in v0.5.0
func (s *Surface) Placement() SurfacePlacement
Placement returns the mapping the server most recently applied to this surface: the output origin from an output mapping, or the window id and the mapped and target sizes from a window mapping. A surface that was never mapped reports the zero placement.
type SurfacePlacement ¶ added in v0.3.0
type SurfacePlacement struct {
ID uint16
// X, Y is the desktop origin, from the two output mappings. A window
// mapping carries no desktop origin, so it keeps the last one.
X, Y int
// Windowed is set for MapSurfaceToWindow and MapSurfaceToScaledWindow.
Windowed bool
// WindowID identifies the window a Windowed placement belongs to.
WindowID uint64
// MappedWidth, MappedHeight is the surface's size within that window.
MappedWidth, MappedHeight int
// TargetWidth, TargetHeight is the size the server asked the surface to be
// resampled to, from the two scaled mappings. Zero when the mapping does
// not scale.
TargetWidth, TargetHeight int
}
SurfacePlacement reports where the server mapped a surface. The four mapping orders carry different geometry and only some of it can be applied:
- MapSurfaceToOutput and MapSurfaceToScaledOutput place the surface on the desktop at X,Y. The scaled form additionally asks for it to be resampled to TargetWidth x TargetHeight, which CompositePixels applies.
- MapSurfaceToWindow and MapSurfaceToScaledWindow place the surface inside a window. This client has no window model, so the window id and the mapped and target sizes are recorded and left for a consumer that has one; CompositePixels deliberately does not resample them.