---
title: Getting the GPU that drives a view’s display
framework: metal
role: article
role_heading: Article
path: metal/getting-the-gpu-that-drives-a-views-display
---

# Getting the GPU that drives a view’s display

Keep up to date with the optimal device for your display.

## Overview

Overview A user can have multiple external displays connected directly to a Mac or to an external GPU. Each view in your app shows on a single display, and a single GPU drives each display. The display in which your view appears and the GPU that drives the display can change dynamically; therefore, you need to prepare your app to handle these changes. Register for display change notifications, get the device that drives your view’s display, and decide if your app should use that device to present rendered graphics. Handle display change notifications Register for the following notifications so the system can notify your app about specific display changes: When the system posts a display change notification, you can decide if you should get and use a new device. To deregister from the previous notifications, call the removeObserver(_:name:object:) method. Identify the device that drives your view’s display Get the CGDirectDisplayID value for the display in which your view currently appears. Then call the CGDirectDisplayCopyCurrentMetalDevice(_:) function to get the device that drives that display.

## See Also

### Locating GPUs

- [Finding multiple GPUs on an Intel-based Mac](metal/finding-multiple-gpus-on-an-intel-based-mac.md)
- [MTLCopyAllDevices()](metal/mtlcopyalldevices().md)
- [MTLCopyAllDevicesWithObserver(handler:)](metal/mtlcopyalldeviceswithobserver(handler:).md)
- [MTLRemoveDeviceObserver(_:)](metal/mtlremovedeviceobserver(_:).md)
- [CGDirectDisplayCopyCurrentMetalDevice(_:)](coregraphics/cgdirectdisplaycopycurrentmetaldevice(_:).md)
- [MTLDeviceNotificationHandler](metal/mtldevicenotificationhandler.md)
- [MTLDeviceNotificationName](metal/mtldevicenotificationname.md)
