Linux – way to add margin, border, offset or padding to the Linux frame buffer text console to compensate for HDMI overscan

consoleframebufferhdmilinux

I have a newly bought cheap 8 inch TFT LCD display that is "cutting the edges off" on all sides (i.e., not showing all the pixels). I've come to understand that this is due to "overscan" which seems to afflict mainly TVs using HDMI input.

My kernel is first booting up into efifb and then switching over to inteldrmfb — both frame buffer drivers exhibit the issue. I am not using X windows and will never want to use X on this tiny display. All I am wanting to do is use the Linux text console. So any solution using "xrandr" is out.

I have tried everything I can find regarding driver-level (kernel-level) frame buffer settings to solve this problem, including tweaking the resolution settings with the "video" kernel boot parameter and by tweaking the timing settings post-boot with fbset, but no matter what I do with fbset, it seems to be ignored.

So my question is this: Is there a way, perhaps higher level than at the frame buffer driver level, that I can add margin around the frame buffer console?

I know I can use "stty" to shorten the number of columns and rows that Linux will use on the console, but that will only solve the issue on the right side and the bottom side and still leave characters cut off on the left side and the top side. Is there a way to use "stty" to add a "first column" and "first row" offset to the console (i.e., some whitespace padding)? If not with stty, with some other light-weight tool (not X windows)?

Best Answer

You may give the fbset command a try.

Running fbset -i will show you some info about your current framebuffer settings, including a "timings" line. For me all of the values are 0-s, which probably means that they are not used, but if you see some actual values there, you could try tweaking them.

An excerpt from man fbset:

   Display timings:

          -pixclock <value>
                 set  the  length  of one pixel (in picosec‐
                 onds). Note that the  frame  buffer  device
                 may only support some pixel lengths

          -left <value>
                 set left margin (in pixels)

          -right <value>
                 set right margin (in pixels)

          -upper <value>
                 set upper margin (in pixel lines)

          -lower <value>
                 set lower margin (in pixel lines)

          -hslen <value>
                 set horizontal sync length (in pixels)

          -vslen <value>
                 set vertical sync length (in pixel lines)

          --timings, -t ...
                 set  all  timing  parameters at once in the
                 order  <pixclock>  <left>  <right>  <upper>
                 <lower>  <hslen> <vslen>, e.g.  -t 35242 64
                 96 35 12 112 2

Please note the -left, -right, -upper, -lower parameters. fbset even has a -move command that increases one of these values and decreases the opposite one at the same time:

   Display positioning:

          -move {left|right|up|down}
                 move the visible part of the display in the
                 specified direction

          -step <value>
                 set  step  size for display positioning (in
                 pixels or pixel lines),  if  -step  is  not
                 given  display will be moved 8 pixels hori‐
                 zontally or 2 pixel lines vertically
Related Question