xref: /haiku/src/add-ons/accelerants/intel_810/i810_init.cpp (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright 2012 Haiku, Inc.  All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Gerald Zajac
7  */
8 
9 /*!
10 	Haiku Intel-810 video driver was adapted from the X.org intel driver which
11 	has the following copyright.
12 
13 	Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
14 	All Rights Reserved.
15  */
16 
17 
18 #include "accelerant.h"
19 #include "i810_regs.h"
20 
21 
22 bool
23 I810_GetColorSpaceParams(int colorSpace, uint8& bitsPerPixel,
24 	uint32& maxPixelClock)
25 {
26 	// Get parameters for a color space which is supported by the i810 chips.
27 	// Argument maxPixelClock is in KHz.
28 	// Return true if the color space is supported;  else return false.
29 
30 	switch (colorSpace) {
31 		case B_RGB16:
32 			bitsPerPixel = 16;
33 			maxPixelClock = 163000;
34 			break;
35 			break;
36 		case B_CMAP8:
37 			bitsPerPixel = 8;
38 			maxPixelClock = 203000;
39 			break;
40 		default:
41 			TRACE("Unsupported color space: 0x%X\n", colorSpace);
42 			return false;
43 	}
44 
45 	return true;
46 }
47 
48 
49 status_t
50 I810_Init(void)
51 {
52 	TRACE("I810_Init()\n");
53 
54 	SharedInfo& si = *gInfo.sharedInfo;
55 
56 	// Use all of video memory for the frame buffer.
57 
58 	si.maxFrameBufferSize = si.videoMemSize;
59 
60 	// Set up the array of the supported color spaces.
61 
62 	si.colorSpaces[0] = B_CMAP8;
63 	si.colorSpaces[1] = B_RGB16;
64 	si.colorSpaceCount = 2;
65 
66 	// Setup the mode list.
67 
68 	return CreateModeList(IsModeUsable);
69 }
70