On 21/2/25 18:01, Paolo Bonzini wrote:
On 2/20/25 16:19, Philippe Mathieu-Daudé wrote:
Hmm what about keeping a MAC_PVG_COMMON instead:

-- >8 --
--- a/hw/display/Kconfig
+++ b/hw/display/Kconfig
@@ -141,15 +141,17 @@ config XLNX_DISPLAYPORT
  config DM163
      bool

-config MAC_PVG
+config MAC_PVG_COMMON
      bool
-    default y
+    depends on MAC_PVG

  config MAC_PVG_MMIO
      bool
-    depends on MAC_PVG && AARCH64
+    depends on AARCH64

It's possible, but the two "depends on MAC_PVG" cannot be removed here,
because otherwise MAC_PVG_PCI would be selected by "default y".  The
only reason to do so, in my opinion, was if one wanted to build pvg as
a module, otherwise it's just (a handful) more lines of code with no
particular benefit.

-if host_os == 'darwin'
-  system_ss.add(when: 'CONFIG_MAC_PVG',         if_true: [files('apple- gfx.m'), pvg, metal]) -  system_ss.add(when: 'CONFIG_MAC_PVG_PCI',     if_true: [files('apple- gfx-pci.m'), pvg, metal])
-  if cpu == 'aarch64'
-    system_ss.add(when: 'CONFIG_MAC_PVG_MMIO',  if_true: [files('apple- gfx-mmio.m'), pvg, metal])
-  endif
-endif
+system_ss.add(when: 'CONFIG_MAC_PVG_COMMON', if_true: [files('apple- gfx.m'), pvg, metal]) +system_ss.add(when: 'CONFIG_MAC_PVG_PCI',    if_true: [files('apple- gfx-pci.m'), pvg, metal]) +system_ss.add(when: 'CONFIG_MAC_PVG_MMIO',   if_true: [files('apple- gfx-mmio.m'), pvg, metal])

Removing the "if" is independent of whether you keep CONFIG_MAC_PVG_COMMON.
I can squash that in patch 2:

-if pvg.found()
-  system_ss.add(when: 'CONFIG_MAC_PVG_PCI',     if_true: [files('apple- gfx.m', 'apple-gfx-pci.m'), pvg]) -  system_ss.add(when: 'CONFIG_MAC_PVG_MMIO',    if_true: [files('apple- gfx.m', 'apple-gfx-mmio.m'), pvg])
-endif
+system_ss.add(when: [pvg, 'CONFIG_MAC_PVG_PCI'],     if_true: [files('apple-gfx.m', 'apple-gfx-pci.m')]) +system_ss.add(when: [pvg, 'CONFIG_MAC_PVG_MMIO'],    if_true: [files('apple-gfx.m', 'apple-gfx-mmio.m')])

(you need to keep the conditional, whether as "if" or "when:"; otherwise,
because Meson cannot know that the .m files will never be built, it
complains that you don't have an Objective-C compiler).

Ah, I haven't thought of that.

Series:
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to