simplefb.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * simplefb.h - Simple Framebuffer Device
  3. *
  4. * Copyright (C) 2013 David Herrmann <dh.herrmann@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef __PLATFORM_DATA_SIMPLEFB_H__
  12. #define __PLATFORM_DATA_SIMPLEFB_H__
  13. #include <drm/drm_fourcc.h>
  14. #include <linux/fb.h>
  15. #include <linux/kernel.h>
  16. /* format array, use it to initialize a "struct simplefb_format" array */
  17. #define SIMPLEFB_FORMATS \
  18. { \
  19. { "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0}, DRM_FORMAT_RGB565 }, \
  20. { "x1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {0, 0}, DRM_FORMAT_XRGB1555 }, \
  21. { "a1r5g5b5", 16, {10, 5}, {5, 5}, {0, 5}, {15, 1}, DRM_FORMAT_ARGB1555 }, \
  22. { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \
  23. { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \
  24. { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \
  25. { "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \
  26. { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \
  27. { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
  28. }
  29. /*
  30. * Data-Format for Simple-Framebuffers
  31. * @name: unique 0-terminated name that can be used to identify the mode
  32. * @red,green,blue: Offsets and sizes of the single RGB parts
  33. * @transp: Offset and size of the alpha bits. length=0 means no alpha
  34. * @fourcc: 32bit DRM four-CC code (see drm_fourcc.h)
  35. */
  36. struct simplefb_format {
  37. const char *name;
  38. u32 bits_per_pixel;
  39. struct fb_bitfield red;
  40. struct fb_bitfield green;
  41. struct fb_bitfield blue;
  42. struct fb_bitfield transp;
  43. u32 fourcc;
  44. };
  45. /*
  46. * Simple-Framebuffer description
  47. * If the arch-boot code creates simple-framebuffers without DT support, it
  48. * can pass the width, height, stride and format via this platform-data object.
  49. * The framebuffer location must be given as IORESOURCE_MEM resource.
  50. * @format must be a format as described in "struct simplefb_format" above.
  51. */
  52. struct simplefb_platform_data {
  53. u32 width;
  54. u32 height;
  55. u32 stride;
  56. const char *format;
  57. };
  58. #endif /* __PLATFORM_DATA_SIMPLEFB_H__ */