The rfb code maintains an array of CRCs for 32x32 tiles in the
framebuffer. This array is sized statically based on the rfb code's
notion of the maximum framebuffer size, which changed in commit
fb51ddb20d57 without updating the rfb code.
Morever, writes to the framebuffer BAR can modify the recorded height
and width of the framebuffer. These values were not validated against
the maximum at all, unlike the parameters set via bhyve config.
Fix these problems:
- Define the maximum width and height in a shared header file so that they do not get out of sync again.
- In pci_fbuf_render(), don't resize the console if the new dimensions are too large.
- Add a mutex to synchronize framebuffer BAR I/O with the rfb thread.
Fixes: fb51ddb20d57 ("bhyve: increase fbuf display resolution limit")