diff mbox series

[4/4] macfb: allow reads from the DAFB_LUT register

Message ID 20231026085650.917663-5-mark.cave-ayland@ilande.co.uk
State New
Headers show
Series macfb: A/UX fixes for colour LUT | expand

Commit Message

Mark Cave-Ayland Oct. 26, 2023, 8:56 a.m. UTC
This enables A/UX to correctly retrieve the LUT entries when used with
applications that use the MacOS Device Manager Status (GetEntries) call.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/display/macfb.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Vivier Nov. 5, 2023, 2:42 p.m. UTC | #1
Le 26/10/2023 à 10:56, Mark Cave-Ayland a écrit :
> This enables A/UX to correctly retrieve the LUT entries when used with
> applications that use the MacOS Device Manager Status (GetEntries) call.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/display/macfb.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/hw/display/macfb.c b/hw/display/macfb.c
> index 4a1c75d572..d61541ccb5 100644
> --- a/hw/display/macfb.c
> +++ b/hw/display/macfb.c
> @@ -537,6 +537,11 @@ static uint64_t macfb_ctrl_read(void *opaque,
>       case DAFB_MODE_SENSE:
>           val = macfb_sense_read(s);
>           break;
> +    case DAFB_LUT ... DAFB_LUT + 3:
> +        val = s->color_palette[s->palette_current];
> +        s->palette_current = (s->palette_current + 1) %
> +                             ARRAY_SIZE(s->color_palette);
> +        break;
>       default:
>           if (addr < MACFB_CTRL_TOPADDR) {
>               val = s->regs[addr >> 2];

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 4a1c75d572..d61541ccb5 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -537,6 +537,11 @@  static uint64_t macfb_ctrl_read(void *opaque,
     case DAFB_MODE_SENSE:
         val = macfb_sense_read(s);
         break;
+    case DAFB_LUT ... DAFB_LUT + 3:
+        val = s->color_palette[s->palette_current];
+        s->palette_current = (s->palette_current + 1) %
+                             ARRAY_SIZE(s->color_palette);
+        break;
     default:
         if (addr < MACFB_CTRL_TOPADDR) {
             val = s->regs[addr >> 2];