NVIDIA DRIVE 5.0 Linux SDK API Reference

5.0.5.0 Release

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
drm-nvdc-docs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
11 
39 int drmOpen(const char* name, const char* busid);
40 
41 
48 int drmClose(int fd);
49 
50 
73 int drmGetCap(int fd, uint64_t capability, uint64_t *value);
74 
75 
87 int drmSetClientCap(int fd, uint64_t capability, uint64_t value);
88 
89 
103 int drmSetMaster(int fd);
104 
105 
114 int drmDropMaster(int fd);
115 
116 
126 int drmGetMagic( int fd, drm_magic_t * magic);
127 
128 
138 int drmAuthMagic(int fd, drm_magic_t magic);
139 
140 
162 drmVersionPtr drmGetVersion(int fd);
163 
164 
172 void drmFreeVersion(drmVersionPtr version);
173 
174 
188 int drmHandleEvent(int fd, drmEventContextPtr evctx);
189 
190 
228 int drmIoctl(int fd, unsigned long request, void *arg);
229 
230 
253 int drmWaitVBlank(int fd, drmVBlankPtr vbl);
254 
255 
279 int drmModeAddFB(int fd,
280  uint32_t width,
281  uint32_t height,
282  uint8_t depth,
283  uint8_t bpp,
284  uint32_t pitch,
285  uint32_t bo_handle,
286  uint32_t *buf_id);
287 
288 
320 int drmModeAddFB2(int fd,
321  uint32_t width,
322  uint32_t height,
323  uint32_t pixel_format,
324  uint32_t bo_handles[4],
325  uint32_t pitches[4],
326  uint32_t offsets[4],
327  uint32_t *buf_id,
328  uint32_t flags);
329 
330 
342 int drmModeRmFB(int fd, uint32_t fb_id);
343 
344 
364 drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id);
365 
366 
374 void drmModeFreeConnector(drmModeConnectorPtr ptr);
375 
376 
388 int drmModeConnectorSetProperty(int fd,
389  uint32_t connector_id,
390  uint32_t property_id,
391  uint64_t value);
392 
393 
409 drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtc_id);
410 
411 
419 void drmModeFreeCrtc(drmModeCrtcPtr ptr);
420 
421 
460 int drmModeSetCrtc(int fd,
461  uint32_t crtc_id,
462  uint32_t fb_id,
463  uint32_t x,
464  uint32_t y,
465  uint32_t *connectors,
466  int count,
467  drmModeModeInfoPtr drm_mode);
468 
469 
487 int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size,
488  uint16_t *red, uint16_t *green, uint16_t *blue);
489 
490 
506 int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
507  uint16_t *red, uint16_t *green, uint16_t *blue);
508 
509 
535 int drmModePageFlip(int fd,
536  uint32_t crtc_id,
537  uint32_t fb_id,
538  uint32_t flags,
539  void *user_data);
540 
541 
563 int drmModeSetCursor(int fd,
564  uint32_t crtc_id,
565  uint32_t bo_handle,
566  uint32_t width,
567  uint32_t height);
568 
569 
581 int drmModeMoveCursor(int fd, uint32_t crtc_id, int x, int y);
582 
583 
602 drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id);
603 
604 
612 void drmModeFreeEncoder(drmModeEncoderPtr ptr);
613 
614 
635 drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id);
636 
637 
645 void drmModeFreePlane(drmModePlanePtr ptr);
646 
647 
682 int drmModeSetPlane(int fd,
683  uint32_t plane_id,
684  uint32_t crtc_id,
685  uint32_t fb_id,
686  uint32_t flags,
687  uint32_t crtc_x,
688  uint32_t crtc_y,
689  uint32_t crtc_w,
690  uint32_t crtc_h,
691  uint32_t src_x,
692  uint32_t src_y,
693  uint32_t src_w,
694  uint32_t src_h);
695 
696 
736  drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
737  uint32_t object_id,
738  uint32_t object_type);
739 
740 
749 void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr);
750 
751 
801  * /* Print the property name, which will be "Primary", "Overlay", or "Cursor". */
802  * printf("\tcon_value : %s\n", name);
803  * } else {
804  * /* The specified plane property value does not appear in the DRM properties. */
805  * /* Print the property value for which we were looking. */
806  * printf("\tcon_value : %" PRIu64 "\n", value);
807  * }
808  * @endcode
809  *
810  * @note The zpos value for a plane is initialized with an offset of 10 relative to
811  * the next plane. This is to allow for flexible configuration of heads. For example:
812  * - "Primary" type Plane zpos = 10
813  * - First "Overlay" Plane zpos = 20
814  * - Next "Overlay" Plane zpos = 30
815  * - Etc.
816  *
817  * @note The allowed range for zpos is [0, 255]. Planes with numerically greater values for
818  * zpos occlude planes with numerically lesser values.
819  *
820  * @note The alpha value for a plane causes a plane-wide transparency to be
821  * applied as well as the per-pixel alpha contained in the buffer object. The
822  * allowed range for alpha is [0, 255], where 0 is fully transparent and 255 indicates
823  * that only per-pixel alpha has an effect. For non-alpha pixel formats,
824  * there is no per-pixel alpha, so 255 indicates fully opaque.
825  *
826  * @post If the call is successful, the application must free the property
827  * information structure by calling ::drmModeFreeProperty.
828  *
829  * @param fd The file descriptor of an open DRM device.
830  * @param propertyId Property ID of the property object to be fetched.
831  * @return A @c drmModePropertyPtr if successful, or NULL otherwise.
832  */
833 drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId);
834 
849 int drmModeObjectSetProperty(int fd, uint32_t object_id, uint32_t object_type,
850  uint32_t property_id, uint64_t value);
851 
859 void drmModeFreeProperty(drmModePropertyPtr ptr);
860 
861 
879 drmModeResPtr drmModeGetResources(int fd);
880 
881 
889 void drmModeFreeResources(drmModeResPtr ptr);
890 
891 
913 drmModePlaneResPtr drmModeGetPlaneResources(int fd);
914 
915 
924 void drmModeFreePlaneResources(drmModePlaneResPtr ptr);
925 
926 
937 int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle);
938 
950 int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd)
951 
952 
966 drmModeAtomicReqPtr drmModeAtomicAlloc(void);
967 
968 
982 int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
983  uint32_t object_id,
984  uint32_t property_id,
985  uint64_t value);
986 
987 
1013 int drmModeAtomicCommit(int fd,
1014  drmModeAtomicReqPtr req,
1015  uint32_t flags,
1016  void *user_data);
1017 
1018 
1027 void drmModeAtomicFree(drmModeAtomicReqPtr req);
1028 
1029 
1045 int drmSetInterfaceVersion(int fd, drmSetVersion *version);
1046 
1047 
1063 char *drmGetBusid(int fd);
1064 
1065 
1074 void drmFreeBusid(const char *busid);
1075 
1076 
1103 int drmModeCreatePropertyBlob(int fd,
1104  const void *data, size_t size,
1105  uint32_t *id);
1106 
1107 
1118 int drmModeDestroyPropertyBlob(int fd, uint32_t id);
1119 
1120 
1131 drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id);
1132 
1133 
1142 void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr);
1143 
1144 
1160 char *drmGetDeviceNameFromFd(int fd);
1161 
1162 
1170 void drmFree(void *p);
1171 
1187 int drmCommandWriteRead(int fd,
1188  unsigned long drmCommandIndex,
1189  void *data,
1190  unsigned long size);
drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
Gets information for an encoder.
void drmModeFreePlaneResources(drmModePlaneResPtr ptr)
Frees a plane resource information structure.
void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr)
Frees an object properties structure.
drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd, uint32_t object_id, uint32_t object_type)
Gets all properties of a DRM object.
int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data)
Requests a page flip (framebuffer change) on the specified CRTC.
drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id)
Allocates and retrieves a userspace property blob pointer.
int drmSetClientCap(int fd, uint64_t capability, uint64_t value)
Enables or disables DRM features (capabilities).
int drmWaitVBlank(int fd, drmVBlankPtr vbl)
Waits for a vertical blanking interval (vblank).
int drmModeDestroyPropertyBlob(int fd, uint32_t id)
Destroys a property blob.
int drmModeObjectSetProperty(int fd, uint32_t object_id, uint32_t object_type, uint32_t property_id, uint64_t value)
Set the current value of an object's property.
int drmCommandWriteRead(int fd, unsigned long drmCommandIndex, void *data, unsigned long size)
Send a device-specific read-write command.
drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtc_id)
Gets information for a CRTC.
int drmGetCap(int fd, uint64_t capability, uint64_t *value)
Gets capabilities of the DRM driver.
int drmDropMaster(int fd)
Releases master controls for a DRM device.
int drmModeSetCursor(int fd, uint32_t crtc_id, uint32_t bo_handle, uint32_t width, uint32_t height)
Sets a cursor image.
int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id, uint64_t value)
Sets a connector property.
int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, uint32_t crtc_x, uint32_t crtc_y, uint32_t crtc_w, uint32_t crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h)
Changes a plane's framebuffer and position.
int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req, uint32_t flags, void *user_data)
Commits an atomic property change request to hardware.
void drmModeFreeConnector(drmModeConnectorPtr ptr)
Frees a connector.
char * drmGetBusid(int fd)
Gets the bus ID of a device.
void drmModeFreeProperty(drmModePropertyPtr ptr)
Frees a property structure.
void drmModeFreePlane(drmModePlanePtr ptr)
Frees a plane.
int drmModeSetCrtc(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t x, uint32_t y, uint32_t *connectors, int count, drmModeModeInfoPtr drm_mode)
Sets a CRTC configuration.
int drmModeCreatePropertyBlob(int fd, const void *data, size_t size, uint32_t *id)
Creates a property blob.
void drmFreeBusid(const char *busid)
Frees bus ID information.
void drmModeAtomicFree(drmModeAtomicReqPtr req)
Frees an atomic request.
void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr)
Frees a userspace property blob pointer.
drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id)
Gets information for a connector.
int drmModeAtomicAddProperty(drmModeAtomicReqPtr req, uint32_t object_id, uint32_t property_id, uint64_t value)
Adds a property to an atomic request.
int drmIoctl(int fd, unsigned long request, void *arg)
Issues a DRM input/output control (IOCTL).
drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
Gets information about a plane.
int drmAuthMagic(int fd, drm_magic_t magic)
Authenticates a magic cookie.
int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle)
Imports a dma-buf.
drmModeResPtr drmModeGetResources(int fd)
Gets information about a DRM device's CRTCs, encoders, and connectors.
int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue)
Gets the current display gamma ramp.
int drmModeAddFB2(int fd, uint32_t width, uint32_t height, uint32_t pixel_format, uint32_t bo_handles[4], uint32_t pitches[4], uint32_t offsets[4], uint32_t *buf_id, uint32_t flags)
Creates a framebuffer, specifying format and planes.
int drmGetMagic(int fd, drm_magic_t *magic)
Retrieves a magic cookie.
drmVersionPtr drmGetVersion(int fd)
Retrieves version information for the DRM driver.
void drmModeFreeCrtc(drmModeCrtcPtr ptr)
Frees a CRTC.
int drmHandleEvent(int fd, drmEventContextPtr evctx)
Polls for an event, specifying a callback function.
int drmSetInterfaceVersion(int fd, drmSetVersion *version)
Sets the interface version.
drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId)
Gets a property structure that describes a property of a DRM object.
int drmModeMoveCursor(int fd, uint32_t crtc_id, int x, int y)
Moves a cursor.
int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth, uint8_t bpp, uint32_t pitch, uint32_t bo_handle, uint32_t *buf_id)
Creates a framebuffer.
int drmClose(int fd)
Closes a DRM device.
drmModePlaneResPtr drmModeGetPlaneResources(int fd)
Gets information about planes.
int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue)
Sets the display gamma.
char * drmGetDeviceNameFromFd(int fd)
Gets a DRM device's name string.
void drmModeFreeEncoder(drmModeEncoderPtr ptr)
Frees an encoder.
int drmSetMaster(int fd)
Requests master controls for a DRM device.
int drmPrimeHandleToFD(int fd, uint32_t handle, uint32_t flags, int *prime_fd) drmModeAtomicReqPtr drmModeAtomicAlloc(void)
Exports a dma-buf.
void drmFreeVersion(drmVersionPtr version)
Frees a version information structure.
int drmOpen(const char *name, const char *busid)
Opens a DRM device and creates a file descriptor handle.
void drmModeFreeResources(drmModeResPtr ptr)
Frees a resource information structure.
int drmModeRmFB(int fd, uint32_t fb_id)
Destroys a framebuffer.
void drmFree(void *p)
Frees a block of memory.