You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pixbuf.h 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _IPXE_PIXBUF_H
  2. #define _IPXE_PIXBUF_H
  3. /** @file
  4. *
  5. * Pixel buffer
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stddef.h>
  10. #include <ipxe/refcnt.h>
  11. #include <ipxe/uaccess.h>
  12. /** A pixel buffer */
  13. struct pixel_buffer {
  14. /** Reference count */
  15. struct refcnt refcnt;
  16. /** Width */
  17. unsigned int width;
  18. /** Height */
  19. unsigned int height;
  20. /** 32-bit (8:8:8:8) xRGB pixel data, in host-endian order */
  21. userptr_t data;
  22. /** Total length */
  23. size_t len;
  24. };
  25. /**
  26. * Get reference to pixel buffer
  27. *
  28. * @v pixbuf Pixel buffer
  29. * @ret pixbuf Pixel buffer
  30. */
  31. static inline __attribute__ (( always_inline )) struct pixel_buffer *
  32. pixbuf_get ( struct pixel_buffer *pixbuf ) {
  33. ref_get ( &pixbuf->refcnt );
  34. return pixbuf;
  35. }
  36. /**
  37. * Drop reference to pixel buffer
  38. *
  39. * @v pixbuf Pixel buffer
  40. */
  41. static inline __attribute__ (( always_inline )) void
  42. pixbuf_put ( struct pixel_buffer *pixbuf ) {
  43. ref_put ( &pixbuf->refcnt );
  44. }
  45. extern struct pixel_buffer * alloc_pixbuf ( unsigned int width,
  46. unsigned int height );
  47. #endif /* _IPXE_PIXBUF_H */