dpu_formats.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _DPU_FORMATS_H
  13. #define _DPU_FORMATS_H
  14. #include <drm/drm_fourcc.h>
  15. #include "msm_gem.h"
  16. #include "dpu_hw_mdss.h"
  17. /**
  18. * dpu_get_dpu_format_ext() - Returns dpu format structure pointer.
  19. * @format: DRM FourCC Code
  20. * @modifiers: format modifier array from client, one per plane
  21. */
  22. const struct dpu_format *dpu_get_dpu_format_ext(
  23. const uint32_t format,
  24. const uint64_t modifier);
  25. #define dpu_get_dpu_format(f) dpu_get_dpu_format_ext(f, 0)
  26. /**
  27. * dpu_get_msm_format - get an dpu_format by its msm_format base
  28. * callback function registers with the msm_kms layer
  29. * @kms: kms driver
  30. * @format: DRM FourCC Code
  31. * @modifiers: data layout modifier
  32. */
  33. const struct msm_format *dpu_get_msm_format(
  34. struct msm_kms *kms,
  35. const uint32_t format,
  36. const uint64_t modifiers);
  37. /**
  38. * dpu_populate_formats - populate the given array with fourcc codes supported
  39. * @format_list: pointer to list of possible formats
  40. * @pixel_formats: array to populate with fourcc codes
  41. * @pixel_modifiers: array to populate with drm modifiers, can be NULL
  42. * @pixel_formats_max: length of pixel formats array
  43. * Return: number of elements populated
  44. */
  45. uint32_t dpu_populate_formats(
  46. const struct dpu_format_extended *format_list,
  47. uint32_t *pixel_formats,
  48. uint64_t *pixel_modifiers,
  49. uint32_t pixel_formats_max);
  50. /**
  51. * dpu_format_check_modified_format - validate format and buffers for
  52. * dpu non-standard, i.e. modified format
  53. * @kms: kms driver
  54. * @msm_fmt: pointer to the msm_fmt base pointer of an dpu_format
  55. * @cmd: fb_cmd2 structure user request
  56. * @bos: gem buffer object list
  57. *
  58. * Return: error code on failure, 0 on success
  59. */
  60. int dpu_format_check_modified_format(
  61. const struct msm_kms *kms,
  62. const struct msm_format *msm_fmt,
  63. const struct drm_mode_fb_cmd2 *cmd,
  64. struct drm_gem_object **bos);
  65. /**
  66. * dpu_format_populate_layout - populate the given format layout based on
  67. * mmu, fb, and format found in the fb
  68. * @aspace: address space pointer
  69. * @fb: framebuffer pointer
  70. * @fmtl: format layout structure to populate
  71. *
  72. * Return: error code on failure, -EAGAIN if success but the addresses
  73. * are the same as before or 0 if new addresses were populated
  74. */
  75. int dpu_format_populate_layout(
  76. struct msm_gem_address_space *aspace,
  77. struct drm_framebuffer *fb,
  78. struct dpu_hw_fmt_layout *fmtl);
  79. #endif /*_DPU_FORMATS_H */