rdpgfx

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: GPL-3.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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

type Frame struct {
	ID       uint32
	Surfaces []*Surface
}

Frame is one completed frame: the id the server assigned and the surfaces that were touched. The pixels live on the surfaces.

type GfxClient

type GfxClient struct {
	emission.Emitter
	// contains filtered or unexported fields
}

GfxClient is the RDPGFX channel handler.

func NewGfxClient

func NewGfxClient() *GfxClient

NewGfxClient creates an RDPGFX handler.

func (*GfxClient) OnClose

func (c *GfxClient) OnClose()

OnClose implements drdynvc.DynChannel.

func (*GfxClient) OnData

func (c *GfxClient) OnData(data []byte)

OnData implements drdynvc.DynChannel. The payload is a ZGFX stream that may hold several PDUs.

func (*GfxClient) OnOpen

func (c *GfxClient) OnOpen(channelID uint32)

OnOpen implements drdynvc.DynChannel.

func (*GfxClient) SetSender

func (c *GfxClient) SetSender(f func(channelID uint32, data []byte) error)

SetSender installs the callback used to write to the dynamic virtual channel. It must be called before the channel is opened.

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

func (s *Surface) CompositePixels() ([]byte, int, int)

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

func (s *Surface) Origin() (int, int)

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

func (s *Surface) Pixels() []byte

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL