Re: Mirror Display Driver - how to change mode dynamically



On Jul 23, 9:05 pm, "Ivan Brugiolo [MSFT]"
<ivanb...@xxxxxxxxxxxxxxxxxxxx> wrote:
During a mode-change, you may have two PDEVs around for your driver.
Can you trace the un-map sequence for your surface ?
It looks like you have un-mapped one too soon (or you have not mapped
the new one yet)

--

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified athttp://www.microsoft.com/info/cpyright.htm

<Attributes...@xxxxxxxxx> wrote in message

news:1185238151.772862.73170@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Jul 23, 6:18 pm, "Ivan Brugiolo [MSFT]"
<ivanb...@xxxxxxxxxxxxxxxxxxxx> wrote:
Show us the bugcheck code, in the form of `!analyze -f -v;r;kb` in the
kernel debugger,
and, possibly we can be more helpful.

--

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of any included script samples are subject to the terms specified
athttp://www.microsoft.com/info/cpyright.htm

<Attributes...@xxxxxxxxx> wrote in message

news:1185218978.967330.300800@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi.
I'm doing Mirror Display Driver and I got problem - how to change
dynamically driver resolution settings and from them reallocate
memory which I'm using to save changes?
If I do this code (Delphi) to change drivers resolution

var
devmode: TDeviceMode;
change: Boolean;
dispDevice: TDisplayDevice2A;
devNum: Integer;
result: Boolean;
deviceName: String;
begin
FillMemory(@devmode,sizeof(TDeviceMode),0);
devmode.dmSize:= sizeof(TDisplayDevice2A);
devmode.dmDriverExtra:= 0;
change:= EnumDisplaySettings(nil,MAXDWORD,devmode);
devmode.dmFields:= DM_DISPLAYFLAGS or
DM_PELSWIDTH or
DM_PELSHEIGHT;
if change then
begin
dispDevice.cb:= sizeof(TDisplayDevice2A);
deviceName:= #0;
devmode.dmDeviceName[0]:= #0;
devNum:= 0;
result:= true;
while result do
begin
FillMemory(@dispDevice,sizeof(TDisplayDevice2A),0);
dispDevice.cb:= sizeof(TDisplayDevice2A);
result:= EnumDisplayDevicesD(nil,
devNum,
dispDevice,
0);
if dispDevice.DeviceString = driverName then break;
Inc(devNum);
end;
end;
deviceName:= dispDevice.DeviceName;

devmode.dmPelsWidth := 1152;
devmode.dmPelsHeight := 864;
ChangeDisplaySettingsEx(@deviceName[1], devmode, 0,
CDS_UPDATEREGISTRY, nil );
ChangeDisplaySettingsEx(@deviceName[1], PDeviceMode(nil)^, 0,
CDS_RESET, nil );
end;

I got blue screen when I'm trying to change different resolution from
current.
What's wrong in my code?

kd> !analyze -f -v;r;kb
*******************************************************************************
*
*
* Bugcheck
Analysis *
*
*
*******************************************************************************

PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced. This cannot be protected by try-
except,
it must be protected by a Probe. Typically the address is just plain
bad or it
is pointing at freed memory.
Arguments:
Arg1: bcd577f9, memory referenced.
Arg2: 00000001, value 0 = read operation, 1 = write operation.
Arg3: 804da1f0, If non-zero, the instruction address which referenced
the bad memory
address.
Arg4: 00000000, (reserved)

Debugging Details:
------------------

Could not read faulting driver name

WRITE_ADDRESS: bcd577f9

FAULTING_IP:
nt!memmove+74
804da1f0 8807 mov byte ptr [edi],al

MM_INTERNAL_CODE: 0

CUSTOMER_CRASH_COUNT: 1

DEFAULT_BUCKET_ID: INTEL_CPU_MICROCODE_ZERO

BUGCHECK_STR: 0x50

PROCESS_NAME: Project1.exe

LAST_CONTROL_TRANSFER: from bf854d7d to 804da1f0

STACK_TEXT:
f8a54820 bf854d7d bcd577f9 e1af0084 00000045 nt!memmove+0x74
f8a54844 bf831feb 0000001a 00000000 00000000 win32k!
vSrcCopyS24D24Identity+0x56
f8a54a58 bf9e8d72 e19a1620 00000000 00000000 win32k!EngCopyBits+0x51a
f8a54a78 bf904222 e19a1620 e1af0018 00000000 mirror_bf9e8000!
DrvCopyBits+0x32 [c:\winddk\3790\src\video\displays\mirror\disp
\enable.c @ 515]
f8a54ac0 bf84d6a3 bf9e8d40 bf9a2fb4 e19a1620 win32k!OffCopyBits+0x7d
f8a54b78 bf84c24d e1942318 f8a54bac e1af0018 win32k!vSpWriteToScreen
+0x99
f8a54bbc bf937bc7 e1af0018 e19422d8 00000000 win32k!vSpRedrawSprite
+0xeb
f8a54be4 bf937d75 e19a1620 0000013f 000000b3 win32k!EngMovePointer
+0x146
f8a54c18 bf840554 e19a1620 00000000 e14de010 win32k!EngSetPointerShape
+0x172
f8a54cb0 bf84001d e19422d8 e18cb9f8 00000000 win32k!vSetPointer+0x3e3
f8a54ce0 bf8fea68 8118cc18 e14d0cc8 00000010 win32k!GreSetPointer+0x60
f8a54d04 bf8bbef2 00000001 f8a54d64 0012f398 win32k!SetPointer+0xa8
f8a54d20 bf8bbd13 0012f3a8 0014c888 00000000 win32k!
xxxUserChangeDisplaySettings+0x1e2
f8a54d48 804df06b 0012f3a8 0014c888 00000000 win32k!
NtUserChangeDisplaySettings+0x4a
f8a54d48 7c90eb94 0012f3a8 0014c888 00000000 nt!KiFastCallEntry+0xf8
WARNING: Frame IP not in any known module. Following frames may be
wrong.
0012f3b0 00000000 00000000 00000000 00000000 0x7c90eb94

