ui: gbm_wrapper: Ensure to create BOs with import-compatible modifier

This reverts I88be5cdc3b003e76f5331e910c17e2b85b34cfdb, which added a
fallback path to the import side, and instead tries to ensure we create
a valid buffer in the first place.

There are two issues in this code path:
1. `gbm_bo_create_with_modifiers()` does not take the `flags` argument
   into account.
   This can be solved by using `gbm_bo_create_with_modifiers2()`, which
   again would require various updates to the build system - the GBM
   version in Debian Bullseye did not have that symbol. Fortunately this
   is not an issue when we use the `GBM_BO_USE_SCANOUT` flag, which gets
   implicitely added by `gbm_bo_create_with_modifiers()` - the only
   use-case atm., see `GetSupportedGbmFlags()`. So this will only become
   a real issue once we want to pass other flags.
2. The more pressing issue is that Mesas GBM implementation of
   `gbm_bo_create_with_modifiers()` - which as mention above internally
   calls `gbm_bo_create_with_modifiers2()` with `GBM_BO_USE_SCANOUT` -
   ends up ignoring the flag and may create BOs with a modifier which
   does not support `GBM_BO_USE_SCANOUT`. This would fail later in
   `gbm_bo_import()`. See Mesa issue link below for more context.

While both issues will get fixed eventually, we'll need a workaround to
deal with the situation on current/older Mesa as well as the current GBM
dependency.

Do so by checking that `gbm_bo_import()` succeeds directly at creation
time. This ensures we either succeed or fail as early as possible,making
debugging much easier in the later case.

Non-working format/flags/modifier combinations are remembered once they fail and the modifier in question will get filtered out in advance in following requests.

Mesa issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8729

Bug: chromium:1394150
Change-Id: I6e6c6f36e32e7de46cc39c6c2b9cc81f3b95d432
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4380766
Reviewed-by: Maksim Sisov <msisov@igalia.com>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1124657}
1 file changed
tree: 0805a46178d68a4cb4c54365d2e63795995a2f0f
  1. android_webview/
  2. apps/
  3. ash/
  4. base/
  5. build/
  6. build_overrides/
  7. buildtools/
  8. cc/
  9. chrome/
  10. chromecast/
  11. chromeos/
  12. codelabs/
  13. components/
  14. content/
  15. courgette/
  16. crypto/
  17. dbus/
  18. device/
  19. docs/
  20. extensions/
  21. fuchsia_web/
  22. gin/
  23. google_apis/
  24. google_update/
  25. gpu/
  26. headless/
  27. infra/
  28. ios/
  29. ipc/
  30. media/
  31. mojo/
  32. native_client_sdk/
  33. net/
  34. pdf/
  35. ppapi/
  36. printing/
  37. remoting/
  38. rlz/
  39. sandbox/
  40. services/
  41. skia/
  42. sql/
  43. storage/
  44. styleguide/
  45. testing/
  46. third_party/
  47. tools/
  48. ui/
  49. url/
  50. weblayer/
  51. .clang-format
  52. .clang-tidy
  53. .eslintrc.js
  54. .git-blame-ignore-revs
  55. .gitattributes
  56. .gitignore
  57. .gn
  58. .mailmap
  59. .rustfmt.toml
  60. .vpython3
  61. .yapfignore
  62. ATL_OWNERS
  63. AUTHORS
  64. BUILD.gn
  65. CODE_OF_CONDUCT.md
  66. codereview.settings
  67. DEPS
  68. DIR_METADATA
  69. LICENSE
  70. LICENSE.chromium_os
  71. OWNERS
  72. PRESUBMIT.py
  73. PRESUBMIT_test.py
  74. PRESUBMIT_test_mocks.py
  75. README.md
  76. WATCHLISTS
README.md

Logo Chromium

Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.

The project's web site is https://www.chromium.org.

To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.

Documentation in the source is rooted in docs/README.md.

Learn how to Get Around the Chromium Source Code Directory Structure .

For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.

If you found a bug, please file it at https://crbug.com/new.