[PATCH] hw/display/apple: Fix obsolete PGDevice function

Yundi Xu posted 1 patch 1 month, 2 weeks ago
Failed in applying to current master (apply log)
hw/display/apple-gfx.m | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
[PATCH] hw/display/apple: Fix obsolete PGDevice function
Posted by Yundi Xu 1 month, 2 weeks ago
PGNewDeviceWithDescriptor is obsolete. Replace with
PGCreateDeviceWIthDescriptor.

Signed-off-by: Yundi Xu<yundi.eric.xu@gmail.com>
---
  hw/display/apple-gfx.m | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m
index be0061b9db..e730909c7e 100644
--- a/hw/display/apple-gfx.m
+++ b/hw/display/apple-gfx.m
@@ -767,7 +767,24 @@ bool apple_gfx_common_realize(AppleGFXState *s, DeviceState *dev,
  
      s->cursor_show = true;
  
+    /*
+     * PGNewDeviceWithDescriptor() was deprecated in macOS 15.2 and removed
+     * in 27.0.
+     *
+     * It is replaced by PGCreateDeviceWithDescriptor(), which is available in
+     * >=15.2
+     */
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 270000
+    s->pgdev = PGCreateDeviceWithDescriptor(desc);
+#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 150200
+    if (@available(macOS 15.2, *)) {
+        s->pgdev = PGCreateDeviceWithDescriptor(desc);
+    } else {
+        s->pgdev = PGNewDeviceWithDescriptor(desc);
+    }
+#else /* (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200) */
      s->pgdev = PGNewDeviceWithDescriptor(desc);
+#endif /* (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200) */
  
      disp_desc = apple_gfx_prepare_display_descriptor(s);
      /*

---
base-commit: f7ada39edacaa5c26b30e98b94017b0b2ccbcf94
change-id: 20261001-fix-pgcreatedevicewithdescriptor-3ec303c2500a

Best regards,
--
Yundi Xu<yundi.eric.xu@gmail.com>
Re: [PATCH] hw/display/apple: Fix obsolete PGDevice function
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
Hi,

Cc'ing Akihiko and Marc-André.

On 5/10/26 22:59, Yundi Xu wrote:
> PGNewDeviceWithDescriptor is obsolete. Replace with
> PGCreateDeviceWIthDescriptor.

Joelle did a similar fix, can you compare?
https://github.com/helixml/qemu-utm/commit/b795d6de88fc52cb6ff061e0e034be51d8e9c474

> 
> Signed-off-by: Yundi Xu<yundi.eric.xu@gmail.com>
> ---
>   hw/display/apple-gfx.m | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/hw/display/apple-gfx.m b/hw/display/apple-gfx.m
> index be0061b9db..e730909c7e 100644
> --- a/hw/display/apple-gfx.m
> +++ b/hw/display/apple-gfx.m
> @@ -767,7 +767,24 @@ bool apple_gfx_common_realize(AppleGFXState *s, 
> DeviceState *dev,
> 
>       s->cursor_show = true;
> 
> +    /*
> +     * PGNewDeviceWithDescriptor() was deprecated in macOS 15.2 and 
> removed
> +     * in 27.0.
> +     *
> +     * It is replaced by PGCreateDeviceWithDescriptor(), which is 
> available in
> +     * >=15.2
> +     */
> +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 270000
> +    s->pgdev = PGCreateDeviceWithDescriptor(desc);
> +#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 150200
> +    if (@available(macOS 15.2, *)) {
> +        s->pgdev = PGCreateDeviceWithDescriptor(desc);
> +    } else {
> +        s->pgdev = PGNewDeviceWithDescriptor(desc);
> +    }
> +#else /* (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200) */
>       s->pgdev = PGNewDeviceWithDescriptor(desc);
> +#endif /* (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150200) */
> 
>       disp_desc = apple_gfx_prepare_display_descriptor(s);
>       /*
> 
> ---
> base-commit: f7ada39edacaa5c26b30e98b94017b0b2ccbcf94
> change-id: 20261001-fix-pgcreatedevicewithdescriptor-3ec303c2500a
> 
> Best regards,
> -- 
> Yundi Xu<yundi.eric.xu@gmail.com>
> 
> 


Re: [PATCH] hw/display/apple: Fix obsolete PGDevice function
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
On 2026-10-07 9:51, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> Cc'ing Akihiko and Marc-André.
> 
> On 5/10/26 22:59, Yundi Xu wrote:
>> PGNewDeviceWithDescriptor is obsolete. Replace with
>> PGCreateDeviceWIthDescriptor.
> 
> Joelle did a similar fix, can you compare?
> https://github.com/helixml/qemu-utm/commit/ 
> b795d6de88fc52cb6ff061e0e034be51d8e9c474

The mailing list seemed down and I started to receive new
ones, in particular Peter pointing to another fix:
https://patchew.org/QEMU/20260916100021.73825-1-mohamed@unpredictable.fr/20260916100021.73825-6-mohamed@unpredictable.fr/

So please disregard my comments, sorry for the noise.

> 
>>
>> Signed-off-by: Yundi Xu<yundi.eric.xu@gmail.com>
>> ---
>>   hw/display/apple-gfx.m | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)

Re: [PATCH] hw/display/apple: Fix obsolete PGDevice function
Posted by Akihiko Odaki 1 month, 2 weeks ago
On 2026/10/07 18:40, Philippe Mathieu-Daudé wrote:
> On 2026-10-07 9:51, Philippe Mathieu-Daudé wrote:
>> Hi,
>>
>> Cc'ing Akihiko and Marc-André.
>>
>> On 5/10/26 22:59, Yundi Xu wrote:
>>> PGNewDeviceWithDescriptor is obsolete. Replace with
>>> PGCreateDeviceWIthDescriptor.
>>
>> Joelle did a similar fix, can you compare?
>> https://github.com/helixml/qemu-utm/commit/ 
>> b795d6de88fc52cb6ff061e0e034be51d8e9c474
> 
> The mailing list seemed down and I started to receive new
> ones, in particular Peter pointing to another fix:
> https://patchew.org/QEMU/20260916100021.73825-1- 
> mohamed@unpredictable.fr/20260916100021.73825-6-mohamed@unpredictable.fr/
> 
> So please disregard my comments, sorry for the noise.

Adding Mohamed Mediouni to To.

There is one thing I noticed: we don't need the compatibility check at all.

docs/about/build-platforms.rst says:
 > Support for the previous major version will be dropped 2 years after
 > the new major version is released or when the vendor itself drops
 > support, whichever comes first.

macOS 15 is the oldest supported major version since it is released 
September 2024, which is over 2 years ago.

It also says:
 > Within each major release, only the most recent minor release is
 > considered.

macOS 15.8.1 is the oldest supported version since it is the most recent 
minor release of macOS 15. Compatibility checks for older versions are 
unnecessary.

Regards,
Akihiko Odaki

Re: [PATCH] hw/display/apple: Fix obsolete PGDevice function
Posted by Peter Maydell 1 month, 2 weeks ago
On Mon, 5 Oct 2026 at 22:52, Yundi Xu <yundi.eric.xu@gmail.com> wrote:
>
> PGNewDeviceWithDescriptor is obsolete. Replace with
> PGCreateDeviceWIthDescriptor.
>
> Signed-off-by: Yundi Xu<yundi.eric.xu@gmail.com>
> ---
>   hw/display/apple-gfx.m | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)

There's a somewhat more comprehensive set of changes to this
device that include something like this one already on the list:

https://patchew.org/QEMU/20260916100021.73825-1-mohamed@unpredictable.fr/20260916100021.73825-6-mohamed@unpredictable.fr/

thanks
-- PMM
Re: [PATCH] hw/display/apple: Fix obsolete PGDevice function
Posted by Yundi Xu 1 month, 2 weeks ago
Thanks, I hadn't spotted that series. Please disregard this patch.

Yundi Xu

> On Oct 6, 2026, at 4:06 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> On Mon, 5 Oct 2026 at 22:52, Yundi Xu <yundi.eric.xu@gmail.com> wrote:
>> 
>> PGNewDeviceWithDescriptor is obsolete. Replace with
>> PGCreateDeviceWIthDescriptor.
>> 
>> Signed-off-by: Yundi Xu<yundi.eric.xu@gmail.com>
>> ---
>>  hw/display/apple-gfx.m | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
> 
> There's a somewhat more comprehensive set of changes to this
> device that include something like this one already on the list:
> 
> https://patchew.org/QEMU/20260916100021.73825-1-mohamed@unpredictable.fr/20260916100021.73825-6-mohamed@unpredictable.fr/
> 
> thanks
> -- PMM