From b2a75cf56cafe2cf4b9258311e1d331bd48ab081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 14 Aug 2009 14:30:01 +0000 Subject: [PATCH] * Fixed mixup of the VGA compatibility layer - if the bit is set, it means the device is not compatible, after all. * No longer accept color changes if the mode is not an 8 bit one. I think that BWindowScreen does that after changing the mode, so that is messes up the colors, at least that's the theory, will test on real iron now. * Use VGA as a fallback if setting the palette via VBE failed. This brings back the colors for ParticlesII in Qemu (but not in VirtualBox, which seems to be completely broken in this regard). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32359 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/graphics/vesa/vesa.h | 4 ++-- .../kernel/drivers/graphics/vesa/device.cpp | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/headers/private/graphics/vesa/vesa.h b/headers/private/graphics/vesa/vesa.h index 044e295ce6..898d0d52e0 100644 --- a/headers/private/graphics/vesa/vesa.h +++ b/headers/private/graphics/vesa/vesa.h @@ -38,8 +38,8 @@ struct vbe_info_block { } _PACKED; // capabilities -#define CAPABILITY_DAC_WIDTH 0x01 -#define CAPABILITY_VGA_COMPATIBLE 0x02 +#define CAPABILITY_DAC_WIDTH 0x01 +#define CAPABILITY_NOT_VGA_COMPATIBLE 0x02 /* VBE mode info structure */ diff --git a/src/add-ons/kernel/drivers/graphics/vesa/device.cpp b/src/add-ons/kernel/drivers/graphics/vesa/device.cpp index 39494bfe96..51217790b6 100644 --- a/src/add-ons/kernel/drivers/graphics/vesa/device.cpp +++ b/src/add-ons/kernel/drivers/graphics/vesa/device.cpp @@ -160,26 +160,36 @@ device_ioctl(void* cookie, uint32 msg, void* buffer, size_t bufferLength) case VESA_SET_INDEXED_COLORS: { + color_space space + = (color_space)info->shared_info->current_mode.space; + if (space != B_GRAY8 && space != B_CMAP8) + return B_ERROR; + vesa_set_indexed_colors_args args; if (user_memcpy(&args, buffer, sizeof(args)) != B_OK) return B_BAD_ADDRESS; - if (info->shared_info->current_mode.space == B_GRAY8) { - if ((info->vbe_capabilities & CAPABILITY_VGA_COMPATIBLE) == 0) - return B_NOT_SUPPORTED; + status_t status = B_NOT_SUPPORTED; + if (space != B_GRAY8) { + status = vesa_set_indexed_colors(*info, args.first, args.colors, + args.count); + } + // Try VGA as a fallback + if (status != B_OK && (info->vbe_capabilities + & CAPABILITY_NOT_VGA_COMPATIBLE) == 0) { return vga_set_indexed_colors(args.first, args.colors, args.count); } - return vesa_set_indexed_colors(*info, args.first, args.colors, - args.count); + return status; } case VGA_PLANAR_BLIT: { if (info->shared_info->current_mode.space != B_GRAY8 - && (info->vbe_capabilities & CAPABILITY_VGA_COMPATIBLE) == 0) + || (info->vbe_capabilities + & CAPABILITY_NOT_VGA_COMPATIBLE) != 0) return B_NOT_SUPPORTED; vga_planar_blit_args args;