x86_fb.c 638 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. *
  3. * Vesa frame buffer driver for x86
  4. *
  5. * Copyright (C) 2014 Google, Inc
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <common.h>
  10. #include <video_fb.h>
  11. #include <vbe.h>
  12. #include "videomodes.h"
  13. /*
  14. * The Graphic Device
  15. */
  16. GraphicDevice ctfb;
  17. void *video_hw_init(void)
  18. {
  19. GraphicDevice *gdev = &ctfb;
  20. int bits_per_pixel;
  21. printf("Video: ");
  22. if (vbe_get_video_info(gdev)) {
  23. printf("No video mode configured\n");
  24. return NULL;
  25. }
  26. bits_per_pixel = gdev->gdfBytesPP * 8;
  27. sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY,
  28. bits_per_pixel);
  29. printf("%s\n", gdev->modeIdent);
  30. return (void *)gdev;
  31. }