Update contrib.
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\video\t_vidmode.cpp
15 // Tests the video driver kernel extension
21 #include <videodriver.h>
23 GLDEF_C TInt E32Main()
26 User::CommandLine(cmd);
32 HAL::Get(HAL::EDisplayNumberOfScreens, screens);
33 for(TInt i=0;i<screens;i++)
36 HAL::Get(i, HAL::EDisplayNumModes, nmodes);
37 if (mode<0 || mode>=nmodes)
40 HAL::Set(i, HAL::EDisplayMode, mode);
42 TInt xres, yres, bpp, addr;
44 HAL::Get(i, HAL::EDisplayXPixels, xres);
45 HAL::Get(i, HAL::EDisplayYPixels, yres);
46 HAL::Get(i, HAL::EDisplayBitsPerPixel, bpp);
47 HAL::Get(i, HAL::EDisplayMemoryAddress, addr);
50 HAL::Get(i, HAL::EDisplayOffsetBetweenLines, bpl);
53 HAL::Get(i, HAL::EDisplayOffsetToFirstPixel, ofp);
55 RDebug::Print(_L("xres=%d yres=%d bpp=%d"), xres, yres, bpp);
56 RDebug::Print(_L("addr=%08x bpl=%d ofp=%d"), addr, bpl, ofp);
59 for (yb=0; yb<yres/16; ++yb)
61 for (xb=0; xb<xres/16; ++xb)
63 // TUint c=(5*(xb+yb))&0xff;
64 TUint c=(xb*xb+yb*yb)&0xff;
68 TUint c16=(b<<14)|(g<<8)|(r<<2);
72 TUint c32=(b<<22)|(g<<13)|(r<<5);
73 TInt baddr=addr+ofp+yb*16*bpl+xb*16*bpp/8;
75 for (l=0; l<16; ++l, baddr+=bpl)
77 TUint32* p=(TUint32*)baddr;
79 *p++=c8, *p++=c8, *p++=c8, *p++=c8;
81 *p++=c16, *p++=c16, *p++=c16, *p++=c16,
82 *p++=c16, *p++=c16, *p++=c16, *p++=c16;
83 // c16+=((l&3==3))?0x20:0x00;
85 *p++=c32+0x0, *p++=c32+0x1, *p++=c32+0x2, *p++=c32+0x3,
86 *p++=c32+0x4, *p++=c32+0x5, *p++=c32+0x6, *p++=c32+0x7,
87 *p++=c32+0x8, *p++=c32+0x9, *p++=c32+0xa, *p++=c32+0xb,
88 *p++=c32+0xc, *p++=c32+0xd, *p++=c32+0xe, *p++=c32+0xf,