ReactOS 0.4.16-dev-297-gc569aee
screen.c File Reference
#include "driver.h"
Include dependency graph for screen.c:

Go to the source code of this file.

Macros

#define SYSTM_LOGFONT   {16,7,0,0,700,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,VARIABLE_PITCH | FF_DONTCARE,L"System"}
 
#define HELVE_LOGFONT   {12,9,0,0,400,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_STROKE_PRECIS,PROOF_QUALITY,VARIABLE_PITCH | FF_DONTCARE,L"MS Sans Serif"}
 
#define COURI_LOGFONT   {12,9,0,0,400,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_STROKE_PRECIS,PROOF_QUALITY,FIXED_PITCH | FF_DONTCARE, L"Courier"}
 

Functions

BOOL bInitSURF (PPDEV ppdev, BOOL bFirst)
 
VOID vDisableSURF (PPDEV ppdev)
 
BOOL bInitPDEV (PPDEV ppdev, DEVMODEW *pDevMode, GDIINFO *pGdiInfo, DEVINFO *pDevInfo)
 
DWORD getAvailableModes (HANDLE hDriver, PVIDEO_MODE_INFORMATION *modeInformation, DWORD *cbModeSize)
 

Variables

const DEVINFO gDevInfoFrameBuffer
 
GDIINFO gaulCap
 

Macro Definition Documentation

◆ COURI_LOGFONT

#define COURI_LOGFONT   {12,9,0,0,400,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_STROKE_PRECIS,PROOF_QUALITY,FIXED_PITCH | FF_DONTCARE, L"Courier"}

Definition at line 13 of file screen.c.

◆ HELVE_LOGFONT

#define HELVE_LOGFONT   {12,9,0,0,400,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_STROKE_PRECIS,PROOF_QUALITY,VARIABLE_PITCH | FF_DONTCARE,L"MS Sans Serif"}

Definition at line 12 of file screen.c.

◆ SYSTM_LOGFONT

Definition at line 11 of file screen.c.

Function Documentation

◆ bInitPDEV()

BOOL bInitPDEV ( PPDEV  ppdev,
DEVMODEW pDevMode,
GDIINFO pGdiInfo,
DEVINFO pDevInfo 
)

Definition at line 326 of file screen.c.

