Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-20 Thread Zeng, Star

On 2016/3/16 19:53, Laszlo Ersek wrote:

On 03/16/16 09:22, Zeng, Star wrote:

Pushed at 30ed3422ab2de03abf7c1433ebb482f6e5e16f45.

Thanks,
Star


This patch breaks the Ia32 build of OVMF (found by Gerd's Jenkins auto-builder):

MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe/OUTPUT/ConSplitterDxe.lib(ConSplitter.obj):
 In function `ConSplitterAbsolutePointerGetState':
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4159: undefined 
reference to `__udivdi3'
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4162: undefined 
reference to `__udivdi3'
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4165: undefined 
reference to `__udivdi3'


First saw this email, then I was going to update the code.
When I was trying to send patch for this, I saw the email that has 
pushed the fix and I am glad to see it.



Thanks,
Star



Namely,


On 2016/3/15 10:11, Ni, Ruiyu wrote:



Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
Of Derek Lin
Sent: Wednesday, March 9, 2016 4:35 PM
To: edk2-devel@lists.01.org
Cc: Derek Lin <derek.l...@hpe.com>
Subject: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute
Pointer.

ConSplitter's Absolute Pointer should scale virtual device's
resolution like what Simple Pointer do.
Before this change, caller will get Virtual device's resolution but
physical device's current point.
This change let caller get Virtual device's resolution with virtual
device's current point.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.l...@hpe.com>
---
.../Universal/Console/ConSplitterDxe/ConSplitter.c | 43
++
1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index dae97b0..af90d5e 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -17,6 +17,7 @@
device situation.

Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials
are licensed and made available under the terms and conditions of the
BSD License
which accompanies this distribution.  The full text of the license
may be found at
@@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
EFI_STATUSReturnStatus;
UINTN Index;
EFI_ABSOLUTE_POINTER_STATECurrentState;
-
+  UINT64MinX;
+  UINT64MinY;
+  UINT64MinZ;
+  UINT64MaxX;
+  UINT64MaxY;
+  UINT64MaxZ;
+  UINT64VirtualMinX;
+  UINT64VirtualMinY;
+  UINT64VirtualMinZ;
+  UINT64VirtualMaxX;
+  UINT64VirtualMaxY;
+  UINT64VirtualMaxZ;

Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS
(This);

@@ -4107,6 +4119,13 @@ ConSplitterAbsolutePointerGetState (
State->CurrentZ= 0;
State->ActiveButtons   = 0;

+  VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;
+  VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;
+  VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;
+  VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;
+  VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;
+  VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;
+
//
// if no physical pointer device exists, return EFI_NOT_READY;
// if any physical pointer device has changed state,
@@ -4124,16 +4143,26 @@ ConSplitterAbsolutePointerGetState (
  ReturnStatus = EFI_SUCCESS;
}

+  MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;
+  MinY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinY;
+  MinZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinZ;
+  MaxX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxX;
+  MaxY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxY;
+  MaxZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxZ;
+
State->ActiveButtons = CurrentState.ActiveButtons;

-  if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 &&
Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
-State->CurrentX = CurrentState.CurrentX;
+  //
+  // Rescale to Con Splitter virtual Absolute Pointer's resolution.
+  //
+  if (!(MinX == 0 && MaxX == 0)) {
+State->CurrentX = VirtualMinX + (CurrentState.CurrentX *

Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-19 Thread Lin, Derek (HPS UEFI Dev)
The U64 mult/div fix seems good. Thanks for fixing it!

Thanks,
Derek

-Original Message-
From: Zeng, Star [mailto:star.z...@intel.com] 
Sent: Thursday, March 17, 2016 9:13 AM
To: Laszlo Ersek <ler...@redhat.com>
Cc: Ni, Ruiyu <ruiyu...@intel.com>; Tian, Feng <feng.t...@intel.com>; Lin, 
Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2-devel@lists.01.org 
<edk2-de...@ml01.01.org>
Subject: Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

On 2016/3/16 19:53, Laszlo Ersek wrote:
> On 03/16/16 09:22, Zeng, Star wrote:
>> Pushed at 30ed3422ab2de03abf7c1433ebb482f6e5e16f45.
>>
>> Thanks,
>> Star
>
> This patch breaks the Ia32 build of OVMF (found by Gerd's Jenkins 
> auto-builder):
>
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe/OUTPUT/ConSplitterDxe.lib(ConSplitter.obj):
>  In function `ConSplitterAbsolutePointerGetState':
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4159: undefined 
> reference to `__udivdi3'
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4162: undefined 
> reference to `__udivdi3'
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4165: undefined 
> reference to `__udivdi3'

First saw this email, then I was going to update the code.
When I was trying to send patch for this, I saw the email that has 
pushed the fix and I am glad to see it.


Thanks,
Star

>
> Namely,
>
>> On 2016/3/15 10:11, Ni, Ruiyu wrote:
>>>
>>>
>>> Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
>>>> -Original Message-
>>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
>>>> Of Derek Lin
>>>> Sent: Wednesday, March 9, 2016 4:35 PM
>>>> To: edk2-devel@lists.01.org
>>>> Cc: Derek Lin <derek.l...@hpe.com>
>>>> Subject: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute
>>>> Pointer.
>>>>
>>>> ConSplitter's Absolute Pointer should scale virtual device's
>>>> resolution like what Simple Pointer do.
>>>> Before this change, caller will get Virtual device's resolution but
>>>> physical device's current point.
>>>> This change let caller get Virtual device's resolution with virtual
>>>> device's current point.
>>>>
>>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>>> Signed-off-by: Derek Lin <derek.l...@hpe.com>
>>>> ---
>>>> .../Universal/Console/ConSplitterDxe/ConSplitter.c | 43
>>>> ++
>>>> 1 file changed, 36 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> index dae97b0..af90d5e 100644
>>>> --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> @@ -17,6 +17,7 @@
>>>> device situation.
>>>>
>>>> Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
>>>> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>>>> This program and the accompanying materials
>>>> are licensed and made available under the terms and conditions of the
>>>> BSD License
>>>> which accompanies this distribution.  The full text of the license
>>>> may be found at
>>>> @@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
>>>> EFI_STATUSReturnStatus;
>>>> UINTN Index;
>>>> EFI_ABSOLUTE_POINTER_STATECurrentState;
>>>> -
>>>> +  UINT64MinX;
>>>> +  UINT64MinY;
>>>> +  UINT64MinZ;
>>>> +  UINT64MaxX;
>>>> +  UINT64MaxY;
>>>> +  UINT64MaxZ;
>>>> +  UINT64VirtualMinX;
>>>> +  UINT64VirtualMinY;
>>>> +  UINT64VirtualMinZ;
>>>> +  UINT64VirtualMaxX;
>>>> +  UINT64VirtualMaxY;
>>>> +  UINT64VirtualMaxZ;
>>>>
>>>> Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS
>>>> (This);
>>>>
>>>> @@ -4107,6 +4119,13 @@ ConSplitterAbsolutePo

Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-18 Thread Laszlo Ersek
On 03/16/16 09:22, Zeng, Star wrote:
> Pushed at 30ed3422ab2de03abf7c1433ebb482f6e5e16f45.
> 
> Thanks,
> Star

This patch breaks the Ia32 build of OVMF (found by Gerd's Jenkins auto-builder):

MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe/OUTPUT/ConSplitterDxe.lib(ConSplitter.obj):
 In function `ConSplitterAbsolutePointerGetState':
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4159: undefined 
reference to `__udivdi3'
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4162: undefined 
reference to `__udivdi3'
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4165: undefined 
reference to `__udivdi3'

Namely,

> On 2016/3/15 10:11, Ni, Ruiyu wrote:
>>
>>
>> Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
>>> -Original Message-
>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
>>> Of Derek Lin
>>> Sent: Wednesday, March 9, 2016 4:35 PM
>>> To: edk2-devel@lists.01.org
>>> Cc: Derek Lin <derek.l...@hpe.com>
>>> Subject: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute
>>> Pointer.
>>>
>>> ConSplitter's Absolute Pointer should scale virtual device's
>>> resolution like what Simple Pointer do.
>>> Before this change, caller will get Virtual device's resolution but
>>> physical device's current point.
>>> This change let caller get Virtual device's resolution with virtual
>>> device's current point.
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Derek Lin <derek.l...@hpe.com>
>>> ---
>>> .../Universal/Console/ConSplitterDxe/ConSplitter.c | 43
>>> ++
>>> 1 file changed, 36 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>> b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>> index dae97b0..af90d5e 100644
>>> --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>> +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>> @@ -17,6 +17,7 @@
>>>device situation.
>>>
>>> Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
>>> +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>>> This program and the accompanying materials
>>> are licensed and made available under the terms and conditions of the
>>> BSD License
>>> which accompanies this distribution.  The full text of the license
>>> may be found at
>>> @@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
>>>EFI_STATUSReturnStatus;
>>>UINTN Index;
>>>EFI_ABSOLUTE_POINTER_STATECurrentState;
>>> -
>>> +  UINT64MinX;
>>> +  UINT64MinY;
>>> +  UINT64MinZ;
>>> +  UINT64MaxX;
>>> +  UINT64MaxY;
>>> +  UINT64MaxZ;
>>> +  UINT64VirtualMinX;
>>> +  UINT64VirtualMinY;
>>> +  UINT64VirtualMinZ;
>>> +  UINT64VirtualMaxX;
>>> +  UINT64VirtualMaxY;
>>> +  UINT64VirtualMaxZ;
>>>
>>>Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS
>>> (This);
>>>
>>> @@ -4107,6 +4119,13 @@ ConSplitterAbsolutePointerGetState (
>>>State->CurrentZ= 0;
>>>State->ActiveButtons   = 0;
>>>
>>> +  VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;
>>> +  VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;
>>> +  VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;
>>> +  VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;
>>> +  VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;
>>> +  VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;
>>> +
>>>//
>>>// if no physical pointer device exists, return EFI_NOT_READY;
>>>// if any physical pointer device has changed state,
>>> @@ -4124,16 +4143,26 @@ ConSplitterAbsolutePointerGetState (
>>>  ReturnStatus = EFI_SUCCESS;
>>>}
>>>
>>> +  MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;
>>> +  MinY = P

Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-16 Thread Zeng, Star

Pushed at 30ed3422ab2de03abf7c1433ebb482f6e5e16f45.

Thanks,
Star

On 2016/3/15 10:11, Ni, Ruiyu wrote:



Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Derek Lin
Sent: Wednesday, March 9, 2016 4:35 PM
To: edk2-devel@lists.01.org
Cc: Derek Lin <derek.l...@hpe.com>
Subject: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

ConSplitter's Absolute Pointer should scale virtual device's resolution like 
what Simple Pointer do.
Before this change, caller will get Virtual device's resolution but physical 
device's current point.
This change let caller get Virtual device's resolution with virtual device's 
current point.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.l...@hpe.com>
---
.../Universal/Console/ConSplitterDxe/ConSplitter.c | 43 ++
1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index dae97b0..af90d5e 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -17,6 +17,7 @@
   device situation.

Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD 
License
which accompanies this distribution.  The full text of the license may be found 
at
@@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
   EFI_STATUSReturnStatus;
   UINTN Index;
   EFI_ABSOLUTE_POINTER_STATECurrentState;
-
+  UINT64MinX;
+  UINT64MinY;
+  UINT64MinZ;
+  UINT64MaxX;
+  UINT64MaxY;
+  UINT64MaxZ;
+  UINT64VirtualMinX;
+  UINT64VirtualMinY;
+  UINT64VirtualMinZ;
+  UINT64VirtualMaxX;
+  UINT64VirtualMaxY;
+  UINT64VirtualMaxZ;

   Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);

@@ -4107,6 +4119,13 @@ ConSplitterAbsolutePointerGetState (
   State->CurrentZ= 0;
   State->ActiveButtons   = 0;

+  VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;
+  VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;
+  VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;
+  VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;
+  VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;
+  VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;
+
   //
   // if no physical pointer device exists, return EFI_NOT_READY;
   // if any physical pointer device has changed state,
@@ -4124,16 +4143,26 @@ ConSplitterAbsolutePointerGetState (
 ReturnStatus = EFI_SUCCESS;
   }

+  MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;
+  MinY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinY;
+  MinZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinZ;
+  MaxX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxX;
+  MaxY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxY;
+  MaxZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxZ;
+
   State->ActiveButtons = CurrentState.ActiveButtons;

-  if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && 
Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
-State->CurrentX = CurrentState.CurrentX;
+  //
+  // Rescale to Con Splitter virtual Absolute Pointer's resolution.
+  //
+  if (!(MinX == 0 && MaxX == 0)) {
+State->CurrentX = VirtualMinX + (CurrentState.CurrentX * (VirtualMaxX 
- VirtualMinX)) / (MaxX - MinX);
   }
-  if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && 
Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {
-State->CurrentY = CurrentState.CurrentY;
+  if (!(MinY == 0 && MaxY == 0)) {
+State->CurrentY = VirtualMinY + (CurrentState.CurrentY * (VirtualMaxY 
- VirtualMinY)) / (MaxY - MinY);
   }
-  if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && 
Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {
-State->CurrentZ = CurrentState.CurrentZ;
+  if (!(MinZ == 0 && MaxZ == 0)) {
+State->CurrentZ = VirtualMinZ + (CurrentState.CurrentZ * (VirtualMaxZ 
- VirtualMinZ)) / (MaxZ - MinZ);
   }

 } else if (Status == E

Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-14 Thread Ni, Ruiyu


Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Derek 
>Lin
>Sent: Wednesday, March 9, 2016 4:35 PM
>To: edk2-devel@lists.01.org
>Cc: Derek Lin <derek.l...@hpe.com>
>Subject: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.
>
>ConSplitter's Absolute Pointer should scale virtual device's resolution like 
>what Simple Pointer do.
>Before this change, caller will get Virtual device's resolution but physical 
>device's current point.
>This change let caller get Virtual device's resolution with virtual device's 
>current point.
>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Derek Lin <derek.l...@hpe.com>
>---
> .../Universal/Console/ConSplitterDxe/ConSplitter.c | 43 ++
> 1 file changed, 36 insertions(+), 7 deletions(-)
>
>diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>index dae97b0..af90d5e 100644
>--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>@@ -17,6 +17,7 @@
>   device situation.
>
> Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
>+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD 
> License
> which accompanies this distribution.  The full text of the license may be 
> found at
>@@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
>   EFI_STATUSReturnStatus;
>   UINTN Index;
>   EFI_ABSOLUTE_POINTER_STATECurrentState;
>-
>+  UINT64MinX;
>+  UINT64MinY;
>+  UINT64MinZ;
>+  UINT64MaxX;
>+  UINT64MaxY;
>+  UINT64MaxZ;
>+  UINT64VirtualMinX;
>+  UINT64VirtualMinY;
>+  UINT64VirtualMinZ;
>+  UINT64VirtualMaxX;
>+  UINT64VirtualMaxY;
>+  UINT64VirtualMaxZ;
>
>   Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);
>
>@@ -4107,6 +4119,13 @@ ConSplitterAbsolutePointerGetState (
>   State->CurrentZ= 0;
>   State->ActiveButtons   = 0;
>
>+  VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;
>+  VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;
>+  VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;
>+  VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;
>+  VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;
>+  VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;
>+
>   //
>   // if no physical pointer device exists, return EFI_NOT_READY;
>   // if any physical pointer device has changed state,
>@@ -4124,16 +4143,26 @@ ConSplitterAbsolutePointerGetState (
> ReturnStatus = EFI_SUCCESS;
>   }
>
>+  MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;
>+  MinY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinY;
>+  MinZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinZ;
>+  MaxX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxX;
>+  MaxY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxY;
>+  MaxZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxZ;
>+
>   State->ActiveButtons = CurrentState.ActiveButtons;
>
>-  if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && 
>Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
>-State->CurrentX = CurrentState.CurrentX;
>+  //
>+  // Rescale to Con Splitter virtual Absolute Pointer's resolution.
>+  //
>+  if (!(MinX == 0 && MaxX == 0)) {
>+State->CurrentX = VirtualMinX + (CurrentState.CurrentX * (VirtualMaxX 
>- VirtualMinX)) / (MaxX - MinX);
>   }
>-  if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && 
>Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {
>-State->CurrentY = CurrentState.CurrentY;
>+  if (!(MinY == 0 && MaxY == 0)) {
>+State->CurrentY = VirtualMinY + (CurrentState.CurrentY * (VirtualMaxY 
>- VirtualMinY)) / (MaxY - MinY);
>   }
>-  if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && 
>Private->Abso

[edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-09 Thread Derek Lin
ConSplitter's Absolute Pointer should scale virtual device's resolution like 
what Simple Pointer do.
Before this change, caller will get Virtual device's resolution but physical 
device's current point.
This change let caller get Virtual device's resolution with virtual device's 
current point.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin 
---
 .../Universal/Console/ConSplitterDxe/ConSplitter.c | 43 ++
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c 
b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index dae97b0..af90d5e 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -17,6 +17,7 @@
   device situation.
 
 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
   EFI_STATUSReturnStatus;
   UINTN Index;
   EFI_ABSOLUTE_POINTER_STATECurrentState;
-
+  UINT64MinX;
+  UINT64MinY;
+  UINT64MinZ;
+  UINT64MaxX;
+  UINT64MaxY;
+  UINT64MaxZ;
+  UINT64VirtualMinX;
+  UINT64VirtualMinY;
+  UINT64VirtualMinZ;
+  UINT64VirtualMaxX;
+  UINT64VirtualMaxY;
+  UINT64VirtualMaxZ;
 
   Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);
 
@@ -4107,6 +4119,13 @@ ConSplitterAbsolutePointerGetState (
   State->CurrentZ= 0;
   State->ActiveButtons   = 0;
 
+  VirtualMinX = Private->AbsolutePointerMode.AbsoluteMinX;
+  VirtualMinY = Private->AbsolutePointerMode.AbsoluteMinY;
+  VirtualMinZ = Private->AbsolutePointerMode.AbsoluteMinZ;
+  VirtualMaxX = Private->AbsolutePointerMode.AbsoluteMaxX;
+  VirtualMaxY = Private->AbsolutePointerMode.AbsoluteMaxY;
+  VirtualMaxZ = Private->AbsolutePointerMode.AbsoluteMaxZ;
+
   //
   // if no physical pointer device exists, return EFI_NOT_READY;
   // if any physical pointer device has changed state,
@@ -4124,16 +4143,26 @@ ConSplitterAbsolutePointerGetState (
 ReturnStatus = EFI_SUCCESS;
   }
 
+  MinX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinX;
+  MinY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinY;
+  MinZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMinZ;
+  MaxX = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxX;
+  MaxY = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxY;
+  MaxZ = Private->AbsolutePointerList[Index]->Mode->AbsoluteMaxZ;
+
   State->ActiveButtons = CurrentState.ActiveButtons;
 
-  if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && 
Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
-State->CurrentX = CurrentState.CurrentX;
+  //
+  // Rescale to Con Splitter virtual Absolute Pointer's resolution.
+  //
+  if (!(MinX == 0 && MaxX == 0)) {
+State->CurrentX = VirtualMinX + (CurrentState.CurrentX * (VirtualMaxX 
- VirtualMinX)) / (MaxX - MinX);
   }
-  if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && 
Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {
-State->CurrentY = CurrentState.CurrentY;
+  if (!(MinY == 0 && MaxY == 0)) {
+State->CurrentY = VirtualMinY + (CurrentState.CurrentY * (VirtualMaxY 
- VirtualMinY)) / (MaxY - MinY);
   }
-  if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && 
Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {
-State->CurrentZ = CurrentState.CurrentZ;
+  if (!(MinZ == 0 && MaxZ == 0)) {
+State->CurrentZ = VirtualMinZ + (CurrentState.CurrentZ * (VirtualMaxZ 
- VirtualMinZ)) / (MaxZ - MinZ);
   }
 
 } else if (Status == EFI_DEVICE_ERROR) {
-- 
2.6.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel