<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGConfigureDisplayMirrorOfDisplay(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGConfigureDisplayMirrorOfDisplay"
  },
  "title" : "CGConfigureDisplayMirrorOfDisplay(_:_:_:)"
}
-->

# CGConfigureDisplayMirrorOfDisplay(_:_:_:)

Changes the configuration of a mirroring set.

```
func CGConfigureDisplayMirrorOfDisplay(_ config: CGDisplayConfigRef?, _ display: CGDirectDisplayID, _ master: CGDirectDisplayID) -> CGError
```

## Parameters

`config`

A display configuration, acquired by calling [`CGBeginDisplayConfiguration(_:)`](/documentation/CoreGraphics/CGBeginDisplayConfiguration(_:)).

`display`

The identifier of the display to add to a mirroring set.

`master`

A display in a mirroring set, or `kCGNullDirectDisplay` to disable mirroring. To specify the main display, use [`CGMainDisplayID()`](/documentation/CoreGraphics/CGMainDisplayID()).

## Return Value

A result code. See `Core Graphics Data Types and Constants`.

## Discussion

Display mirroring and display matte generation are implemented either in hardware (preferred) or software, at the discretion of the device driver.

- Hardware mirroring

With hardware mirroring enabled, all drawing is directed to the primary display—see [`CGDisplayPrimaryDisplay(_:)`](/documentation/CoreGraphics/CGDisplayPrimaryDisplay(_:)).

If the device driver selects hardware matte generation, the display bounds and row-bytes values are adjusted to reflect the active drawable area.

- Software mirroring

In this form of mirroring, identical content is drawn into each display in the mirroring set. Applications that use the window system need not be concerned about mirroring, as the window system takes care of all flushing of window content to the appropriate displays.

Applications that draw directly to the display, as with display capture, must make sure to draw the same content to all mirrored displays in a software mirror set. When drawing to software mirrored displays using a full screen OpenGL context (not drawing through a window), you should create shared OpenGL contexts for each display and rerender for each display.

You can use the function [`CGGetActiveDisplayList(_:_:_:)`](/documentation/CoreGraphics/CGGetActiveDisplayList(_:_:_:)) to determine which displays are active, or drawable. This automatically gives your application the correct view of the current displays.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)