Re: [Spice-devel] [PATCH qxl-wddm-dod v4 07/10] Fixing framebuffer usage logic

2016-09-12 Thread Frediano Ziglio
> 
> This patch fixes 2 issues:
> 
>   1. Framebuffer should only be used in vga mode,
>  therefore when QxlDevice is active
>  FrameBufferIsActive flag shouldn't be checked;
>   2. FrameBufferIsActive flag should be set true
>  on successfull frame buffer allocation only.
> 
> Signed-off-by: Dmitry Fleytman 
> Signed-off-by: Sameeh Jubran 
> ---
>  qxldod/QxlDod.cpp | 106
>  +++---
>  1 file changed, 53 insertions(+), 53 deletions(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 58890f6..ae7b14f 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -511,40 +511,37 @@ NTSTATUS QxlDod::PresentDisplayOnly(_In_ CONST
> DXGKARG_PRESENT_DISPLAYONLY* pPre
>  return STATUS_SUCCESS;
>  }
>  
> -if
> (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Flags.FrameBufferIsActive)
> -{
> -
> -// If actual pixels are coming through, will need to completely zero
> out physical address next time in BlackOutScreen
> -
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutStart.QuadPart
> = 0;
> -
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutEnd.QuadPart
> = 0;
> -
>  
> -D3DKMDT_VIDPN_PRESENT_PATH_ROTATION RotationNeededByFb =
> pPresentDisplayOnly->Flags.Rotate ?
> -
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Rotation
> :
> -
> D3DKMDT_VPPR_IDENTITY;
> -BYTE* pDst =
> (BYTE*)m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].FrameBuffer.Ptr;
> -UINT DstBitPerPixel =
> BPPFromPixelFormat(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.ColorFormat);
> -if (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Scaling ==
> D3DKMDT_VPPS_CENTERED)
> -{
> -UINT CenterShift =
> (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Height -
> -
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeHeight)*m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Pitch;
> -CenterShift +=
> (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Width -
> -
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeWidth)*DstBitPerPixel/8;
> -pDst += (int)CenterShift/2;
> -}
> -Status = m_pHWDevice->ExecutePresentDisplayOnly(
> -pDst,
> -DstBitPerPixel,
> -(BYTE*)pPresentDisplayOnly->pSource,
> -pPresentDisplayOnly->BytesPerPixel,
> -pPresentDisplayOnly->Pitch,
> -pPresentDisplayOnly->NumMoves,
> -pPresentDisplayOnly->pMoves,
> -pPresentDisplayOnly->NumDirtyRects,
> -pPresentDisplayOnly->pDirtyRect,
> -RotationNeededByFb,
> -_CurrentModes[0]);
> -}
> +// If actual pixels are coming through, will need to completely zero out
> physical address next time in BlackOutScreen
> +
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutStart.QuadPart
> = 0;
> +m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutEnd.QuadPart
> = 0;
> +
> +
> +D3DKMDT_VIDPN_PRESENT_PATH_ROTATION RotationNeededByFb =
> pPresentDisplayOnly->Flags.Rotate ?
> +
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Rotation
> :
> +
> D3DKMDT_VPPR_IDENTITY;
> +BYTE* pDst =
> (BYTE*)m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].FrameBuffer.Ptr;
> +UINT DstBitPerPixel =
> BPPFromPixelFormat(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.ColorFormat);
> +if (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Scaling ==
> D3DKMDT_VPPS_CENTERED)
> +{
> +UINT CenterShift =
> (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Height -
> +
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeHeight)*m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Pitch;
> +CenterShift +=
> (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Width -
> +
> m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeWidth)*DstBitPerPixel/8;
> +pDst += (int)CenterShift/2;
> +}
> +Status = m_pHWDevice->ExecutePresentDisplayOnly(
> +pDst,
> +DstBitPerPixel,
> +(BYTE*)pPresentDisplayOnly->pSource,
> +pPresentDisplayOnly->BytesPerPixel,
> +pPresentDisplayOnly->Pitch,
> +pPresentDisplayOnly->NumMoves,
> +pPresentDisplayOnly->pMoves,
> +pPresentDisplayOnly->NumDirtyRects,
> +pPresentDisplayOnly->pDirtyRect,
> +RotationNeededByFb,
> +_CurrentModes[0]);
>  DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", 