331{
332 ULONG cModes;
333 PVIDEO_MODE_INFORMATION pVideoBuffer, pVideoModeSelected, pVideoTemp;
334#if 0
335 VIDEO_COLOR_CAPABILITIES colorCapabilities;
336 ULONG ulTemp;
337#endif
338 BOOL bSelectDefault;
339 ULONG cbModeSize;
340
341 //
342 // calls the miniport to get mode information.
343 //
344
345 cModes = getAvailableModes(ppdev->hDriver, &pVideoBuffer, &cbModeSize);
346
347 if (cModes == 0)
348 {
349 return(FALSE);
350 }
351
352 //
353 // Now see if the requested mode has a match in that table.
354 //
355
356 pVideoModeSelected = NULL;
357 pVideoTemp = pVideoBuffer;
358
359 if ((pDevMode->dmPelsWidth == 0) &&
360 (pDevMode->dmPelsHeight == 0) &&
361 (pDevMode->dmBitsPerPel == 0) &&
362 (pDevMode->dmDisplayFrequency == 0))
363 {
364 DISPDBG((2, "Default mode requested"));
365 bSelectDefault = TRUE;
366 }
367 else
368 {
369// eVb: 2.5 [DDK Change] - Add missing newlines to debug output
370 DISPDBG((2, "Requested mode...\n"));
371 DISPDBG((2, " Screen width -- %li\n", pDevMode->dmPelsWidth));
372 DISPDBG((2, " Screen height -- %li\n", pDevMode->dmPelsHeight));
373 DISPDBG((2, " Bits per pel -- %li\n", pDevMode->dmBitsPerPel));
374 DISPDBG((2, " Frequency -- %li\n", pDevMode->dmDisplayFrequency));
375// eVb: 2.5 [END]
376 bSelectDefault = FALSE;
377 }
378
379 while (cModes--)
380 {
381 if (pVideoTemp->Length != 0)
382 {
383 if (bSelectDefault ||
384 ((pVideoTemp->VisScreenWidth == pDevMode->dmPelsWidth) &&
385 (pVideoTemp->VisScreenHeight == pDevMode->dmPelsHeight) &&
386 (pVideoTemp->BitsPerPlane *
387 pVideoTemp->NumberOfPlanes == pDevMode->dmBitsPerPel) &&
388 (pVideoTemp->Frequency == pDevMode->dmDisplayFrequency)))
389 {
390 pVideoModeSelected = pVideoTemp;
391 DISPDBG((3, "Found a match\n")) ;
392 break;
393 }
394 }
395
396 pVideoTemp = (PVIDEO_MODE_INFORMATION)
397 (((PUCHAR)pVideoTemp) + cbModeSize);
398 }
399
400 //
401 // If no mode has been found, return an error
402 //
403
404 if (pVideoModeSelected == NULL)
405 {
406 EngFreeMem(pVideoBuffer);
407 DISPDBG((0,"DISP bInitPDEV failed - no valid modes\n"));
408 return(FALSE);
409 }
410
411 //
412 // Fill in the GDIINFO data structure with the information returned from
413 // the kernel driver.
414 //
415
416 ppdev->ulMode = pVideoModeSelected->ModeIndex;
417 ppdev->cxScreen = pVideoModeSelected->VisScreenWidth;
418 ppdev->cyScreen = pVideoModeSelected->VisScreenHeight;
419 ppdev->lDeltaScreen = pVideoModeSelected->ScreenStride;
420// eVb: 2.8 [VGARISC CHANGE] - Extra fields not required on VGA, start with defaults
421#if 0
422 ppdev->ulBitCount = pVideoModeSelected->BitsPerPlane *
423 pVideoModeSelected->NumberOfPlanes;
424 ppdev->flRed = pVideoModeSelected->RedMask;
425 ppdev->flGreen = pVideoModeSelected->GreenMask;
426 ppdev->flBlue = pVideoModeSelected->BlueMask;
427#else
428 *pGdiInfo = gaulCap;
429#endif
430// eVb: 2.8 [END]
431
432
433 pGdiInfo->ulVersion = GDI_DRIVER_VERSION;
434 pGdiInfo->ulTechnology = DT_RASDISPLAY;
435 pGdiInfo->ulHorzSize = pVideoModeSelected->XMillimeter;
436 pGdiInfo->ulVertSize = pVideoModeSelected->YMillimeter;
437
438 pGdiInfo->ulHorzRes = ppdev->cxScreen;
439 pGdiInfo->ulVertRes = ppdev->cyScreen;
440 pGdiInfo->ulPanningHorzRes = ppdev->cxScreen;
441 pGdiInfo->ulPanningVertRes = ppdev->cyScreen;
442 pGdiInfo->cBitsPixel = pVideoModeSelected->BitsPerPlane;
443 pGdiInfo->cPlanes = pVideoModeSelected->NumberOfPlanes;
444 pGdiInfo->ulVRefresh = pVideoModeSelected->Frequency;
445 pGdiInfo->ulBltAlignment = 1; // We don't have accelerated screen-
446 // to-screen blts, and any
447 // window alignment is okay
448
449 pGdiInfo->ulLogPixelsX = pDevMode->dmLogPixels;
450 pGdiInfo->ulLogPixelsY = pDevMode->dmLogPixels;
451
452// eVb: 2.9 [VGARISC CHANGE] - Extra fields not required on VGA
453#if 0
454#ifdef MIPS
455 if (ppdev->ulBitCount == 8)
456 pGdiInfo->flTextCaps = (TC_RA_ABLE | TC_SCROLLBLT);
457 else
458#endif
459 pGdiInfo->flTextCaps = TC_RA_ABLE;
460
461 pGdiInfo->flRaster = 0; // flRaster is reserved by DDI
462#endif
463// eVb: 2.9 [END]
464
465 pGdiInfo->ulDACRed = pVideoModeSelected->NumberRedBits;
466 pGdiInfo->ulDACGreen = pVideoModeSelected->NumberGreenBits;
467 pGdiInfo->ulDACBlue = pVideoModeSelected->NumberBlueBits;
468
469// eVb: 2.7 [VGARISC CHANGE] - Extra fields not required on VGA
470#if 0
471 pGdiInfo->ulAspectX = 0x24; // One-to-one aspect ratio
472 pGdiInfo->ulAspectY = 0x24;
473 pGdiInfo->ulAspectXY = 0x33;
474
475 pGdiInfo->xStyleStep = 1; // A style unit is 3 pels
476 pGdiInfo->yStyleStep = 1;
477 pGdiInfo->denStyleStep = 3;
478
479 pGdiInfo->ptlPhysOffset.x = 0;
480 pGdiInfo->ptlPhysOffset.y = 0;
481 pGdiInfo->szlPhysSize.cx = 0;
482 pGdiInfo->szlPhysSize.cy = 0;
483
484 // RGB and CMY color info.
485
486 //
487 // try to get it from the miniport.
488 // if the miniport doesn ot support this feature, use defaults.
489 //
490
491 if (EngDeviceIoControl(ppdev->hDriver,
493 NULL,
494 0,
495 &colorCapabilities,
497 &ulTemp))
498 {
499
500 DISPDBG((2, "getcolorCapabilities failed \n"));
501
502 pGdiInfo->ciDevice.Red.x = 6700;
503 pGdiInfo->ciDevice.Red.y = 3300;
504 pGdiInfo->ciDevice.Red.Y = 0;
505 pGdiInfo->ciDevice.Green.x = 2100;
506 pGdiInfo->ciDevice.Green.y = 7100;
507 pGdiInfo->ciDevice.Green.Y = 0;
508 pGdiInfo->ciDevice.Blue.x = 1400;
509 pGdiInfo->ciDevice.Blue.y = 800;
510 pGdiInfo->ciDevice.Blue.Y = 0;
511 pGdiInfo->ciDevice.AlignmentWhite.x = 3127;
512 pGdiInfo->ciDevice.AlignmentWhite.y = 3290;
513 pGdiInfo->ciDevice.AlignmentWhite.Y = 0;
514
515 pGdiInfo->ciDevice.RedGamma = 20000;
516 pGdiInfo->ciDevice.GreenGamma = 20000;
517 pGdiInfo->ciDevice.BlueGamma = 20000;
518
519 }
520 else
521 {
522 pGdiInfo->ciDevice.Red.x = colorCapabilities.RedChromaticity_x;
523 pGdiInfo->ciDevice.Red.y = colorCapabilities.RedChromaticity_y;
524 pGdiInfo->ciDevice.Red.Y = 0;
525 pGdiInfo->ciDevice.Green.x = colorCapabilities.GreenChromaticity_x;
526 pGdiInfo->ciDevice.Green.y = colorCapabilities.GreenChromaticity_y;
527 pGdiInfo->ciDevice.Green.Y = 0;
528 pGdiInfo->ciDevice.Blue.x = colorCapabilities.BlueChromaticity_x;
529 pGdiInfo->ciDevice.Blue.y = colorCapabilities.BlueChromaticity_y;
530 pGdiInfo->ciDevice.Blue.Y = 0;
531 pGdiInfo->ciDevice.AlignmentWhite.x = colorCapabilities.WhiteChromaticity_x;
532 pGdiInfo->ciDevice.AlignmentWhite.y = colorCapabilities.WhiteChromaticity_y;
533 pGdiInfo->ciDevice.AlignmentWhite.Y = colorCapabilities.WhiteChromaticity_Y;
534
535 // if we have a color device store the three color gamma values,
536 // otherwise store the unique gamma value in all three.
537
538 if (colorCapabilities.AttributeFlags & VIDEO_DEVICE_COLOR)
539 {
540 pGdiInfo->ciDevice.RedGamma = colorCapabilities.RedGamma;
541 pGdiInfo->ciDevice.GreenGamma = colorCapabilities.GreenGamma;
542 pGdiInfo->ciDevice.BlueGamma = colorCapabilities.BlueGamma;
543 }
544 else
545 {
546 pGdiInfo->ciDevice.RedGamma = colorCapabilities.WhiteGamma;
547 pGdiInfo->ciDevice.GreenGamma = colorCapabilities.WhiteGamma;
548 pGdiInfo->ciDevice.BlueGamma = colorCapabilities.WhiteGamma;
549 }
550
551 };
552
553 pGdiInfo->ciDevice.Cyan.x = 0;
554 pGdiInfo->ciDevice.Cyan.y = 0;
555 pGdiInfo->ciDevice.Cyan.Y = 0;
556 pGdiInfo->ciDevice.Magenta.x = 0;
557 pGdiInfo->ciDevice.Magenta.y = 0;
558 pGdiInfo->ciDevice.Magenta.Y = 0;
559 pGdiInfo->ciDevice.Yellow.x = 0;
560 pGdiInfo->ciDevice.Yellow.y = 0;
561 pGdiInfo->ciDevice.Yellow.Y = 0;
562
563 // No dye correction for raster displays.
564
565 pGdiInfo->ciDevice.MagentaInCyanDye = 0;
566 pGdiInfo->ciDevice.YellowInCyanDye = 0;
567 pGdiInfo->ciDevice.CyanInMagentaDye = 0;
568 pGdiInfo->ciDevice.YellowInMagentaDye = 0;
569 pGdiInfo->ciDevice.CyanInYellowDye = 0;
570 pGdiInfo->ciDevice.MagentaInYellowDye = 0;
571
572 pGdiInfo->ulDevicePelsDPI = 0; // For printers only
574
575 // BUGBUG this should be modified to take into account the size
576 // of the display and the resolution.
577
579
581// eVb: 2.7 [END]
582#endif
583
584 // Fill in the basic devinfo structure
585
586 *pDevInfo = gDevInfoFrameBuffer;
587
588// eVb: 2.6 [VGARISC CHANGE] - Use defaults in gaulCap for GDI Info
589#if 0
590 // Fill in the rest of the devinfo and GdiInfo structures.
591
592 if (ppdev->ulBitCount == 8)
593 {
594 // It is Palette Managed.
595
596 pGdiInfo->ulNumColors = 20;
597 pGdiInfo->ulNumPalReg = 1 << ppdev->ulBitCount;
598// eVb: 2.7 [DDK CHANGE] - No dithering support
599 pDevInfo->flGraphicsCaps |= GCAPS_PALMANAGED;
600// eVb: 2.7 [END]
602 pDevInfo->iDitherFormat = BMF_8BPP;
603
604 // Assuming palette is orthogonal - all colors are same size.
605
606 ppdev->cPaletteShift = 8 - pGdiInfo->ulDACRed;
607 }
608 else
609 {
610 pGdiInfo->ulNumColors = (ULONG) (-1);
611 pGdiInfo->ulNumPalReg = 0;
612
613 if (ppdev->ulBitCount == 16)
614 {
616 pDevInfo->iDitherFormat = BMF_16BPP;
617 }
618 else if (ppdev->ulBitCount == 24)
619 {
621 pDevInfo->iDitherFormat = BMF_24BPP;
622 }
623 else
624 {
626 pDevInfo->iDitherFormat = BMF_32BPP;
627 }
628 }
629#endif
630// eVb: 2.6 [END]
631
632 EngFreeMem(pVideoBuffer);
633
634 return(TRUE);
635}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _VIDEO_MODE_INFORMATION * PVIDEO_MODE_INFORMATION
#define VIDEO_DEVICE_COLOR
Definition: ntddvdeo.h:473
#define IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES
Definition: ntddvdeo.h:179
#define EngFreeMem
Definition: polytest.cpp:56
LDECI4 x
Definition: winddi.h:240
LDECI4 Y
Definition: winddi.h:242
LDECI4 y
Definition: winddi.h:241
CIECHROMA Cyan
Definition: winddi.h:288
LDECI4 GreenGamma
Definition: winddi.h:293
LDECI4 MagentaInCyanDye
Definition: winddi.h:295
CIECHROMA Magenta
Definition: winddi.h:289
LDECI4 YellowInCyanDye
Definition: winddi.h:296
LDECI4 CyanInMagentaDye
Definition: winddi.h:297
LDECI4 CyanInYellowDye
Definition: winddi.h:299
LDECI4 YellowInMagentaDye
Definition: winddi.h:298
LDECI4 MagentaInYellowDye
Definition: winddi.h:300
CIECHROMA Red
Definition: winddi.h:285
CIECHROMA Green
Definition: winddi.h:286
CIECHROMA Blue
Definition: winddi.h:287
CIECHROMA Yellow
Definition: winddi.h:290
LDECI4 BlueGamma
Definition: winddi.h:294
LDECI4 RedGamma
Definition: winddi.h:292
CIECHROMA AlignmentWhite
Definition: winddi.h:291
FLONG flGraphicsCaps
Definition: winddi.h:390
ULONG iDitherFormat
Definition: winddi.h:395
ULONG ulVertSize
Definition: winddi.h:881
ULONG ulLogPixelsY
Definition: winddi.h:889
ULONG ulDACGreen
Definition: winddi.h:892
ULONG ulPanningHorzRes
Definition: winddi.h:911
ULONG ulPanningVertRes
Definition: winddi.h:912
ULONG ulHTPatternSize
Definition: winddi.h:906
ULONG ulLogPixelsX
Definition: winddi.h:888
ULONG ulAspectY
Definition: winddi.h:895
ULONG ulTechnology
Definition: winddi.h:879
ULONG ulNumColors
Definition: winddi.h:886
ULONG ulAspectX
Definition: winddi.h:894
ULONG ulPrimaryOrder
Definition: winddi.h:905
ULONG cBitsPixel
Definition: winddi.h:884
ULONG ulDevicePelsDPI
Definition: winddi.h:904
ULONG ulVertRes
Definition: winddi.h:883
POINTL ptlPhysOffset
Definition: winddi.h:900
ULONG ulBltAlignment
Definition: winddi.h:910
ULONG ulHTOutputFormat
Definition: winddi.h:907
SIZEL szlPhysSize
Definition: winddi.h:901
ULONG ulHorzSize
Definition: winddi.h:880
COLORINFO ciDevice
Definition: winddi.h:903
ULONG ulHorzRes
Definition: winddi.h:882
LONG xStyleStep
Definition: winddi.h:897
ULONG flRaster
Definition: winddi.h:887
ULONG ulDACBlue
Definition: winddi.h:893
ULONG ulVersion
Definition: winddi.h:878
ULONG ulAspectXY
Definition: winddi.h:896
LONG denStyleStep
Definition: winddi.h:899
ULONG ulNumPalReg
Definition: winddi.h:902
ULONG flHTFlags
Definition: winddi.h:908
ULONG flTextCaps
Definition: winddi.h:890
ULONG cPlanes
Definition: winddi.h:885
ULONG ulDACRed
Definition: winddi.h:891
LONG yStyleStep
Definition: winddi.h:898
ULONG ulVRefresh
Definition: winddi.h:909
ULONG cPaletteShift
Definition: driver.h:37
FLONG flRed
Definition: driver.h:34
ULONG ulBitCount
Definition: driver.h:40
FLONG flGreen
Definition: driver.h:35
HANDLE hDriver
Definition: framebuf.h:35
LONG lDeltaScreen
Definition: driver.h:30
FLONG flBlue
Definition: driver.h:36
ULONG ulMode
Definition: driver.h:29
ULONG cyScreen
Definition: driver.h:28
ULONG cxScreen
Definition: driver.h:27
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
DWORD dmBitsPerPel
Definition: wingdi.h:1647
DWORD dmPelsWidth
Definition: wingdi.h:1648
DWORD dmPelsHeight
Definition: wingdi.h:1649
DWORD dmDisplayFrequency
Definition: wingdi.h:1654
WORD dmLogPixels
Definition: wingdi.h:1646
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define DISPDBG(arg)
Definition: debug.h:23
const DEVINFO gDevInfoFrameBuffer
Definition: screen.c:18
DWORD getAvailableModes(HANDLE hDriver, PVIDEO_MODE_INFORMATION *modeInformation, DWORD *cbModeSize)
Definition: screen.c:651
GDIINFO gaulCap
Definition: screen.c:46
#define BMF_16BPP
Definition: winddi.h:358
#define BMF_8BPP
Definition: winddi.h:357
#define HT_FORMAT_8BPP
Definition: winddi.h:819
#define HT_FORMAT_16BPP
Definition: winddi.h:820
#define HT_PATSIZE_4x4_M
Definition: winddi.h:792
#define HT_FLAG_ADDITIVE_PRIMS
Definition: winddi.h:827
#define HT_FORMAT_24BPP
Definition: winddi.h:821
#define BMF_24BPP
Definition: winddi.h:359
#define BMF_32BPP
Definition: winddi.h:360
#define GDI_DRIVER_VERSION
Definition: winddi.h:109
#define HT_FORMAT_32BPP
Definition: winddi.h:822
#define PRIMARY_ORDER_CBA
Definition: winddi.h:785
#define GCAPS_PALMANAGED
Definition: winddi.h:341
#define TC_RA_ABLE
Definition: wingdi.h:820
#define DT_RASDISPLAY
Definition: wingdi.h:708
#define TC_SCROLLBLT
Definition: wingdi.h:823

