1/* 2 * Copyright 1999, Be Incorporated. 3 * Copyright 2007, Haiku. 4 * Distributed under the terms of the MIT License. 5 * 6 * Authors: 7 * Be Incorporated 8 * Eric Petit <eric.petit@lapsus.org> 9 */ 10 11#include <string.h> 12#include "GlobalData.h" 13 14 15status_t 16SET_DISPLAY_MODE(display_mode * modeToSet) 17{ 18 display_mode bounds, target; 19 int bpp; 20 21 TRACE("SET_DISPLAY_MODE\n"); 22 23 /* Ask for the specific mode */ 24 target = bounds = *modeToSet; 25 if (PROPOSE_DISPLAY_MODE(&target, &bounds, &bounds) == B_ERROR) 26 return B_ERROR; 27 28 bpp = BppForSpace(target.space); 29 30 TRACE("setting %dx%dx%d\n", target.virtual_width, 31 target.virtual_height, bpp); 32 33 gSi->dm = target; 34 35 /* Disable SVGA while we switch */ 36 ioctl(gFd, VMWARE_FIFO_STOP, NULL, 0); 37 38 /* Re-init fifo */ 39 FifoInit(); 40 41 /* Set resolution. This also updates the frame buffer config in the 42 * shared area */ 43 ioctl(gFd, VMWARE_SET_MODE, &target, sizeof(target)); 44 45 /* Blank the screen to avoid ugly glitches until the app_server redraws */ 46 memset(gSi->fb, 0, target.virtual_height * gSi->bytesPerRow); 47 FifoUpdateFullscreen(); 48 49 /* Re-enable SVGA */ 50 ioctl(gFd, VMWARE_FIFO_START, NULL, 0); 51 52 return B_OK; 53} 54 55 56status_t 57MOVE_DISPLAY(uint16 hDisplayStart, uint16 vDisplayStart) 58{ 59 TRACE("MOVE_DISPLAY (%d, %d)\n", hDisplayStart, vDisplayStart); 60 return B_ERROR; 61} 62 63 64void 65SET_INDEXED_COLORS(uint count, uint8 first, uint8 *color_data, uint32 flags) 66{ 67 // TODO: Take first and count into account. 68 // Currently we always pass 256 colors (random, most of the times) to the driver. Cool! 69 uint8 colors[256]; 70 uint32 i; 71 TRACE("SET_INDEXED_COLORS\n"); 72 73 for (i = 0; i < count; i++) { 74 colors[i + first] = color_data[i]; 75 } 76 77 ioctl(gFd, VMWARE_SET_PALETTE, colors, sizeof(count)); 78} 79 80 81/*--------------------------------------------------------------------*/ 82/* DPMS_CAPABILITIES: reports DPMS capabilities (on, stand by, 83 * suspend, off) */ 84uint32 85DPMS_CAPABILITIES() 86{ 87 /* We stay always on */ 88 return B_DPMS_ON; 89} 90 91 92/*--------------------------------------------------------------------*/ 93/* DPMS_MODE: reports the current DPMS mode */ 94uint32 95DPMS_MODE() 96{ 97 return B_DPMS_ON; 98} 99 100 101/*--------------------------------------------------------------------*/ 102/* SET_DPMS_MODE: puts the display into one of the DPMS modes */ 103status_t 104SET_DPMS_MODE(uint32 flags) 105{ 106 return B_ERROR; 107} 108 109