|
24 | 24 | #include "backend/drm/drm.h"
|
25 | 25 | #include "backend/drm/iface.h"
|
26 | 26 | #include "backend/drm/util.h"
|
| 27 | +#include "render/pixel_format.h" |
27 | 28 | #include "render/swapchain.h"
|
28 | 29 | #include "util/signal.h"
|
29 | 30 |
|
@@ -378,15 +379,6 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn) {
|
378 | 379 | return true;
|
379 | 380 | }
|
380 | 381 |
|
381 |
| -static uint32_t strip_alpha_channel(uint32_t format) { |
382 |
| - switch (format) { |
383 |
| - case DRM_FORMAT_ARGB8888: |
384 |
| - return DRM_FORMAT_XRGB8888; |
385 |
| - default: |
386 |
| - return DRM_FORMAT_INVALID; |
387 |
| - } |
388 |
| -} |
389 |
| - |
390 | 382 | static bool test_buffer(struct wlr_drm_connector *conn,
|
391 | 383 | struct wlr_buffer *wlr_buffer) {
|
392 | 384 | struct wlr_drm_backend *drm = conn->backend;
|
@@ -420,10 +412,12 @@ static bool test_buffer(struct wlr_drm_connector *conn,
|
420 | 412 | attribs.format, attribs.modifier)) {
|
421 | 413 | // The format isn't supported by the plane. Try stripping the alpha
|
422 | 414 | // channel, if any.
|
423 |
| - uint32_t format = strip_alpha_channel(attribs.format); |
424 |
| - if (format != DRM_FORMAT_INVALID && wlr_drm_format_set_has( |
425 |
| - &crtc->primary->formats, format, attribs.modifier)) { |
426 |
| - attribs.format = format; |
| 415 | + const struct wlr_pixel_format_info *info = |
| 416 | + drm_get_pixel_format_info(attribs.format); |
| 417 | + if (info != NULL && info->opaque_substitute != DRM_FORMAT_INVALID && |
| 418 | + wlr_drm_format_set_has(&crtc->primary->formats, |
| 419 | + info->opaque_substitute, attribs.modifier)) { |
| 420 | + attribs.format = info->opaque_substitute; |
427 | 421 | } else {
|
428 | 422 | return false;
|
429 | 423 | }
|
|
0 commit comments