◆ bInitSURF()

BOOL bInitSURF ( PPDEV  ppdev,
BOOL  bFirst 
)

Definition at line 168 of file screen.c.

169{
170 DWORD returnedDataLength;
171 DWORD MaxWidth, MaxHeight;
172 VIDEO_MEMORY videoMemory;
173 VIDEO_MEMORY_INFORMATION videoMemoryInformation;
174// eVb: 2.1 [DDK Change] - Support new VGA Miniport behavior w.r.t updated framebuffer remapping
175 ULONG RemappingNeeded = 0;
176// eVb: 2.1 [END]
177 //
178 // Set the current mode into the hardware.
179 //
180
181 if (EngDeviceIoControl(ppdev->hDriver,
183 &(ppdev->ulMode),
184 sizeof(ULONG),
185// eVb: 2.2 [DDK Change] - Support new VGA Miniport behavior w.r.t updated framebuffer remapping
186 &RemappingNeeded,
187 sizeof(ULONG),
188// eVb: 2.2 [END]
189 &returnedDataLength))
190 {
191 RIP("DISP bInitSURF failed IOCTL_SET_MODE\n");
192 return(FALSE);
193 }
194
195 //
196 // If this is the first time we enable the surface we need to map in the
197 // memory also.
198 //
199// eVb: 2.3 [DDK Change] - Support new VGA Miniport behavior w.r.t updated framebuffer remapping
200 if (bFirst || RemappingNeeded)
201 {
202// eVb: 2.3 [END]
203 videoMemory.RequestedVirtualAddress = NULL;
204
205 if (EngDeviceIoControl(ppdev->hDriver,
207 &videoMemory,
208 sizeof(VIDEO_MEMORY),
209 &videoMemoryInformation,
211 &returnedDataLength))
212 {
213 RIP("DISP bInitSURF failed IOCTL_VIDEO_MAP\n");
214 return(FALSE);
215 }
216
217 ppdev->pjScreen = (PBYTE)(videoMemoryInformation.FrameBufferBase);
218
219 if (videoMemoryInformation.FrameBufferBase !=
220 videoMemoryInformation.VideoRamBase)
221 {
222 RIP("VideoRamBase does not correspond to FrameBufferBase\n");
223 }
224// eVb: 2.4 [DDK Change] - Make sure frame buffer mapping worked
225 //
226 // Make sure we can access this video memory
227 //
228
229 *(PULONG)(ppdev->pjScreen) = 0xaa55aa55;
230
231 if (*(PULONG)(ppdev->pjScreen) != 0xaa55aa55) {
232
233 DISPDBG((1, "Frame buffer memory is not accessible.\n"));
234 return(FALSE);
235 }
236// eVb: 2.4 [END]
237 ppdev->cScreenSize = videoMemoryInformation.VideoRamLength;
238
239 //
240 // Initialize the head of the offscreen list to NULL.
241 //
242
243 ppdev->pOffscreenList = NULL;
244
245 // It's a hardware pointer; set up pointer attributes.
246
248
249 // Allocate space for two DIBs (data/mask) for the pointer. If this
250 // device supports a color Pointer, we will allocate a larger bitmap.
251 // If this is a color bitmap we allocate for the largest possible
252 // bitmap because we have no idea of what the pixel depth might be.
253
254 // Width rounded up to nearest byte multiple
255
257 {
258 MaxWidth = (ppdev->PointerCapabilities.MaxWidth + 7) / 8;
259 }
260 else
261 {
262 MaxWidth = ppdev->PointerCapabilities.MaxWidth * sizeof(DWORD);
263 }
264
265 ppdev->cjPointerAttributes =
267 ((sizeof(UCHAR) * MaxWidth * MaxHeight) * 2);
268
271
272 if (ppdev->pPointerAttributes == NULL) {
273
274 DISPDBG((0, "bInitPointer EngAllocMem failed\n"));
275 return(FALSE);
276 }
277
279 ppdev->pPointerAttributes->WidthInBytes = MaxWidth;
282 ppdev->pPointerAttributes->Column = 0;
283 ppdev->pPointerAttributes->Row = 0;
284 ppdev->pPointerAttributes->Enable = 0;
285 }
286
287 return(TRUE);
288}
#define ALLOC_TAG
Definition: btrfs_drv.h:87
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DWORD
Definition: nt_native.h:44
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:173
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:221
struct _VIDEO_POINTER_ATTRIBUTES VIDEO_POINTER_ATTRIBUTES
struct _VIDEO_POINTER_ATTRIBUTES * PVIDEO_POINTER_ATTRIBUTES
#define VIDEO_MODE_COLOR_POINTER
Definition: ntddvdeo.h:525
BYTE * PBYTE
Definition: pedump.c:66
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
VIDEO_POINTER_CAPABILITIES PointerCapabilities
Definition: vgaddi.h:129
DWORD cjPointerAttributes
Definition: driver.h:44
PBYTE pjScreen
Definition: driver.h:26
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes
Definition: vgaddi.h:117
ULONG cScreenSize
Definition: driver.h:31
PVOID pOffscreenList
Definition: driver.h:33
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:344
uint32_t * PULONG
Definition: typedefs.h:59
#define RIP(x)
Definition: debug.h:24
#define MaxHeight
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DrvAssertMode(), and DrvEnableSurface().

