- Don't use buffered I/O, to prevent some lag
- mouclass: Change the critical section place, to follow changes done in
kbdclass in r19322
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
_____
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
--- trunk/reactos/drivers/input/kbdclass/kbdclass.c 2005-11-18
16:42:41 UTC (rev 19324)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c 2005-11-18
17:28:19 UTC (rev 19325)
@@ -329,7 +329,7 @@
DeviceExtension->ReadIsPending = FALSE;
DeviceExtension->InputCount = 0;
DeviceExtension->PortData = ExAllocatePool(NonPagedPool,
DeviceExtension->DriverExtension->DataQueueSize *
sizeof(KEYBOARD_INPUT_DATA));
- Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
+ Fdo->Flags |= DO_POWER_PAGABLE;
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
/* Add entry entry to
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\[DeviceBaseName] */
@@ -384,10 +384,8 @@
/* A read request is waiting for input, so go straight
to it */
/* FIXME: use SEH */
- DPRINT("Immediate Completion: %x\n",
DataStart->MakeCode);
-
RtlCopyMemory(
- Irp->MdlAddress ?
MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) :
Irp->AssociatedIrp.SystemBuffer,
+ Irp->MdlAddress ?
MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) :
Irp->UserBuffer,
DataStart,
sizeof(KEYBOARD_INPUT_DATA));
@@ -523,7 +521,6 @@
RtlZeroMemory(DeviceExtension, sizeof(CLASS_DEVICE_EXTENSION));
DeviceExtension->Common.IsClassDO = FALSE;
DeviceExtension->PnpState = dsStopped;
- Fdo->Flags |= DO_POWER_PAGABLE;
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo,
&DeviceExtension->LowerDevice);
if (!NT_SUCCESS(Status))
{
@@ -531,7 +528,10 @@
IoDeleteDevice(Fdo);
return Status;
}
- Fdo->Flags |= DO_BUFFERED_IO;
+ if (DeviceExtension->LowerDevice->Flags & DO_POWER_PAGABLE)
+ Fdo->Flags |= DO_POWER_PAGABLE;
+ if (DeviceExtension->LowerDevice->Flags & DO_BUFFERED_IO)
+ Fdo->Flags |= DO_BUFFERED_IO;
if (DriverExtension->ConnectMultiplePorts)
Status = ConnectPortDriver(Fdo,
DriverExtension->MainClassDeviceObject);
@@ -578,17 +578,16 @@
KeAcquireSpinLock(&DeviceExtension->SpinLock, &oldIrql);
- DPRINT("Mdl: %x, UserBuffer: %x, InputCount: %d, Data:
%x\n",
- Irp->MdlAddress,
- Irp->UserBuffer,
- DeviceExtension->InputCount,
-
(DeviceExtension->PortData-DeviceExtension->InputCount)->MakeCode);
+ DPRINT("Mdl: %p, UserBuffer: %p, InputCount: %lu\n",
+ Irp->MdlAddress,
+ Irp->UserBuffer,
+ DeviceExtension->InputCount);
/* FIXME: use SEH */
RtlCopyMemory(
- Irp->AssociatedIrp.SystemBuffer,
- DeviceExtension->PortData -
DeviceExtension->InputCount,
- sizeof(KEYBOARD_INPUT_DATA));
+ Irp->MdlAddress ?
MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) :
Irp->UserBuffer,
+ DeviceExtension->PortData -
DeviceExtension->InputCount,
+ sizeof(KEYBOARD_INPUT_DATA));
if (DeviceExtension->InputCount > 1)
{
_____
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
--- trunk/reactos/drivers/input/mouclass/mouclass.c 2005-11-18
16:42:41 UTC (rev 19324)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c 2005-11-18
17:28:19 UTC (rev 19325)
@@ -359,6 +359,8 @@
ASSERT(ClassDeviceExtension->Common.IsClassDO);
+ KeAcquireSpinLock(&ClassDeviceExtension->SpinLock, &OldIrql);
+
DPRINT("ClassCallback()\n");
/* A filter driver might have consumed all the data already; I'm
* not sure if they are supposed to move the packets when they
@@ -393,8 +395,6 @@
/* If we have data from the port driver and a higher service to
send the data to */
if (InputCount != 0)
{
- KeAcquireSpinLock(&ClassDeviceExtension->SpinLock,
&OldIrql);
-
if (ClassDeviceExtension->InputCount + InputCount >
ClassDeviceExtension->DriverExtension->DataQueueSize)
ReadSize =
ClassDeviceExtension->DriverExtension->DataQueueSize -
ClassDeviceExtension->InputCount;
else
@@ -418,7 +418,6 @@
ClassDeviceExtension->PortData += ReadSize;
ClassDeviceExtension->InputCount += ReadSize;
- KeReleaseSpinLock(&ClassDeviceExtension->SpinLock,
OldIrql);
(*ConsumedCount) += ReadSize;
}
else
@@ -426,6 +425,8 @@
DPRINT("ClassCallBack() entered, InputCount = %lu -
DOING NOTHING\n", InputCount);
}
+ KeReleaseSpinLock(&ClassDeviceExtension->SpinLock, OldIrql);
+
if (Irp != NULL)
{
IoStartNextPacket(ClassDeviceObject, FALSE);
@@ -510,7 +511,6 @@
RtlZeroMemory(DeviceExtension, sizeof(CLASS_DEVICE_EXTENSION));
DeviceExtension->Common.IsClassDO = FALSE;
DeviceExtension->PnpState = dsStopped;
- Fdo->Flags |= DO_POWER_PAGABLE;
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo,
&DeviceExtension->LowerDevice);
if (!NT_SUCCESS(Status))
{
@@ -518,7 +518,10 @@
IoDeleteDevice(Fdo);
return Status;
}
- Fdo->Flags |= DO_BUFFERED_IO;
+ if (DeviceExtension->LowerDevice->Flags & DO_POWER_PAGABLE)
+ Fdo->Flags |= DO_POWER_PAGABLE;
+ if (DeviceExtension->LowerDevice->Flags & DO_BUFFERED_IO)
+ Fdo->Flags |= DO_BUFFERED_IO;
if (DriverExtension->ConnectMultiplePorts)
Status = ConnectPortDriver(Fdo,
DriverExtension->MainClassDeviceObject);
@@ -565,6 +568,11 @@
KeAcquireSpinLock(&DeviceExtension->SpinLock, &oldIrql);
+ DPRINT("Mdl: %p, UserBuffer: %p, InputCount: %lu\n",
+ Irp->MdlAddress,
+ Irp->UserBuffer,
+ DeviceExtension->InputCount);
+
/* FIXME: use SEH */
RtlCopyMemory(
Irp->MdlAddress ?
MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) :
Irp->UserBuffer,