Age | Commit message (Collapse) | Author | Files | Lines |
|
our old code did a very minimal flow good for resolution change:
DrvAssertMode False (disable)
destroy primary surface
delete vram memslot
DrvAssertMode True (enable)
create primary surface (destroyed on disable)
create vram memslot
Aside: Importantly the flow for resolution change involves two pdevs, so actually the
enable call is not called, only:
DrvAssertMode(PDEV#1, FALSE)
DrvEnableSurface(PDEV#2)
EnableSurface creates a primary surface, so the call to AssertMode must destroy it.
This fails on suspend for many reasons, one of them being that we don't disable
operations to any driver managed off screen surfaces, and the other is that
after the qxl reset done via acpi S3 request by windows, we don't reinitialize
the primary memslot (this is fixed by a previous commit).
The correct (per example drivers from WinDDK, and per msdn) thing to do in
DrvAssertMode is to not do any further interaction with the device. The
simplest way to achieve that is to fail any operation. The GDI is designed such
that it can work completely without any driver, so for any operation there is a
fallback in case the driver returns a failure error code. A simplification is
to use EngModifySurface to move a surface to GDI control and so not to get any
further callback on it (except for the deletion callback when it is deleted).
This is also done in the 3dlabs example driver.
There is zero synchronization between the miniport, which knows about the power
state, and the displayport, which knows about the pci device structure, command
rings, resources.
As a result the easiest and also consistent with the above requirements
implementation for suspend to ram and to disk is to reset any server side state
during DrvAssertMode(FALSE), copying all volatile (surface contents only atm)
memory to guest ram (from there windows will copy it to disk for us if we are
hibernating).
So the new flow for DriveAssertMode is then:
AssertModeDisable:
1. set pdev->enable to False (all further operations will be punted)
2. tell server to prepare for sleep, via new QXL_IO_UPDATE_MEM(QXL_UPDATE_MEM_RENDER_ALL):
server updates all surfaces
server destroys all surfaces. Since we never sent it a destroy command
this doesn't trigger any guest side surface destruction, only a release of
the creation command resources.
3. release anything in the release ring.
4. tell server to write it's current releasable items list (qxl->last_release)
to the release_ring (we just made sure the release_ring is empty, and since we
are not sending anything new to the worker and we already had it render
anything outstanding it will not fill it) release the last resources (at this
point there is nothing allocated on devram and vram - we verify that in debug
mode with DUMP_MSPACE_VRAM and DUMP_MSPACE_DEVRAM).
5. Destroy primary surface
6. Delete vram memslot
AssertModeEnable:
1. Create primary surface
2. create vram memslot
3. copy surfaces from ram to vram, sending create commands which cause both
create and surface image commands to be sent to the client.
In suspend there is a single PDEV involved which does exactly those two calls,
disable before sleep and enable after.
For resolution change this work is excessive but correct. Since
miniport:SetPowerState is called after DrvAssertMode during suspend (actually
there is no defined order in the documentation), there is no way to distinguish
between the two anyway.
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
This is called possibly before sleep, and otherwise during resolution
change and logout. To support the sleep case we need to flush all memory
on the device and render all surfaces, which is what the synchronous UPDATE_MEM
does.
|
|
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.
|
|
Adds fields to SurfaceInfo to cache data previously only available
via SurfaceArea::draw_area.
Adds two functions to save and restore surfaces from ram:
MoveAllSurfacesToVideoRam
allocates and copies surfaces from vram to ram, and calls EngModifySurface
with an empty hook list to make those surfaces completely managed by gdi and not
us.
MoveAllSurfacesToRam
recreates surfaces on vram and calls EngModifySurface with QXL_SURFACE_HOOKS, and
finally sends a QXL_SURFACE_CMD_CREATE with the valid data flag to make the server
send a surface image message after the surface create message.
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
alloc/free code paths
This adds a third surface allocation type, allocation from guest memory using
the windows ddk allocator.
Not all code paths are used later - the creation is not done since
copy-surfaces-to-ram allocates memory itself, and at the end we never allocate
any surfaces when the device is disabled, we just punt the allocation to the
gdi, but the code is still left in GetSurfaceMemory.
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
|
|
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
Refactors InitResources code called upon DrvEnableSurface so it can later be called
from AssertModeEnable. Introduces three helpers:
EmptyReleaseRing - no vmexit, goes over release ring and empties it all (as opposed to
OOM behavior that empties 50 resources).
InitDeviceMemoryResources - resets anything on the device memory (devram and vram pci bars).
ReleaseCacheDeviceMemoryResources - helper for clearing the cache (which points to devram
QXLImage's)
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
even if it is not found in the cache (which is an error)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in DrvAssertModeDisable later)
Cc: Yonit Halperin <yhalperi@redhat.com>
|
|
changes the passed user pointer to mspace from NULL to a proper pdev, so
it will be able to print using QXL_IO_LOG.
|
|
Disabled if no DBG, and uses loglevel == 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
We zero the memory explicitly for debugging purposes when going to sleep
to ensure the return path doesn't rely on any initialization done before.
SetPowerState slightly refactored in the process.
|
|
|
|
|
|
snprintf is Copyright Patrick Powell 1995 (with more changes, see miniport/minimal_snprintf.c
starting comment).
Implements a DebugPrint similar to the one in display, using QXL_IO_LOG with the buffer
on the pci devram bar at ram->log_buf, and log_level taken from there as well (set by
qemu via guestdebug parameter to the qxl device). Allows for easier debugging of the miniport.
Compiled out for release (free) builds where DBG is not defined.
|
|
|
|
on error2 path, if we failed QXLGetSurface, we free the surface info but then
the caller (DrvCreateDeviceBitmap) frees it again. In addition, we cannot free
the SurfaceInfo since it is the handle given to GDI and is accessed on callback
from EngDestroySurface (which is called immediatelly after in the same error
path).
|
|
|
|
|
|
DebugPrint with pdev early)
|
|
In Free build this is defined out anyway, but in checked build this assert
triggers, so change it to a debug print (pending investigation on why
someone thought at some point it should never happen).
The asserts were on:
cursor->unique != 0
function end not reached
|
|
|
|
|
|
Internet Explorer 9 renders cursors and other things by reusing the same
SURFOBJ (i.e. surfobj->iUniq is constant) but changing the pallete.
We were wrongly ignoring the pallette's iUniq because the XO_TABLE flag
was not set. That flag should not be checked when calculating the key for
our cache. When that flag is ignored we correctly calculate a key that uses
both the surf->iUniq and the colortrans->iUniq together (64 bit from two 32
bit values).
|
|
The version of the miniport was 1.3.0.0 while the driver had 1.4.1.1
Different versions between them lead to confusion, better to sync them.
|
|
Later todo is to check that there is available video memory for
this, but that requires either access to PDev or probably dynamically
checking anyway to make sure we actually fit. Another option is
to leave that check in the host (when we do a IO_SETMODE)
Bumping version to 1.4.1.1
Tested with winxp 32 bit only.
|
|
-fix types & casts for correctness in x64
-add #ifndef _WIN64 for all the SSE2/FPU/fast_memcpy stuff
-miniport/makefile: remove IFNDEF AMD64 to enable x64 build
-miniport/qxl.inf: add x64 support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|