
主要内容本章主要讲解libdrm相关结构体的说明。Mode相关结构体drmModeRestypedef 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;drmModeModeInfotypedef 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;drmModeFBtypedef 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;drmModeFB2typedef 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;drmModePropertyBlobRestypedef struct _drmModePropertyBlob { uint32_t id; uint32_t length; void *data; } drmModePropertyBlobRes, *drmModePropertyBlobPtr;drmModePropertyRestypedef 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;drmModeCrtctypedef 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;drmModeEncodertypedef struct _drmModeEncoder { uint32_t encoder_id; uint32_t encoder_type; uint32_t crtc_id; uint32_t possible_crtcs; uint32_t possible_clones; } drmModeEncoder, *drmModeEncoderPtr;drmModeConnectortypedef 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;drmModeObjectPropertiestypedef struct _drmModeObjectProperties { uint32_t count_props; uint32_t *props; uint64_t *prop_values; } drmModeObjectProperties, *drmModeObjectPropertiesPtr;drmModeFormatModifierIteratortypedef struct _drmModeFormatModifierIterator { uint32_t fmt_idx, mod_idx; uint32_t fmt; uint64_t mod; } drmModeFormatModifierIterator;drmModePlanetypedef 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相关结构体drmVersiontypedef 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;drmStatsTtypedef 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;drmBufDesctypedef 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;drmBufInfotypedef struct _drmBufInfo { int count; /** Number of buffers described in list */ drmBufDescPtr list; /** List of buffer descriptions */ } drmBufInfo, *drmBufInfoPtr;drmBuftypedef 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;drmBufMaptypedef struct _drmBufMap { int count; /** Number of buffers mapped */ drmBufPtr list; /** Buffers */ } drmBufMap, *drmBufMapPtr;drmLocktypedef 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;drmDMAReqtypedef 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;drmRegiontypedef struct _drmRegion { drm_handle_t handle; unsigned int offset; drmSize size; drmAddress map; } drmRegion, *drmRegionPtr;drmTextureRegiontypedef struct _drmTextureRegion { unsigned char next; unsigned char prev; unsigned char in_use; unsigned char padding; /** Explicitly pad this out */ unsigned int age; } drmTextureRegion, *drmTextureRegionPtr;drmVBlankReqtypedef struct _drmVBlankReq { drmVBlankSeqType type; unsigned int sequence; unsigned long signal; } drmVBlankReq, *drmVBlankReqPtr;drmVBlankReplytypedef struct _drmVBlankReply { drmVBlankSeqType type; unsigned int sequence; long tval_sec; long tval_usec; } drmVBlankReply, *drmVBlankReplyPtr;drmVBlanktypedef union _drmVBlank { drmVBlankReq request; drmVBlankReply reply; } drmVBlank, *drmVBlankPtr;drmSetVersiontypedef struct _drmSetVersion { int drm_di_major; int drm_di_minor; int drm_dd_major; int drm_dd_minor; } drmSetVersion, *drmSetVersionPtr;drmPciBusInfotypedef struct _drmPciBusInfo { uint16_t domain; uint8_t bus; uint8_t dev; uint8_t func; } drmPciBusInfo, *drmPciBusInfoPtr;drmPciDeviceInfotypedef struct _drmPciDeviceInfo { uint16_t vendor_id; uint16_t device_id; uint16_t subvendor_id; uint16_t subdevice_id; uint8_t revision_id; } drmPciDeviceInfo, *drmPciDeviceInfoPtr;drmUsbBusInfotypedef struct _drmUsbBusInfo { uint8_t bus; uint8_t dev; } drmUsbBusInfo, *drmUsbBusInfoPtr;drmUsbDeviceInfotypedef struct _drmUsbDeviceInfo { uint16_t vendor; uint16_t product; } drmUsbDeviceInfo, *drmUsbDeviceInfoPtr;drmPlatformBusInfotypedef struct _drmPlatformBusInfo { char fullname[DRM_PLATFORM_DEVICE_NAME_LEN]; } drmPlatformBusInfo, *drmPlatformBusInfoPtr;drmPlatformDeviceInfotypedef struct _drmPlatformDeviceInfo { char **compatible; /* NULL terminated list of compatible strings */ } drmPlatformDeviceInfo, *drmPlatformDeviceInfoPtr;drmHost1xBusInfotypedef struct _drmHost1xBusInfo { char fullname[DRM_HOST1X_DEVICE_NAME_LEN]; } drmHost1xBusInfo, *drmHost1xBusInfoPtr;drmHost1xDeviceInfotypedef struct _drmHost1xDeviceInfo { char **compatible; /* NULL terminated list of compatible strings */ } drmHost1xDeviceInfo, *drmHost1xDeviceInfoPtr;drmDevicetypedef 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表相关结构体HashBuckettypedef struct HashBucket { unsigned long key; void *value; struct HashBucket *next; } HashBucket, *HashBucketPtr;HashTabletypedef 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相关结构体RandomStatetypedef 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相关结构体SLEntrytypedef struct SLEntry { unsigned long magic; /* SL_ENTRY_MAGIC */ unsigned long key; void *value; int levels; struct SLEntry *forward[1]; /* variable sized array */ } SLEntry, *SLEntryPtr;SkipListtypedef struct SkipList { unsigned long magic; /* SL_LIST_MAGIC */ int level; int count; SLEntryPtr head; SLEntryPtr p0; /* Position for iteration */ } SkipList, *SkipListPtr;