ReactOS  0.4.15-dev-3294-ge98684e
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,
496  sizeof(VIDEO_COLOR_CAPABILITIES),
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
573  pGdiInfo->ulPrimaryOrder = PRIMARY_ORDER_CBA;
574 
575  // BUGBUG this should be modified to take into account the size
576  // of the display and the resolution.
577 
578  pGdiInfo->ulHTPatternSize = HT_PATSIZE_4x4_M;
579 
580  pGdiInfo->flHTFlags = HT_FLAG_ADDITIVE_PRIMS;
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]
601  pGdiInfo->ulHTOutputFormat = HT_FORMAT_8BPP;
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  {
615  pGdiInfo->ulHTOutputFormat = HT_FORMAT_16BPP;
616  pDevInfo->iDitherFormat = BMF_16BPP;
617  }
618  else if (ppdev->ulBitCount == 24)
619  {
620  pGdiInfo->ulHTOutputFormat = HT_FORMAT_24BPP;
621  pDevInfo->iDitherFormat = BMF_24BPP;
622  }
623  else
624  {
625  pGdiInfo->ulHTOutputFormat = HT_FORMAT_32BPP;
626  pDevInfo->iDitherFormat = BMF_32BPP;
627  }
628  }
629 #endif
630 // eVb: 2.6 [END]
631 
632  EngFreeMem(pVideoBuffer);
633 
634  return(TRUE);
635 }
ULONG ulDevicePelsDPI
Definition: winddi.h:904
SIZEL szlPhysSize
Definition: winddi.h:901
#define IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES
Definition: ntddvdeo.h:110
#define BMF_24BPP
Definition: winddi.h:359
#define VIDEO_DEVICE_COLOR
Definition: ntddvdeo.h:404
LDECI4 MagentaInCyanDye
Definition: winddi.h:295
LDECI4 y
Definition: winddi.h:241
LDECI4 CyanInYellowDye
Definition: winddi.h:299
#define BMF_32BPP
Definition: winddi.h:360
ULONG ulDACRed
Definition: winddi.h:891
CIECHROMA Yellow
Definition: winddi.h:290
CIECHROMA Green
Definition: winddi.h:286
#define HT_FORMAT_16BPP
Definition: winddi.h:820
ULONG ulHTOutputFormat
Definition: winddi.h:907
ULONG ulMode
Definition: driver.h:31
ULONG ulPrimaryOrder
Definition: winddi.h:905
#define TRUE
Definition: types.h:120
#define EngFreeMem
Definition: polytest.cpp:56
unsigned char * PUCHAR
Definition: retypes.h:3
CIECHROMA Blue
Definition: winddi.h:287
LDECI4 YellowInCyanDye
Definition: winddi.h:296
ULONG ulAspectY
Definition: winddi.h:895
LONG denStyleStep
Definition: winddi.h:899
ULONG ulLogPixelsY
Definition: winddi.h:889
LDECI4 MagentaInYellowDye
Definition: winddi.h:300
ULONG ulPanningHorzRes
Definition: winddi.h:911
ULONG cPlanes
Definition: winddi.h:885
DWORD dmBitsPerPel
Definition: wingdi.h:1647
ULONG flTextCaps
Definition: winddi.h:890
CIECHROMA Cyan
Definition: winddi.h:288
#define DT_RASDISPLAY
Definition: wingdi.h:708
GDIINFO gaulCap
Definition: screen.c:46
LONG y
Definition: windef.h:330
ULONG flHTFlags
Definition: winddi.h:908
LDECI4 GreenGamma
Definition: winddi.h:293
ULONG ulNumPalReg
Definition: winddi.h:902
FLONG flGreen
Definition: driver.h:37
ULONG ulVertSize
Definition: winddi.h:881
LDECI4 BlueGamma
Definition: winddi.h:294
ULONG cyScreen
Definition: driver.h:30
struct _VIDEO_MODE_INFORMATION * PVIDEO_MODE_INFORMATION
#define GDI_DRIVER_VERSION
Definition: winddi.h:109
ULONG ulDACGreen
Definition: winddi.h:892
POINTL ptlPhysOffset
Definition: winddi.h:900
#define FALSE
Definition: types.h:117
ULONG ulVersion
Definition: winddi.h:878
WORD dmLogPixels
Definition: wingdi.h:1646
unsigned int BOOL
Definition: ntddk_ex.h:94
CIECHROMA AlignmentWhite
Definition: winddi.h:291
HANDLE hDriver
Definition: framebuf.h:35
#define TC_SCROLLBLT
Definition: wingdi.h:823
CIECHROMA Magenta
Definition: winddi.h:289
ULONG ulHorzRes
Definition: winddi.h:882
LONG cx
Definition: windef.h:334
ULONG ulTechnology
Definition: winddi.h:879
LONG yStyleStep
Definition: winddi.h:898
const DEVINFO gDevInfoFrameBuffer
Definition: screen.c:19
ULONG iDitherFormat
Definition: winddi.h:395
ULONG ulAspectXY
Definition: winddi.h:896
#define BMF_16BPP
Definition: winddi.h:358
LDECI4 YellowInMagentaDye
Definition: winddi.h:298
FLONG flRed
Definition: driver.h:36
Definition: xlate.c:10
ULONG ulBitCount
Definition: driver.h:42
ULONG ulBltAlignment
Definition: winddi.h:910
ULONG ulDACBlue
Definition: winddi.h:893
#define TC_RA_ABLE
Definition: wingdi.h:820
LDECI4 x
Definition: winddi.h:240
LONG x
Definition: windef.h:329
LDECI4 Y
Definition: winddi.h:242
ULONG ulHTPatternSize
Definition: winddi.h:906
#define HT_FLAG_ADDITIVE_PRIMS
Definition: winddi.h:827
ULONG ulHorzSize
Definition: winddi.h:880
DWORD dmPelsWidth
Definition: wingdi.h:1648
#define DISPDBG(arg)
Definition: debug.h:23
#define PRIMARY_ORDER_CBA
Definition: winddi.h:785
ULONG flRaster
Definition: winddi.h:887
ULONG ulVRefresh
Definition: winddi.h:909
LDECI4 CyanInMagentaDye
Definition: winddi.h:297
ULONG cBitsPixel
Definition: winddi.h:884
ULONG ulAspectX
Definition: winddi.h:894
ULONG cPaletteShift
Definition: driver.h:39
DWORD dmDisplayFrequency
Definition: wingdi.h:1654
FLONG flGraphicsCaps
Definition: winddi.h:390
LDECI4 RedGamma
Definition: winddi.h:292
#define NULL
Definition: types.h:112
ULONG ulPanningVertRes
Definition: winddi.h:912
ULONG ulNumColors
Definition: winddi.h:886
DWORD dmPelsHeight
Definition: wingdi.h:1649
#define HT_PATSIZE_4x4_M
Definition: winddi.h:792
#define HT_FORMAT_24BPP
Definition: winddi.h:821
COLORINFO ciDevice
Definition: winddi.h:903
unsigned int ULONG
Definition: retypes.h:1
CIECHROMA Red
Definition: winddi.h:285
LONG lDeltaScreen
Definition: driver.h:32
ULONG ulLogPixelsX
Definition: winddi.h:888
ULONG ulVertRes
Definition: winddi.h:883
#define HT_FORMAT_32BPP
Definition: winddi.h:822
#define GCAPS_PALMANAGED
Definition: winddi.h:341
DWORD NTAPI getAvailableModes(HANDLE hDriver, PVIDEO_MODE_INFORMATION *modeInformation, DWORD *cbModeSize)
Definition: screen.c:507
#define HT_FORMAT_8BPP
Definition: winddi.h:819
FLONG flBlue
Definition: driver.h:38
LONG cy
Definition: windef.h:335
ULONG cxScreen
Definition: driver.h:29
LONG xStyleStep
Definition: winddi.h:897

