[lkml]   [1999]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectMAX_FB: maximum number of fbdevs

    Because of historical reasons[*], the minor numbering for special device nodes
    for frame buffer devices contains gaps:

    0 = /dev/fb0 First frame buffer
    32 = /dev/fb1 Second frame buffer
    64 = /dev/fb2 Third frame buffer

    This limits the maximum number of active frame buffer devices to 8 (FB_MAX):

    #define FB_MODES_SHIFT 5 /* 32 modes per framebuffer */
    #define FB_NUM_MINORS 256 /* 256 Minors */
    #define FB_MAX (FB_NUM_MINORS / (1 << FB_MODES_SHIFT))
    #define GET_FB_IDX(node) (MINOR(node) >> FB_MODES_SHIFT)

    However, people are already working on frame buffer device drivers for machines
    with 16 and more heads. So I'd like to raise FB_MAX to at least 32 for now.

    To solve this problem, I see two possible solutions:

    1. Remove the gaps and number the device nodes naturally:

    0 = /dev/fb0 First frame buffer
    1 = /dev/fb1 Second frame buffer
    2 = /dev/fb2 Third frame buffer

    The macros FB_MODES_SHIFT, FB_NUM_MINORS and GET_FB_IDX can be removed.

    We can allocate minors 0-31 for the first 32 frame buffer devices, and
    keep 32-255 reserved for future expansion.

    - Most logical numbering.
    - Minors 32-255 are reserved for future expansion.
    - Tighter code.
    - I already have an (untested) patch :-)

    - Not 100% backwards compatible: requires recreating special device nodes
    /dev/fb* other than /dev/fb0.

    2. Fill the gaps with device nodes for frame buffer devices 9 and up, by
    cleverly changing the macros to shuffle the bits:

    #define FB_MAX 32
    #define GET_FB_IDX(node) \
    ((MINOR(node) >> FB_MODES_SHIFT) | \
    ((MINOR(node) & ((1 << FB_MODES_SHIFT)-1)) << (8-FB_MODES_SHIFT)))

    - 100% backwards compatible for /dev/fb0 through /dev/fb7.
    - Only <linux/fb.h> and Documentation/devices.t{ex,xt} have to be

    - Ugly bit shuffling causes larger generated code sizes.
    - Ugly to reserve minors for future expansion.

    Since this matters only for the rare people who use more than one frame buffer
    device at the same time (/dev/fb0 is not affected), I vote for the first
    solution, which is cleaner. If we ever want to change the minor numbering, we
    better do it as soon as possible anyway.

    What do you think?


    [*] Originally the minors for ((minor & 31) != 0) were used to store
    preprogrammed video modes. One could then switch to a preprogrammed video
    mode by touch'ing the corresponding special device node, or launch X in a
    different video mode by setting FRAMEBUFFER=/dev/fb0<my_favorite_mode>.
    Since this imposed an arbitrary limitation on the number of preprogrammed
    modes in the kernel and the same thing could be done from user space as
    well (using fbset), we decided to drop this feature.
    Geert Uytterhoeven -- Linux/{m68k~Amiga,PPC~CHRP} --

    In personal conversations with technical people, I call myself a hacker. But
    when I'm talking to journalists I just say "programmer" or something like that.
    -- Linus Torvalds

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:55    [W:0.021 / U:38.352 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site