STACK_COMMAND: kb

FOLLOWUP_IP:
mirror_bf9e8000!DrvCopyBits+32 [c:\winddk\3790\src\video\displays
\mirror\disp\enable.c @ 515]
bf9e8d72 ?? ???

FAULTING_SOURCE_CODE:
511: {
512: AddRectangle(prclDst);
513: AddClip(pco);
514: return EngCopyBits(psoDst, psoSrc, pco, pxlo, prclDst,
pptlSrc);
515: }
516:
517: /
******************************Public*Routine******************************
\
518: * DrvBitBlt
519: *
520:
\**************************************************************************/

SYMBOL_STACK_INDEX: 3

SYMBOL_NAME: mirror_bf9e8000!DrvCopyBits+32

FOLLOWUP_NAME: MachineOwner

MODULE_NAME: mirror_bf9e8000

IMAGE_NAME: mirror.dll

DEBUG_FLR_IMAGE_TIMESTAMP: 46a52559

FAILURE_BUCKET_ID: 0x50_W_mirror_bf9e8000!DrvCopyBits+32

BUCKET_ID: 0x50_W_mirror_bf9e8000!DrvCopyBits+32

Followup: MachineOwner
---------

eax=000000d8 ebx=bcd577f9 ecx=00000042 edx=00000002 esi=e1af0084
edi=bcd577f9
eip=804da1f0 esp=f8a54818 ebp=f8a54820 iopl=0 nv up ei pl nz
na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000
efl=00010202
nt!memmove+0x74:
804da1f0 8807 mov byte ptr [edi],al ds:
0023:bcd577f9=??
ChildEBP RetAddr Args to Child
f8a54820 bf854d7d bcd577f9 e1af0084 00000045 nt!memmove+0x74
f8a54844 bf831feb 0000001a 00000000 00000000 win32k!
vSrcCopyS24D24Identity+0x56
f8a54a58 bf9e8d72 e19a1620 00000000 00000000 win32k!EngCopyBits+0x51a
f8a54a78 bf904222 e19a1620 e1af0018 00000000 mirror_bf9e8000!
DrvCopyBits+0x32 [c:\winddk\3790\src\video\displays\mirror\disp
\enable.c @ 515]
f8a54ac0 bf84d6a3 bf9e8d40 bf9a2fb4 e19a1620 win32k!OffCopyBits+0x7d
f8a54b78 bf84c24d e1942318 f8a54bac e1af0018 win32k!vSpWriteToScreen
+0x99
f8a54bbc bf937bc7 e1af0018 e19422d8 00000000 win32k!vSpRedrawSprite
+0xeb
f8a54be4 bf937d75 e19a1620 0000013f 000000b3 win32k!EngMovePointer
+0x146
f8a54c18 bf840554 e19a1620 00000000 e14de010 win32k!EngSetPointerShape
+0x172
f8a54cb0 bf84001d e19422d8 e18cb9f8 00000000 win32k!vSetPointer+0x3e3
f8a54ce0 bf8fea68 8118cc18 e14d0cc8 00000010 win32k!GreSetPointer+0x60
f8a54d04 bf8bbef2 00000001 f8a54d64 0012f398 win32k!SetPointer+0xa8
f8a54d20 bf8bbd13 0012f3a8 0014c888 00000000 win32k!
xxxUserChangeDisplaySettings+0x1e2
f8a54d48 804df06b 0012f3a8 0014c888 00000000 win32k!
NtUserChangeDisplaySettings+0x4a
f8a54d48 7c90eb94 0012f3a8 0014c888 00000000 nt!KiFastCallEntry+0xf8
WARNING: Frame IP not in any known module. Following frames may be
wrong.
0012f3b0 00000000 00000000 00000000 00000000 0x7c90eb94

Ivan, I think this problem from that when I change screen resolution
the mirror driver wants to write to its surface in this case was this
code
EngCopyBits(psoDst, psoSrc, pco, pxlo, prclDst, pptlSrc);
and I assume that this function writes over the given scope of memory.
I assume that somewhere I need to add code which will be reallocating
memory given for surface and for changes, but I can't find where it's.

.



Relevant Pages


Loading