[Spice-devel] [PATCH qxl-win v3] display/*: add PDev->enabled
Yonit Halperin
yhalperi at redhat.com
Thu Jul 7 07:09:03 PDT 2011
On 07/07/2011 12:43 PM, Alon Levy wrote:
> GDI will continue using any callback we registered even after a
> DrvAssertMode(FALSE). We are expected to move any surface we own to GDI handled
> and ignore any new requests to create a surface. This is called punting and we
> use PDev->enabled to indicate if this is required.
>
> A later patch will set PDev->enabled to FALSE on DrvAssertMode.
Hi,
when moving surfaces to RAM, we used EngModifySurface with no hooks. Do
we also need punting?
> ---
> display/driver.c | 5 +++++
> display/qxldd.h | 10 ++++++++++
> display/rop.c | 12 ++++++++++++
> 3 files changed, 27 insertions(+), 0 deletions(-)
>
> diff --git a/display/driver.c b/display/driver.c
> index bbad696..a231bb4 100644
> --- a/display/driver.c
> +++ b/display/driver.c
> @@ -517,6 +517,7 @@ DHPDEV DrvEnablePDEV(DEVMODEW *dev_mode, PWSTR ignore1, ULONG ignore2, HSURF *ig
> RtlCopyMemory(dev_caps,&gdi_info, dev_caps_size);
> RtlCopyMemory(in_dev_info,&dev_info, dev_inf_size);
>
> + pdev->enabled = TRUE; /* assume no operations before a DrvEnablePDEV. */
> DEBUG_PRINT((NULL, 1, "%s: 0x%lx\n", __FUNCTION__, pdev));
> return(DHPDEV)pdev;
>
> @@ -1175,6 +1176,8 @@ BOOL APIENTRY DrvStrokePath(SURFOBJ *surf, PATHOBJ *path, CLIPOBJ *clip, XFORMOB
> return TRUE;
> }
>
> + PUNT_IF_DISABLED(pdev);
> +
> CountCall(pdev, CALL_COUNTER_STROKE_PATH);
>
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
> @@ -1267,6 +1270,8 @@ HBITMAP APIENTRY DrvCreateDeviceBitmap(DHPDEV dhpdev, SIZEL size, ULONG format)
> return 0;
> }
>
> + PUNT_IF_DISABLED(pdev);
> +
> surface_id = GetFreeSurface(pdev);
> if (!surface_id) {
> goto out_error;
> diff --git a/display/qxldd.h b/display/qxldd.h
> index 15be2fa..23a2f02 100644
> --- a/display/qxldd.h
> +++ b/display/qxldd.h
> @@ -61,6 +61,14 @@
> EngDebugBreak(); \
> }
>
> +#define PUNT_IF_DISABLED(pdev) \
> + do { \
> + if (!pdev->enabled) { \
> + DEBUG_PRINT((pdev, 0, "%s: punting\n", __FUNCTION__)); \
> + return FALSE; \
> + } \
> + } while (0)
> +
> typedef enum {
> QXL_SUCCESS,
> QXL_FAILED,
> @@ -349,6 +357,8 @@ typedef struct PDev {
> UINT32 n_surfaces;
> SurfaceInfo surface0_info;
>
> + UINT32 enabled; /* 1 between DrvAssertMode(TRUE) and DrvAssertMode(FALSE) */
> +
> UCHAR pci_revision;
> } PDev;
>
> diff --git a/display/rop.c b/display/rop.c
> index dce6e44..9fb3527 100644
> --- a/display/rop.c
> +++ b/display/rop.c
> @@ -1265,6 +1265,8 @@ BOOL APIENTRY DrvBitBlt(SURFOBJ *dest, SURFOBJ *src, SURFOBJ *mask, CLIPOBJ *cli
> pdev = (PDev *)dest->dhpdev;
> }
>
> + PUNT_IF_DISABLED(pdev);
> +
> CountCall(pdev, CALL_COUNTER_BIT_BLT);
>
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
> @@ -1294,6 +1296,8 @@ BOOL APIENTRY DrvCopyBits(SURFOBJ *dest, SURFOBJ *src, CLIPOBJ *clip,
> pdev = (PDev *)dest->dhpdev;
> }
>
> + PUNT_IF_DISABLED(pdev);
> +
> CountCall(pdev, CALL_COUNTER_BIT_BLT);
>
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
> @@ -1461,6 +1465,8 @@ BOOL APIENTRY DrvStretchBltROP(SURFOBJ *dest, SURFOBJ *src, SURFOBJ *mask, CLIPO
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
> CountCall(pdev, CALL_COUNTER_STRETCH_BLT_ROP);
>
> + PUNT_IF_DISABLED(pdev);
> +
> if ((res = _StretchBlt(pdev, dest, src, mask, clip, color_trans,
> mode == HALFTONE ? color_adjust: NULL, brush_pos,
> dest_rect, src_rect, mask_pos, mode, brush,rop4))) {
> @@ -1494,6 +1500,8 @@ BOOL APIENTRY DrvStretchBlt(SURFOBJ *dest, SURFOBJ *src, SURFOBJ *mask, CLIPOBJ
>
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
> CountCall(pdev, CALL_COUNTER_STRETCH_BLT);
> + PUNT_IF_DISABLED(pdev);
> +
> if ((res = _StretchBlt(pdev, dest, src, mask, clip, color_trans,
> mode == HALFTONE ? color_adjust: NULL, NULL, dest_rect,
> src_rect, mask_pos, mode, NULL, (mask) ? 0xccaa: 0xcccc))) {
> @@ -1590,6 +1598,8 @@ BOOL APIENTRY DrvAlphaBlend(SURFOBJ *dest, SURFOBJ *src, CLIPOBJ *clip, XLATEOBJ
> pdev = (PDev *)dest->dhpdev;
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
>
> + PUNT_IF_DISABLED(pdev);
> +
> ASSERT(pdev, src_rect&& src_rect->left< src_rect->right&&
> src_rect->top< src_rect->bottom);
> ASSERT(pdev, dest_rect&& dest_rect->left< dest_rect->right&&
> @@ -1688,6 +1698,8 @@ BOOL APIENTRY DrvTransparentBlt(SURFOBJ *dest, SURFOBJ *src, CLIPOBJ *clip, XLAT
>
> DEBUG_PRINT((pdev, 3, "%s\n", __FUNCTION__));
>
> + PUNT_IF_DISABLED(pdev);
> +
> ASSERT(pdev, src_rect&& src_rect->left< src_rect->right&&
> src_rect->top< src_rect->bottom);
> ASSERT(pdev, dest_rect&& dest_rect->left< dest_rect->right&&
More information about the Spice-devel
mailing list