Guest User

Untitled

a guest
Sep 18th, 2026
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. diff --git a/drivers/gpu/drm/apple/apple_drv.c b/drivers/gpu/drm/apple/apple_drv.c
  2. index 9f99516b7..f8e851aa4 100644
  3. --- a/drivers/gpu/drm/apple/apple_drv.c
  4. +++ b/drivers/gpu/drm/apple/apple_drv.c
  5. @@ -510,7 +510,7 @@ static int apple_drm_init(struct device *dev)
  6. if (ret)
  7. goto err_unbind;
  8.  
  9. - drm_client_setup_with_fourcc(&apple->drm, DRM_FORMAT_XRGB8888);
  10. + drm_client_setup_with_fourcc(&apple->drm, DRM_FORMAT_ARGB8888);
  11.  
  12. return 0;
  13.  
  14. diff --git a/drivers/gpu/drm/apple/plane.c b/drivers/gpu/drm/apple/plane.c
  15. index f92875e63..70b294ea2 100644
  16. --- a/drivers/gpu/drm/apple/plane.c
  17. +++ b/drivers/gpu/drm/apple/plane.c
  18. @@ -359,16 +359,12 @@ static const struct drm_plane_funcs apple_plane_funcs = {
  19. * formats, an extra RGBA format, and a biplanar RGB10_A8 format (fourcc b3a8)
  20. * used for HDR.
  21. *
  22. - * Note: we don't have non-alpha formats but userspace breaks without XRGB. It
  23. - * doesn't matter for the primary plane, but cursors/overlays must not
  24. - * advertise formats without alpha.
  25. + * DCP uses alpha when blending cropped surfaces, even for the bottommost
  26. + * plane. Only advertise RGB formats with an alpha channel.
  27. */
  28. static const u32 dcp_primary_formats[] = {
  29. - DRM_FORMAT_XRGB2101010,
  30. DRM_FORMAT_ARGB2101010,
  31. - DRM_FORMAT_XRGB8888,
  32. DRM_FORMAT_ARGB8888,
  33. - DRM_FORMAT_XBGR8888,
  34. DRM_FORMAT_ABGR8888,
  35. DRM_FORMAT_NV12,
  36. DRM_FORMAT_NV16,
  37. @@ -398,9 +394,7 @@ static const u32 dcp_overlay_formats[] = {
  38. * Formats for the 12.x firmware which does not support "l10r" / ARGB2101010
  39. */
  40. static const u32 dcp_primary_formats_12_x[] = {
  41. - DRM_FORMAT_XRGB8888,
  42. DRM_FORMAT_ARGB8888,
  43. - DRM_FORMAT_XBGR8888,
  44. DRM_FORMAT_ABGR8888,
  45. DRM_FORMAT_NV12,
  46. DRM_FORMAT_NV16,
  47. diff --git a/drivers/gpu/drm/clients/drm_fbdev_client.c b/drivers/gpu/drm/clients/drm_fbdev_client.c
  48. index 91d196a39..1639d0e7e 100644
  49. --- a/drivers/gpu/drm/clients/drm_fbdev_client.c
  50. +++ b/drivers/gpu/drm/clients/drm_fbdev_client.c
  51. @@ -158,6 +158,8 @@ int drm_fbdev_client_setup(struct drm_device *dev, const struct drm_format_info
  52. if (!fb_helper)
  53. return -ENOMEM;
  54. drm_fb_helper_prepare(dev, fb_helper, color_mode, NULL);
  55. + if (format && format->depth)
  56. + fb_helper->preferred_format = format->format;
  57.  
  58. ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs);
  59. if (ret) {
  60. diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
  61. index 80ca785bd..b567f513b 100644
  62. --- a/drivers/gpu/drm/drm_fb_helper.c
  63. +++ b/drivers/gpu/drm/drm_fb_helper.c
  64. @@ -401,6 +401,7 @@ void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
  65. helper->funcs = funcs;
  66. helper->dev = dev;
  67. helper->preferred_bpp = preferred_bpp;
  68. + helper->preferred_format = DRM_FORMAT_INVALID;
  69. }
  70. EXPORT_SYMBOL(drm_fb_helper_prepare);
  71.  
  72. @@ -1415,6 +1416,14 @@ static int __drm_fb_helper_find_sizes(struct drm_fb_helper *fb_helper,
  73. if (surface_format != DRM_FORMAT_INVALID)
  74. break; /* found supported format */
  75.  
  76. + /* Preserve an explicit format instead of reducing it to a color mode. */
  77. + if (fb_helper->preferred_format &&
  78. + drm_plane_has_format(plane, fb_helper->preferred_format,
  79. + DRM_FORMAT_MOD_LINEAR)) {
  80. + surface_format = fb_helper->preferred_format;
  81. + break;
  82. + }
  83. +
  84. /* try preferred color mode */
  85. surface_format = drm_fb_helper_find_format(fb_helper,
  86. plane->format_types,
  87. diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
  88. index 0c5e5ed7b..fe5fcca41 100644
  89. --- a/include/drm/drm_fb_helper.h
  90. +++ b/include/drm/drm_fb_helper.h
  91. @@ -198,6 +198,12 @@ struct drm_fb_helper {
  92. */
  93. int preferred_bpp;
  94.  
  95. + /**
  96. + * @preferred_format: Explicit driver-preferred framebuffer format, or
  97. + * zero to select a format from @preferred_bpp.
  98. + */
  99. + u32 preferred_format;
  100. +
  101. #ifdef CONFIG_FB_DEFERRED_IO
  102. /**
  103. * @fbdefio:
  104.  
Advertisement
Add Comment
Please, Sign In to add comment