libdrm相关结构体简介
主要内容
本章主要讲解libdrm相关结构体的说明。
Mode相关结构体
drmModeRes
typedef struct _drmModeRes { int count_fbs; uint32_t *fbs; int count_crtcs; uint32_t *crtcs; int count_connectors; uint32_t *connectors; int count_encoders; uint32_t *encoders; uint32_t min_width, max_width; uint32_t min_height, max_height; } , *drmModeResPtr;drmModeModeInfo
typedef struct _drmModeModeInfo { uint32_t clock; uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew; uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; uint32_t vrefresh; uint32_t flags; uint32_t type; char name[DRM_DISPLAY_MODE_LEN]; } drmModeModeInfo, *drmModeModeInfoPtr;drmModeFB
typedef struct _drmModeFB { uint32_t fb_id; uint32_t width, height; uint32_t pitch; uint32_t bpp; uint32_t depth; /* driver specific handle */ uint32_t handle; } drmModeFB, *drmModeFBPtr;drmModeFB2
typedef struct _drmModeFB2 { uint32_t fb_id; uint32_t width, height; uint32_t pixel_format; /* fourcc code from drm_fourcc.h */ uint64_t modifier; /* applies to all buffers */ uint32_t flags; /* per-plane GEM handle; may be duplicate entries for multiple planes */ uint32_t handles[4]; uint32_t pitches[4]; /* bytes */ uint32_t offsets[4]; /* bytes */ } drmModeFB2, *drmModeFB2Ptr;drmModePropertyBlobRes
typedef struct _drmModePropertyBlob { uint32_t id; uint32_t length; void *data; } drmModePropertyBlobRes, *drmModePropertyBlobPtr;drmModePropertyRes
typedef struct _drmModeProperty { uint32_t prop_id; uint32_t flags; char name[DRM_PROP_NAME_LEN]; int count_values; uint64_t *values; /* store the blob lengths */ int count_enums; struct drm_mode_property_enum *enums; int count_blobs; uint32_t *blob_ids; /* store the blob IDs */ } drmModePropertyRes, *drmModePropertyPtr;drmModeCrtc
typedef struct _drmModeCrtc { uint32_t crtc_id; uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */ uint32_t x, y; /**< Position on the framebuffer */ uint32_t width, height; int mode_valid; drmModeModeInfo mode; int gamma_size; /**< Number of gamma stops */ } drmModeCrtc, *drmModeCrtcPtr;drmModeEncoder
typedef struct _drmModeEncoder { uint32_t encoder_id; uint32_t encoder_type; uint32_t crtc_id; uint32_t possible_crtcs; uint32_t possible_clones; } drmModeEncoder, *drmModeEncoderPtr;drmModeConnector
typedef struct _drmModeConnector { uint32_t connector_id; uint32_t encoder_id; /**< Encoder currently connected to */ uint32_t connector_type; uint32_t connector_type_id; drmModeConnection connection; uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ drmModeSubPixel subpixel; int count_modes; drmModeModeInfoPtr modes; int count_props; uint32_t *props; /**< List of property ids */ uint64_t *prop_values; /**< List of property values */ int count_encoders; uint32_t *encoders; /**< List of encoder ids */ } drmModeConnector, *drmModeConnectorPtr;drmModeObjectProperties
typedef struct _drmModeObjectProperties { uint32_t count_props; uint32_t *props; uint64_t *prop_values; } drmModeObjectProperties, *drmModeObjectPropertiesPtr;drmModeFormatModifierIterator
typedef struct _drmModeFormatModifierIterator { uint32_t fmt_idx, mod_idx; uint32_t fmt; uint64_t mod; } drmModeFormatModifierIterator;drmModePlane
typedef struct _drmModePlane { uint32_t count_formats; uint32_t *formats; uint32_t plane_id; uint32_t crtc_id; uint32_t fb_id; uint32_t crtc_x, crtc_y; uint32_t x, y; uint32_t possible_crtcs; uint32_t gamma_size; } drmModePlane, *drmModePlanePtr;DRM相关结构体
drmVersion
typedef struct _drmVersion { int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel; /**< Patch level */ int name_len; /**< Length of name buffer */ char *name; /**< Name of driver */ int date_len; /**< Length of date buffer */ char *date; /**< User-space buffer to hold date */ int desc_len; /**< Length of desc buffer */ char *desc; /**< User-space buffer to hold desc */ } drmVersion, *drmVersionPtr;drmStatsT
typedef struct _drmStats { unsigned long count; /**< Number of data */ struct { unsigned long value; /**< Value from kernel */ const char *long_format; /**< Suggested format for long_name */ const char *long_name; /**< Long name for value */ const char *rate_format; /**< Suggested format for rate_name */ const char *rate_name; /**< Short name for value per second */ int isvalue; /**< True if value (vs. counter) */ const char *mult_names; /**< Multiplier names (e.g., "KGM") */ int mult; /**< Multiplier value (e.g., 1024) */ int verbose; /**< Suggest only in verbose output */ } data[15]; } drmStatsT;drmBufDesc
typedef struct _drmBufDesc { int count; /**< Number of buffers of this size */ int size; /**< Size in bytes */ int low_mark; /**< Low water mark */ int high_mark; /**< High water mark */ } drmBufDesc, *drmBufDescPtr;drmBufInfo
typedef struct _drmBufInfo { int count; /**< Number of buffers described in list */ drmBufDescPtr list; /**< List of buffer descriptions */ } drmBufInfo, *drmBufInfoPtr;drmBuf
typedef struct _drmBuf { int idx; /**< Index into the master buffer list */ int total; /**< Buffer size */ int used; /**< Amount of buffer in use (for DMA) */ drmAddress address; /**< Address */ } drmBuf, *drmBufPtr;drmBufMap
typedef struct _drmBufMap { int count; /**< Number of buffers mapped */ drmBufPtr list; /**< Buffers */ } drmBufMap, *drmBufMapPtr;drmLock
typedef struct _drmLock { volatile unsigned int lock; char padding[60]; /* This is big enough for most current (and future?) architectures: DEC Alpha: 32 bytes Intel Merced: ? Intel P5/PPro/PII/PIII: 32 bytes Intel StrongARM: 32 bytes Intel i386/i486: 16 bytes MIPS: 32 bytes (?) Motorola 68k: 16 bytes Motorola PowerPC: 32 bytes Sun SPARC: 32 bytes */ } drmLock, *drmLockPtr;drmDMAReq
typedef struct _drmDMAReq { drm_context_t context; /**< Context handle */ int send_count; /**< Number of buffers to send */ int *send_list; /**< List of handles to buffers */ int *send_sizes; /**< Lengths of data to send, in bytes */ drmDMAFlags flags; /**< Flags */ int request_count; /**< Number of buffers requested */ int request_size; /**< Desired size of buffers requested */ int *request_list; /**< Buffer information */ int *request_sizes; /**< Minimum acceptable sizes */ int granted_count; /**< Number of buffers granted at this size */ } drmDMAReq, *drmDMAReqPtr;drmRegion
typedef struct _drmRegion { drm_handle_t handle; unsigned int offset; drmSize size; drmAddress map; } drmRegion, *drmRegionPtr;drmTextureRegion
typedef struct _drmTextureRegion { unsigned char next; unsigned char prev; unsigned char in_use; unsigned char padding; /**< Explicitly pad this out */ unsigned int age; } drmTextureRegion, *drmTextureRegionPtr;drmVBlankReq
typedef struct _drmVBlankReq { drmVBlankSeqType type; unsigned int sequence; unsigned long signal; } drmVBlankReq, *drmVBlankReqPtr;drmVBlankReply
typedef struct _drmVBlankReply { drmVBlankSeqType type; unsigned int sequence; long tval_sec; long tval_usec; } drmVBlankReply, *drmVBlankReplyPtr;drmVBlank
typedef union _drmVBlank { drmVBlankReq request; drmVBlankReply reply; } drmVBlank, *drmVBlankPtr;drmSetVersion
typedef struct _drmSetVersion { int drm_di_major; int drm_di_minor; int drm_dd_major; int drm_dd_minor; } drmSetVersion, *drmSetVersionPtr;drmPciBusInfo
typedef struct _drmPciBusInfo { uint16_t domain; uint8_t bus; uint8_t dev; uint8_t func; } drmPciBusInfo, *drmPciBusInfoPtr;drmPciDeviceInfo
typedef struct _drmPciDeviceInfo { uint16_t vendor_id; uint16_t device_id; uint16_t subvendor_id; uint16_t subdevice_id; uint8_t revision_id; } drmPciDeviceInfo, *drmPciDeviceInfoPtr;drmUsbBusInfo
typedef struct _drmUsbBusInfo { uint8_t bus; uint8_t dev; } drmUsbBusInfo, *drmUsbBusInfoPtr;drmUsbDeviceInfo
typedef struct _drmUsbDeviceInfo { uint16_t vendor; uint16_t product; } drmUsbDeviceInfo, *drmUsbDeviceInfoPtr;drmPlatformBusInfo
typedef struct _drmPlatformBusInfo { char fullname[DRM_PLATFORM_DEVICE_NAME_LEN]; } drmPlatformBusInfo, *drmPlatformBusInfoPtr;drmPlatformDeviceInfo
typedef struct _drmPlatformDeviceInfo { char **compatible; /* NULL terminated list of compatible strings */ } drmPlatformDeviceInfo, *drmPlatformDeviceInfoPtr;drmHost1xBusInfo
typedef struct _drmHost1xBusInfo { char fullname[DRM_HOST1X_DEVICE_NAME_LEN]; } drmHost1xBusInfo, *drmHost1xBusInfoPtr;drmHost1xDeviceInfo
typedef struct _drmHost1xDeviceInfo { char **compatible; /* NULL terminated list of compatible strings */ } drmHost1xDeviceInfo, *drmHost1xDeviceInfoPtr;drmDevice
typedef struct _drmDevice { char **nodes; /* DRM_NODE_MAX sized array */ int available_nodes; /* DRM_NODE_* bitmask */ int bustype; union { drmPciBusInfoPtr pci; drmUsbBusInfoPtr usb; drmPlatformBusInfoPtr platform; drmHost1xBusInfoPtr host1x; } businfo; union { drmPciDeviceInfoPtr pci; drmUsbDeviceInfoPtr usb; drmPlatformDeviceInfoPtr platform; drmHost1xDeviceInfoPtr host1x; } deviceinfo; } drmDevice, *drmDevicePtr;Hash表相关结构体
HashBucket
typedef struct HashBucket { unsigned long key; void *value; struct HashBucket *next; } HashBucket, *HashBucketPtr;HashTable
typedef struct HashTable { unsigned long magic; unsigned long entries; unsigned long hits; /* At top of linked list */ unsigned long partials; /* Not at top of linked list */ unsigned long misses; /* Not in table */ HashBucketPtr buckets[HASH_SIZE]; int p0; HashBucketPtr p1; } HashTable, *HashTablePtr;Random相关结构体
RandomState
typedef struct RandomState { unsigned long magic; unsigned long a; unsigned long m; unsigned long q; /* m div a */ unsigned long r; /* m mod a */ unsigned long check; unsigned long seed; } RandomState;Skip List相关结构体
SLEntry
typedef struct SLEntry { unsigned long magic; /* SL_ENTRY_MAGIC */ unsigned long key; void *value; int levels; struct SLEntry *forward[1]; /* variable sized array */ } SLEntry, *SLEntryPtr;SkipList
typedef struct SkipList { unsigned long magic; /* SL_LIST_MAGIC */ int level; int count; SLEntryPtr head; SLEntryPtr p0; /* Position for iteration */ } SkipList, *SkipListPtr;