◆ getAvailableModes()

DWORD getAvailableModes ( HANDLE  hDriver,
PVIDEO_MODE_INFORMATION modeInformation,
DWORD cbModeSize 
)

Definition at line 651 of file screen.c.

655{
656 ULONG ulTemp;
657 VIDEO_NUM_MODES modes;
658 PVIDEO_MODE_INFORMATION pVideoTemp;
659
660 //
661 // Get the number of modes supported by the mini-port
662 //
663
664 if (EngDeviceIoControl(hDriver,
666 NULL,
667 0,
668 &modes,
669 sizeof(VIDEO_NUM_MODES),
670 &ulTemp))
671 {
672 DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_NUM_AVAIL_MODES\n"));
673 return 0;
674 }
675
676 *cbModeSize = modes.ModeInformationLength;
677
678 //
679 // Allocate the buffer for the mini-port to write the modes in.
680 //
681
682 *modeInformation = (PVIDEO_MODE_INFORMATION)
683 EngAllocMem(0, modes.NumModes *
685
686 if (*modeInformation == NULL)
687 {
688 DISPDBG((0, "getAvailableModes failed EngAllocMem\n"));
689
690 return 0;
691 }
692
693 //
694 // Ask the mini-port to fill in the available modes.
695 //
696
697 if (EngDeviceIoControl(hDriver,
699 NULL,
700 0,
701 *modeInformation,
702 modes.NumModes * modes.ModeInformationLength,
703 &ulTemp))
704 {
705
706 DISPDBG((0, "getAvailableModes failed VIDEO_QUERY_AVAIL_MODES\n"));
707
708 EngFreeMem(*modeInformation);
709 *modeInformation = NULL;
710
711 return 0;
712 }
713
714 //
715 // Now see which of these modes are supported by the display driver.
716 // As an internal mechanism, set the length to 0 for the modes we
717 // DO NOT support.
718 //
719
720 ulTemp = modes.NumModes;
721 pVideoTemp = *modeInformation;
722
723// eVb: 2.5 [VGARISC CHANGE] - Add correct mode checks for VGA
724 //
725 // Mode is rejected if it is not 4 planes, or not graphics, or is not
726 // one of 1 bits per pel.
727 //
728
729 while (ulTemp--)
730 {
731 if ((pVideoTemp->NumberOfPlanes != 4 ) ||
732 !(pVideoTemp->AttributeFlags & VIDEO_MODE_GRAPHICS) ||
733 ((pVideoTemp->BitsPerPlane != 1) ||
734 (pVideoTemp->VisScreenWidth > 800)))
735// eVb: 2.5 [END]
736 {
737 pVideoTemp->Length = 0;
738 }
739
740 pVideoTemp = (PVIDEO_MODE_INFORMATION)
741 (((PUCHAR)pVideoTemp) + modes.ModeInformationLength);
742 }
743
744 return modes.NumModes;
745
746}
#define VIDEO_MODE_GRAPHICS
Definition: ntddvdeo.h:364
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:176
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:191
ULONG ModeInformationLength
Definition: ntddvdeo.h:398
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3557

◆ vDisableSURF()

VOID vDisableSURF ( PPDEV  ppdev)

Definition at line 297 of file screen.c.

298{
299 DWORD returnedDataLength;
300 VIDEO_MEMORY videoMemory;
301
302 videoMemory.RequestedVirtualAddress = (PVOID) ppdev->pjScreen;
303
304 if (EngDeviceIoControl(ppdev->hDriver,
306 &videoMemory,
307 sizeof(VIDEO_MEMORY),
308 NULL,
309 0,
310 &returnedDataLength))
311 {
312 RIP("DISP vDisableSURF failed IOCTL_VIDEO_UNMAP\n");
313 }
314}
if(dx< 0)
Definition: linetemp.h:194
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:248
void * PVOID
Definition: typedefs.h:50

Referenced by DrvDisableSurface().

Variable Documentation

◆ gaulCap

GDIINFO gaulCap

Definition at line 46 of file screen.c.

Referenced by bInitPDEV().

◆ gDevInfoFrameBuffer

const DEVINFO gDevInfoFrameBuffer
Initial value:
= {
( 0
),
0,
0,
0,
0
}
#define COURI_LOGFONT
Definition: screen.c:13
#define HELVE_LOGFONT
Definition: screen.c:12
#define SYSTM_LOGFONT
Definition: screen.c:11
#define BMF_4BPP
Definition: winddi.h:356

Definition at line 18 of file screen.c.

Referenced by bInitPDEV().