Skip to content

More derived info for the "d4" struct #69

@jdknox

Description

@jdknox

re:

} modes_D4;

This may or may not be useful to someone, but in any case:

Apple has an IOPixelInformation struct in IOKit/graphics/IOGraphicsTypes.h that sheds some light on the private API data, although the ordering/existence of the fields is a little different. (In this code, b32 is 32-bit byte-datatype, aka uint32_t.)

enum
{
    kIOMaxPixelBits     = 64
};
typedef char IOPixelEncoding[ kIOMaxPixelBits ];

typedef struct
{
    i32                 bytes_per_row;
    i32                 bits_per_pixel;
    i32                 bits_per_component;
    i32                 component_count;
    i32                 freq;                   // another one?
    i32                 h_dpi;
    i32                 v_dpi;
    IOPixelEncoding     pixel_format;           // ASCII text
    b32                 component_masks[8*2];   // these component masks have been all zeroes
                                                // for every monitor/laptop screen I've tested (both of them)
    i32                 reserved[2];
} IOPixelInformation2;

typedef struct
{
    b32                 mode_id;
    b32                 flags;
    i32                 width;
    i32                 height;
    i32                 depth;
    IOPixelInformation2 pixel_info;
    i32                 struct_size;        // always 212, or 0xd4!!!
    i16                 freq_fractional;    // this is a guess, which I haven't confirmed
    i16                 freq;
    b32                 flags2;             // these seem to be duplicates of the above `flags`
    b32                 id2;                // duplicate of the `mode_id`
    i32                 width_scaled;       // cached width*density?
    i32                 height_scaled;      // cached height*density?
    f32                 density;
} CGSDisplayMode;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions