0003-dri-Add-some-new-DRI-formats-and-fourccs.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 31cc2cd723963bdecb2c5d5e4c09598ee830f0d6 Mon Sep 17 00:00:00 2001
  2. From: Frank Binns <frank.binns@imgtec.com>
  3. Date: Thu, 5 Jun 2014 12:07:01 +0100
  4. Subject: [PATCH] dri: Add some new DRI formats and fourccs
  5. Add ARGB4444 DRI format and fourcc.
  6. Add YVU444_PACK10_IMG DRI format and fourcc.
  7. Add BGR888 DRI format and fourcc.
  8. ---
  9. include/GL/internal/dri_interface.h | 4 ++++
  10. include/drm-uapi/drm_fourcc.h | 1 +
  11. src/egl/drivers/dri2/egl_dri2.c | 1 +
  12. src/mesa/drivers/dri/common/dri_util.c | 5 +++++
  13. 4 files changed, 11 insertions(+)
  14. diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
  15. index 66dc092..5102894 100644
  16. --- a/include/GL/internal/dri_interface.h
  17. +++ b/include/GL/internal/dri_interface.h
  18. @@ -1367,6 +1367,9 @@ struct __DRIdri2ExtensionRec {
  19. #define __DRI_IMAGE_FORMAT_ABGR16161616F 0x1015
  20. #define __DRI_IMAGE_FORMAT_SXRGB8 0x1016
  21. #define __DRI_IMAGE_FORMAT_ABGR16161616 0x1017
  22. +#define __DRI_IMAGE_FORMAT_ARGB4444 0x1018
  23. +#define __DRI_IMAGE_FORMAT_YVU444_PACK10_IMG 0x1019
  24. +#define __DRI_IMAGE_FORMAT_BGR888 0x101a
  25. #define __DRI_IMAGE_USE_SHARE 0x0001
  26. #define __DRI_IMAGE_USE_SCANOUT 0x0002
  27. @@ -1397,6 +1400,7 @@ struct __DRIdri2ExtensionRec {
  28. #define __DRI_IMAGE_FOURCC_SABGR8888 0x84324258
  29. #define __DRI_IMAGE_FOURCC_SXRGB8888 0x85324258
  30. #define __DRI_IMAGE_FOURCC_RGBA16161616 0x38344152 /* fourcc_code('R', 'A', '4', '8' ) */
  31. +#define __DRI_IMAGE_FOURCC_SBGR888 0xff324742
  32. /**
  33. * Queryable on images created by createImageFromNames.
  34. diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h
  35. index cd3ce8a..5765759 100644
  36. --- a/include/drm-uapi/drm_fourcc.h
  37. +++ b/include/drm-uapi/drm_fourcc.h
  38. @@ -344,6 +344,7 @@ extern "C" {
  39. #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
  40. #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
  41. +#define DRM_FORMAT_YVU444_PACK10_IMG fourcc_code('I', 'M', 'G', '2')
  42. /*
  43. * Format Modifiers:
  44. diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
  45. index 9e5a55a..eee28eb 100644
  46. --- a/src/egl/drivers/dri2/egl_dri2.c
  47. +++ b/src/egl/drivers/dri2/egl_dri2.c
  48. @@ -2652,6 +2652,7 @@ dri2_num_fourcc_format_planes(EGLint format)
  49. case DRM_FORMAT_Y410:
  50. case DRM_FORMAT_Y412:
  51. case DRM_FORMAT_Y416:
  52. + case DRM_FORMAT_YVU444_PACK10_IMG:
  53. return 1;
  54. case DRM_FORMAT_NV12:
  55. diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
  56. index e2a1124..caed5fa 100644
  57. --- a/src/mesa/drivers/dri/common/dri_util.c
  58. +++ b/src/mesa/drivers/dri/common/dri_util.c
  59. @@ -904,6 +904,11 @@ static const struct {
  60. .mesa_format = MESA_FORMAT_B5G5R5A1_UNORM,
  61. .internal_format = GL_RGB5_A1,
  62. },
  63. + {
  64. + .image_format = __DRI_IMAGE_FORMAT_ARGB4444,
  65. + .mesa_format = MESA_FORMAT_B4G4R4A4_UNORM,
  66. + .internal_format = GL_RGBA4,
  67. + },
  68. {
  69. .image_format = __DRI_IMAGE_FORMAT_XRGB8888,
  70. .mesa_format = MESA_FORMAT_B8G8R8X8_UNORM,