<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 7:15 PM, Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank">fziglio@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">><br>
> This patch fixes 2 issues:<br>
><br>
> 1. Framebuffer should only be used in vga mode,<br>
> therefore when QxlDevice is active<br>
> FrameBufferIsActive flag shouldn't be checked;<br>
> 2. FrameBufferIsActive flag should be set true<br>
> on successfull frame buffer allocation only.<br>
><br>
> Signed-off-by: Dmitry Fleytman <<a href="mailto:dmitry@daynix.com">dmitry@daynix.com</a>><br>
> Signed-off-by: Sameeh Jubran <<a href="mailto:sameeh@daynix.com">sameeh@daynix.com</a>><br>
> ---<br>
> qxldod/QxlDod.cpp | 116<br>
> +++++++++++++++++++++++++++---<wbr>------------------------<br>
> 1 file changed, 58 insertions(+), 58 deletions(-)<br>
><br>
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp<br>
> index 85d6d94..ca3f8a3 100755<br>
> --- a/qxldod/QxlDod.cpp<br>
> +++ b/qxldod/QxlDod.cpp<br>
> @@ -523,40 +523,37 @@ NTSTATUS QxlDod::PresentDisplayOnly(_<wbr>In_ CONST<br>
> DXGKARG_PRESENT_DISPLAYONLY* pPre<br>
> return STATUS_SUCCESS;<br>
> }<br>
><br>
> - if<br>
> (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].Flags.<wbr>FrameBufferIsActive)<br>
> - {<br>
> -<br>
> - // If actual pixels are coming through, will need to completely zero<br>
> out physical address next time in BlackOutScreen<br>
> -<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].ZeroedOutStart.<wbr>QuadPart<br>
> = 0;<br>
> -<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].ZeroedOutEnd.<wbr>QuadPart<br>
> = 0;<br>
><br>
> -<br>
> - D3DKMDT_VIDPN_PRESENT_PATH_<wbr>ROTATION RotationNeededByFb =<br>
> pPresentDisplayOnly->Flags.<wbr>Rotate ?<br>
> -<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].Rotation<br>
> :<br>
> -<br>
> D3DKMDT_VPPR_IDENTITY;<br>
> - BYTE* pDst =<br>
> (BYTE*)m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].FrameBuffer.<wbr>Ptr;<br>
> - UINT DstBitPerPixel =<br>
> BPPFromPixelFormat(m_<wbr>CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.<wbr>ColorFormat);<br>
> - if (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].Scaling ==<br>
> D3DKMDT_VPPS_CENTERED)<br>
> - {<br>
> - UINT CenterShift =<br>
> (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.Height -<br>
> -<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].SrcModeHeight)*<wbr>m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.Pitch;<br>
> - CenterShift +=<br>
> (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.Width -<br>
> -<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].SrcModeWidth)*<wbr>DstBitPerPixel/8;<br>
> - pDst += (int)CenterShift/2;<br>
> - }<br>
> - Status = m_pHWDevice-><wbr>ExecutePresentDisplayOnly(<br>
> - pDst,<br>
> - DstBitPerPixel,<br>
> - (BYTE*)pPresentDisplayOnly-><wbr>pSource,<br>
> - pPresentDisplayOnly-><wbr>BytesPerPixel,<br>
> - pPresentDisplayOnly->Pitch,<br>
> - pPresentDisplayOnly->NumMoves,<br>
> - pPresentDisplayOnly->pMoves,<br>
> - pPresentDisplayOnly-><wbr>NumDirtyRects,<br>
> - pPresentDisplayOnly-><wbr>pDirtyRect,<br>
> - RotationNeededByFb,<br>
> - &m_CurrentModes[0]);<br>
> - }<br>
> + // If actual pixels are coming through, will need to completely zero out<br>
> physical address next time in BlackOutScreen<br>
> +<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].ZeroedOutStart.<wbr>QuadPart<br>
> = 0;<br>
> + m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].ZeroedOutEnd.<wbr>QuadPart<br>
> = 0;<br>
> +<br>
> +<br>
> + D3DKMDT_VIDPN_PRESENT_PATH_<wbr>ROTATION RotationNeededByFb =<br>
> pPresentDisplayOnly->Flags.<wbr>Rotate ?<br>
> +<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].Rotation<br>
> :<br>
> +<br>
> D3DKMDT_VPPR_IDENTITY;<br>
> + BYTE* pDst =<br>
> (BYTE*)m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].FrameBuffer.<wbr>Ptr;<br>
> + UINT DstBitPerPixel =<br>
> BPPFromPixelFormat(m_<wbr>CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.<wbr>ColorFormat);<br>
> + if (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].Scaling ==<br>
> D3DKMDT_VPPS_CENTERED)<br>
> + {<br>
> + UINT CenterShift =<br>
> (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.Height -<br>
> +<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].SrcModeHeight)*<wbr>m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.Pitch;<br>
> + CenterShift +=<br>
> (m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].DispInfo.Width -<br>
> +<br>
> m_CurrentModes[<wbr>pPresentDisplayOnly-><wbr>VidPnSourceId].SrcModeWidth)*<wbr>DstBitPerPixel/8;<br>
> + pDst += (int)CenterShift/2;<br>
> + }<br>
> + Status = m_pHWDevice-><wbr>ExecutePresentDisplayOnly(<br>
> + pDst,<br>
> + DstBitPerPixel,<br>
> + (BYTE*)pPresentDisplayOnly-><wbr>pSource,<br>
> + pPresentDisplayOnly-><wbr>BytesPerPixel,<br>
> + pPresentDisplayOnly->Pitch,<br>
> + pPresentDisplayOnly->NumMoves,<br>
> + pPresentDisplayOnly->pMoves,<br>
> + pPresentDisplayOnly-><wbr>NumDirtyRects,<br>
> + pPresentDisplayOnly-><wbr>pDirtyRect,<br>
> + RotationNeededByFb,<br>
> + &m_CurrentModes[0]);<br>
> DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));<br>
> return Status;<br>
> }<br>
> @@ -1542,12 +1539,11 @@ NTSTATUS QxlDod::SetSourceModeAndPath(<wbr>CONST<br>
> D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo<br>
> pCurrentBddMode->DispInfo.<wbr>Height =<br>
> pSourceMode-><a href="http://Format.Graphics.PrimSurfSize.cy" rel="noreferrer" target="_blank">Format.Graphics.<wbr>PrimSurfSize.cy</a>;<br>
> pCurrentBddMode->DispInfo.<wbr>Pitch =<br>
> pSourceMode-><a href="http://Format.Graphics.PrimSurfSize.cx" rel="noreferrer" target="_blank">Format.Graphics.<wbr>PrimSurfSize.cx</a> *<br>
> BPPFromPixelFormat(<wbr>pCurrentBddMode->DispInfo.<wbr>ColorFormat) /<br>
> BITS_PER_BYTE;<br>
><br>
> - Status = m_pHWDevice-><wbr>AcquireFrameBuffer(<wbr>pCurrentBddMode);<br>
> + Status = m_pHWDevice-><wbr>AcquireFrameBuffer(<wbr>pCurrentBddMode);<br>
><br>
<br>
</div></div>Here I think it's just a small mistake, no reason to indent more.<br>
<span class=""><br>
> if (NT_SUCCESS(Status))<br>
> {<br>
><br>
> - pCurrentBddMode->Flags.<wbr>FrameBufferIsActive = TRUE;<br>
<br>
</span>I would remove the empty line above<br>
<div><div class="h5"><br>
> m_pHWDevice->BlackOutScreen(&<wbr>m_CurrentModes[pPath-><wbr>VidPnSourceId]);<br>
><br>
> // Mark that the next present should be fullscreen so the screen<br>
> doesn't go from black to actual pixels one dirty rect at a time.<br>
> @@ -2979,11 +2975,18 @@ VOID VgaDevice::ResetDevice(VOID)<br>
><br>
> NTSTATUS VgaDevice::AcquireFrameBuffer(<wbr>CURRENT_BDD_MODE* pCurrentBddMode)<br>
> {<br>
> - // Map the new frame buffer<br>
> - QXL_ASSERT(pCurrentBddMode-><wbr>FrameBuffer.Ptr == NULL);<br>
> - NTSTATUS status =<br>
> MapFrameBuffer(<wbr>pCurrentBddMode->DispInfo.<wbr>PhysicAddress,<br>
> - pCurrentBddMode->DispInfo.<wbr>Pitch * pCurrentBddMode->DispInfo.<wbr>Height,<br>
> - &(pCurrentBddMode-><wbr>FrameBuffer.Ptr));<br>
> + NTSTATUS status = STATUS_UNSUCCESSFUL;<br>
> + if (!pCurrentBddMode->Flags.<wbr>DoNotMapOrUnmap) {<br>
> + // Map the new frame buffer<br>
> + QXL_ASSERT(pCurrentBddMode-><wbr>FrameBuffer.Ptr == NULL);<br>
> + status = MapFrameBuffer(<wbr>pCurrentBddMode->DispInfo.<wbr>PhysicAddress,<br>
> + pCurrentBddMode->DispInfo.<wbr>Pitch *<br>
> pCurrentBddMode->DispInfo.<wbr>Height,<br>
> + &(pCurrentBddMode-><wbr>FrameBuffer.Ptr));<br>
> + if (NT_SUCCESS(status))<br>
> + {<br>
> + pCurrentBddMode->Flags.<wbr>FrameBufferIsActive = TRUE;<br>
> + }<br>
> + }<br>
> return status;<br>
> }<br>
><br>
<br>
</div></div>Here I would just add a<br>
<br>
if (!pCurrentBddMode->Flags.<wbr>DoNotMapOrUnmap) {<br>
return STATUS_UNSUCCESSFUL;<br>
}<br>
<br>
just after the function starts.<br>
<div><div class="h5"><br>
> @@ -4501,26 +4504,23 @@ VOID QxlDevice::BlackOutScreen(<wbr>CURRENT_BDD_MODE*<br>
> pCurrentBddMod)<br>
> QXLDrawable *drawable;<br>
> RECT Rect;<br>
> PAGED_CODE();<br>
> - if (pCurrentBddMod->Flags.<wbr>FrameBufferIsActive)<br>
> + Rect.bottom = pCurrentBddMod->SrcModeHeight;<br>
> + Rect.top = 0;<br>
> + Rect.left = 0;<br>
> + Rect.right = pCurrentBddMod->SrcModeWidth;<br>
> + if (!(drawable = Drawable(QXL_DRAW_FILL, &Rect, NULL, 0)))<br>
> {<br>
> - Rect.bottom = pCurrentBddMod->SrcModeHeight;<br>
> - Rect.top = 0;<br>
> - Rect.left = 0;<br>
> - Rect.right = pCurrentBddMod->SrcModeWidth;<br>
> - if (!(drawable = Drawable(QXL_DRAW_FILL, &Rect, NULL, 0)))<br>
> - {<br>
> - DbgPrint(TRACE_LEVEL_ERROR, ("Cannot get Drawable.\n"));<br>
> - return;<br>
> - }<br>
> - drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;<br>
> - drawable->u.fill.brush.u.color = 0;<br>
> - drawable->u.fill.rop_<wbr>descriptor = SPICE_ROPD_OP_PUT;<br>
> - drawable->u.fill.mask.flags = 0;<br>
> - drawable->u.fill.mask.pos.x = 0;<br>
> - drawable->u.fill.mask.pos.y = 0;<br>
> - drawable->u.fill.mask.bitmap = 0;<br>
> - PushDrawable(drawable);<br>
> + DbgPrint(TRACE_LEVEL_ERROR, ("Cannot get Drawable.\n"));<br>
> + return;<br>
> }<br>
> + drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;<br>
> + drawable->u.fill.brush.u.color = 0;<br>
> + drawable->u.fill.rop_<wbr>descriptor = SPICE_ROPD_OP_PUT;<br>
> + drawable->u.fill.mask.flags = 0;<br>
> + drawable->u.fill.mask.pos.x = 0;<br>
> + drawable->u.fill.mask.pos.y = 0;<br>
> + drawable->u.fill.mask.bitmap = 0;<br>
> + PushDrawable(drawable);<br>
> }<br>
><br>
> __declspec(code_seg("PAGE"))<br>
<br>
</div></div>All changes I commented are mainly spaces and small style, if you<br>
agree I can change them, if not reply.<br></blockquote><div>Yes, go ahead. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Acked-by: Frediano Ziglio <<a href="mailto:fziglio@redhat.com">fziglio@redhat.com</a>><br>
<span class="HOEnZb"><font color="#888888"><br>
Frediano<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font size="4" color="#0b5394" face="times new roman, serif">Respectfully,<br></font><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="4" color="#0b5394" face="times new roman, serif"><b><i>Sameeh Jubran</i></b></font></div><div style="font-size:12.8px;color:rgb(136,136,136)"><i style="color:rgb(7,55,99);font-family:"times new roman",serif;font-size:large"><span style="line-height:15px"><a href="https://il.linkedin.com/pub/sameeh-jubran/87/747/a8a" title="View public profile" name="UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_14e2c1de96f8c195_UNIQUE_ID_SafeHtmlFilter_SafeHtmlFilter_SafeHtmlFilter_webProfileURL" style="color:rgb(17,85,204);margin:0px;padding:0px;border-width:0px;outline:none;vertical-align:baseline;text-decoration:none" target="_blank">Linkedin</a></span></i><br></div><div style="font-size:12.8px;color:rgb(136,136,136)"><font size="4" face="times new roman, serif" color="#073763"><i>Junior Software Engineer @ <a href="http://www.daynix.com" target="_blank">Daynix</a>.</i></font></div></div></div></div></div></div></div>
</div></div>