simplefb.h 2.1 KB

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