[Spice-devel] [PATCH qxl-wddm-dod v4 07/10] Fixing framebuffer usage logic

2016-09-11 Thread Sameeh Jubran
This patch fixes 2 issues:

  1. Framebuffer should only be used in vga mode,
 therefore when QxlDevice is active
 FrameBufferIsActive flag shouldn't be checked;
  2. FrameBufferIsActive flag should be set true
 on successfull frame buffer allocation only.

Signed-off-by: Dmitry Fleytman 
Signed-off-by: Sameeh Jubran 
---
 qxldod/QxlDod.cpp | 106 +++---
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 58890f6..ae7b14f 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -511,40 +511,37 @@ NTSTATUS QxlDod::PresentDisplayOnly(_In_ CONST 
DXGKARG_PRESENT_DISPLAYONLY* pPre
 return STATUS_SUCCESS;
 }
 
-if 
(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Flags.FrameBufferIsActive)
-{
-
-// If actual pixels are coming through, will need to completely zero 
out physical address next time in BlackOutScreen
-
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutStart.QuadPart = 0;
-
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutEnd.QuadPart = 0;
-
 
-D3DKMDT_VIDPN_PRESENT_PATH_ROTATION RotationNeededByFb = 
pPresentDisplayOnly->Flags.Rotate ?
- 
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Rotation :
- 
D3DKMDT_VPPR_IDENTITY;
-BYTE* pDst = 
(BYTE*)m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].FrameBuffer.Ptr;
-UINT DstBitPerPixel = 
BPPFromPixelFormat(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.ColorFormat);
-if (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Scaling == 
D3DKMDT_VPPS_CENTERED)
-{
-UINT CenterShift = 
(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Height -
-
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeHeight)*m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Pitch;
-CenterShift += 
(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Width -
-
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeWidth)*DstBitPerPixel/8;
-pDst += (int)CenterShift/2;
-}
-Status = m_pHWDevice->ExecutePresentDisplayOnly(
-pDst,
-DstBitPerPixel,
-(BYTE*)pPresentDisplayOnly->pSource,
-pPresentDisplayOnly->BytesPerPixel,
-pPresentDisplayOnly->Pitch,
-pPresentDisplayOnly->NumMoves,
-pPresentDisplayOnly->pMoves,
-pPresentDisplayOnly->NumDirtyRects,
-pPresentDisplayOnly->pDirtyRect,
-RotationNeededByFb,
-_CurrentModes[0]);
-}
+// If actual pixels are coming through, will need to completely zero out 
physical address next time in BlackOutScreen
+m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutStart.QuadPart 
= 0;
+m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].ZeroedOutEnd.QuadPart = 
0;
+
+
+D3DKMDT_VIDPN_PRESENT_PATH_ROTATION RotationNeededByFb = 
pPresentDisplayOnly->Flags.Rotate ?
+ 
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Rotation :
+ 
D3DKMDT_VPPR_IDENTITY;
+BYTE* pDst = 
(BYTE*)m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].FrameBuffer.Ptr;
+UINT DstBitPerPixel = 
BPPFromPixelFormat(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.ColorFormat);
+if (m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].Scaling == 
D3DKMDT_VPPS_CENTERED)
+{
+UINT CenterShift = 
(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Height -
+
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeHeight)*m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Pitch;
+CenterShift += 
(m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].DispInfo.Width -
+
m_CurrentModes[pPresentDisplayOnly->VidPnSourceId].SrcModeWidth)*DstBitPerPixel/8;
+pDst += (int)CenterShift/2;
+}
+Status = m_pHWDevice->ExecutePresentDisplayOnly(
+pDst,
+DstBitPerPixel,
+(BYTE*)pPresentDisplayOnly->pSource,
+pPresentDisplayOnly->BytesPerPixel,
+pPresentDisplayOnly->Pitch,
+pPresentDisplayOnly->NumMoves,
+pPresentDisplayOnly->pMoves,
+pPresentDisplayOnly->NumDirtyRects,
+pPresentDisplayOnly->pDirtyRect,
+