◆ 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,
210  sizeof(VIDEO_MEMORY_INFORMATION),
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 
247  MaxHeight = ppdev->PointerCapabilities.MaxHeight;
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 =
266  sizeof(VIDEO_POINTER_ATTRIBUTES) +
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;
281  ppdev->pPointerAttributes->Height = MaxHeight;
282  ppdev->pPointerAttributes->Column = 0;
283  ppdev->pPointerAttributes->Row = 0;
284  ppdev->pPointerAttributes->Enable = 0;
285  }
286 
287  return(TRUE);
288 }
VIDEO_POINTER_CAPABILITIES PointerCapabilities
Definition: driver.h:44
struct _VIDEO_POINTER_ATTRIBUTES VIDEO_POINTER_ATTRIBUTES
#define VIDEO_MODE_COLOR_POINTER
Definition: ntddvdeo.h:456
ULONG ulMode
Definition: driver.h:31
#define TRUE
Definition: types.h:120
Definition: amd64_sup.c:14
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:104
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:275
#define DWORD
Definition: nt_native.h:44
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:152
#define ALLOC_TAG
Definition: btrfs_drv.h:91
#define FALSE
Definition: types.h:117
HANDLE hDriver
Definition: framebuf.h:35
DWORD cjPointerAttributes
Definition: driver.h:46
ULONG cScreenSize
Definition: driver.h:33
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DISPDBG(arg)
Definition: debug.h:23
struct _VIDEO_POINTER_ATTRIBUTES * PVIDEO_POINTER_ATTRIBUTES
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
unsigned char UCHAR
Definition: xmlstorage.h:181
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes
Definition: driver.h:45
PBYTE pjScreen
Definition: driver.h:28
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66
PVOID pOffscreenList
Definition: driver.h:35

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 == (PVIDEO_MODE_INFORMATION) 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 = (PVIDEO_MODE_INFORMATION) 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 }
ULONG ModeInformationLength
Definition: ntddvdeo.h:329
#define EngFreeMem
Definition: polytest.cpp:56
unsigned char * PUCHAR
Definition: retypes.h:3
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO _In_ HDEV _In_ LPWSTR _In_ HANDLE hDriver
Definition: winddi.h:3553
#define ALLOC_TAG
Definition: btrfs_drv.h:91
struct _VIDEO_MODE_INFORMATION * PVIDEO_MODE_INFORMATION
#define DISPDBG(arg)
Definition: debug.h:23
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:122
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:107
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define VIDEO_MODE_GRAPHICS
Definition: ntddvdeo.h:295

Referenced by DrvGetModes().

◆ 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 }
Definition: amd64_sup.c:14
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:275
if(dx==0 &&dy==0)
Definition: linetemp.h:174
HANDLE hDriver
Definition: framebuf.h:35
void * PVOID
Definition: retypes.h:9
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:179
unsigned long DWORD
Definition: ntddk_ex.h:95
PBYTE pjScreen
Definition: driver.h:28
#define NULL
Definition: types.h:112

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 SYSTM_LOGFONT
Definition: screen.c:11
#define COURI_LOGFONT
Definition: screen.c:13
Definition: xlate.c:9
#define HELVE_LOGFONT
Definition: screen.c:12

Definition at line 18 of file screen.c.