add qxl pci initialization bits.

Conflicts:
	qxldod/QxlDod.cpp
	qxldod/driver.cpp
This commit is contained in:
Vadim Rozenfeld 2014-01-27 12:53:42 +11:00
commit 4947c22618
10 changed files with 2402 additions and 33 deletions

View File

@ -64,8 +64,8 @@ QxlDod::~QxlDod(void)
{
PAGED_CODE();
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
CleanUp();
delete m_pHWDevice;
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
}
@ -120,10 +120,18 @@ NTSTATUS QxlDod::StartDevice(_In_ DXGK_START_INFO* pDxgkStartInfo,
return STATUS_UNSUCCESSFUL;
}
Status = m_pHWDevice->HWInit(m_DeviceInfo.TranslatedResourceList);
if (!NT_SUCCESS(Status))
{
QXL_LOG_ASSERTION1("HWInit failed with status 0x%X\n",
Status);
return Status;
}
Status = m_pHWDevice->GetModeList(&m_CurrentModes[0].DispInfo);
if (!NT_SUCCESS(Status))
{
QXL_LOG_ASSERTION1("RegisterHWInfo failed with status 0x%X\n",
QXL_LOG_ASSERTION1("GetModeList failed with status 0x%X\n",
Status);
return Status;
}
@ -2450,6 +2458,25 @@ UnmapFrameBuffer(
// HW specific code
VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
{
m_pQxlDod = pQxlDod;
m_ModeInfo = NULL;
m_ModeCount = 0;
m_ModeNumbers = NULL;
m_CurrentMode = 0;
}
VgaDevice::~VgaDevice(void)
{
delete [] reinterpret_cast<BYTE*>(m_ModeInfo);
delete [] reinterpret_cast<BYTE*>(m_ModeNumbers);
m_ModeInfo = NULL;
m_ModeNumbers = NULL;
m_CurrentMode = 0;
m_ModeCount = 0;
}
NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
{
PAGED_CODE();
@ -2657,6 +2684,14 @@ NTSTATUS VgaDevice::GetCurrentMode(ULONG* pMode)
return Status;
}
NTSTATUS VgaDevice::HWInit(PCM_RESOURCE_LIST pResList)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
UNREFERENCED_PARAMETER(pResList);
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return STATUS_SUCCESS;
}
NTSTATUS VgaDevice::SetPowerState(POWER_ACTION ActionType)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
@ -2731,3 +2766,186 @@ NTSTATUS QxlDevice::SetPowerState(POWER_ACTION ActionType)
return STATUS_SUCCESS;
}
NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterrface();
UINT pci_range = QXL_RAM_RANGE_INDEX;
for (ULONG i = 0; i < pResList->Count; ++i)
{
PCM_FULL_RESOURCE_DESCRIPTOR pFullResDescriptor = &pResList->List[i];
for (ULONG j = 0; j < pFullResDescriptor->PartialResourceList.Count; ++j)
{
PCM_PARTIAL_RESOURCE_DESCRIPTOR pResDescriptor = &pFullResDescriptor->PartialResourceList.PartialDescriptors[j];
switch (pResDescriptor->Type)
{
case CmResourceTypePort:
{
PVOID IoBase = NULL;
ULONG IoLength = pResDescriptor->u.Port.Length;
NTSTATUS Status = STATUS_SUCCESS;
DbgPrint(TRACE_LEVEL_INFORMATION, ("IO Port Info [%08I64X-%08I64X]\n",
pResDescriptor->u.Port.Start.QuadPart,
pResDescriptor->u.Port.Start.QuadPart +
pResDescriptor->u.Port.Length));
m_IoMapped = (pResDescriptor->Flags & CM_RESOURCE_PORT_IO) ? FALSE : TRUE;
if(m_IoMapped)
{
Status = pDxgkInterface->DxgkCbMapMemory(pDxgkInterface->DeviceHandle,
pResDescriptor->u.Port.Start,
IoLength,
TRUE, /* IN BOOLEAN InIoSpace */
FALSE, /* IN BOOLEAN MapToUserMode */
MmNonCached, /* IN MEMORY_CACHING_TYPE CacheType */
&IoBase /*OUT PVOID *VirtualAddress*/
);
if (Status == STATUS_SUCCESS)
{
m_IoBase = (PUCHAR)IoBase;
m_IoSize = IoLength;
}
else
{
DbgPrint(TRACE_LEVEL_INFORMATION, ("DxgkCbMapMemor failed with status 0x%X\n", Status));
}
}
else
{
m_IoBase = (PUCHAR)(ULONG_PTR)pResDescriptor->u.Port.Start.QuadPart;
m_IoSize = pResDescriptor->u.Port.Length;
}
DbgPrint(TRACE_LEVEL_INFORMATION, ("io_base [%X-%X]\n",
m_IoBase,
m_IoBase +
m_IoSize));
}
break;
case CmResourceTypeInterrupt:
DbgPrint(TRACE_LEVEL_VERBOSE, ("Interrupt level: 0x%0x, Vector: 0x%0x\n",
pResDescriptor->u.Interrupt.Level,
pResDescriptor->u.Interrupt.Vector));
break;
case CmResourceTypeMemory:
{
PVOID MemBase = NULL;
ULONG MemLength = pResDescriptor->u.Memory.Length;
NTSTATUS Status = STATUS_SUCCESS;
DbgPrint( TRACE_LEVEL_INFORMATION, ("Memory mapped: (%x:%x) Length:(%x)\n",
pResDescriptor->u.Memory.Start.LowPart,
pResDescriptor->u.Memory.Start.HighPart,
pResDescriptor->u.Memory.Length));
Status = pDxgkInterface->DxgkCbMapMemory(pDxgkInterface->DeviceHandle,
pResDescriptor->u.Memory.Start,
MemLength,
FALSE, /* IN BOOLEAN InIoSpace */
FALSE, /* IN BOOLEAN MapToUserMode */
MmNonCached, /* IN MEMORY_CACHING_TYPE CacheType */
&MemBase /*OUT PVOID *VirtualAddress*/
);
if (Status == STATUS_SUCCESS)
{
switch (pci_range)
{
case QXL_RAM_RANGE_INDEX:
m_RamPA = pResDescriptor->u.Memory.Start;
m_RamStart = (UINT8*)MemBase;
m_RamSize = MemLength;
pci_range = QXL_VRAM_RANGE_INDEX;
break;
case QXL_VRAM_RANGE_INDEX:
m_VRamPA = pResDescriptor->u.Memory.Start;
m_VRamStart = (UINT8*)MemBase;
m_VRamSize = MemLength;
pci_range = QXL_ROM_RANGE_INDEX;
break;
case QXL_ROM_RANGE_INDEX:
m_RomHdr = (QXLRom*)MemBase;
m_RomSize = MemLength;
pci_range = QXL_PCI_RANGES;
break;
default:
break;
}
}
}
break;
case CmResourceTypeDma:
DbgPrint( TRACE_LEVEL_INFORMATION, ("Dma\n"));
break;
case CmResourceTypeDeviceSpecific:
DbgPrint( TRACE_LEVEL_INFORMATION, ("Device Specific\n"));
break;
case CmResourceTypeBusNumber:
DbgPrint( TRACE_LEVEL_INFORMATION, ("Bus number\n"));
break;
default:
break;
}
}
}
if (m_IoBase == NULL || m_IoSize == 0 ||
m_RomHdr == NULL || m_RomSize == 0 ||
m_RamStart == NULL || m_RamSize == 0 ||
m_VRamStart == NULL || m_VRamSize == 0)
{
UnmapMemory();
return STATUS_UNSUCCESSFUL;
}
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
return STATUS_SUCCESS;
}
void QxlDevice::UnmapMemory(void)
{
PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterrface();
if (m_IoMapped && m_IoBase)
{
pDxgkInterface->DxgkCbUnmapMemory( pDxgkInterface->DeviceHandle, &m_IoBase);
}
m_IoBase = NULL;
if (m_RomHdr)
{
pDxgkInterface->DxgkCbUnmapMemory( pDxgkInterface->DeviceHandle, &m_RomHdr);
m_RomHdr = NULL;
}
if (m_RamStart)
{
pDxgkInterface->DxgkCbUnmapMemory( pDxgkInterface->DeviceHandle, &m_RamStart);
m_RamStart = NULL;
}
if (m_VRamStart)
{
pDxgkInterface->DxgkCbUnmapMemory( pDxgkInterface->DeviceHandle, &m_VRamStart);
m_VRamStart = NULL;
}
}
UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
{
switch (Format)
{
case D3DDDIFMT_UNKNOWN: return 0;
case D3DDDIFMT_P8: return 8;
case D3DDDIFMT_R5G6B5: return 16;
case D3DDDIFMT_R8G8B8: return 24;
case D3DDDIFMT_X8R8G8B8: // fall through
case D3DDDIFMT_A8R8G8B8: return 32;
default: QXL_LOG_ASSERTION1("Unknown D3DDDIFORMAT 0x%I64x", Format); return 0;
}
}
// Given bits per pixel, return the pixel format at the same bpp
D3DDDIFORMAT PixelFormatFromBPP(UINT BPP)
{
switch (BPP)
{
case 8: return D3DDDIFMT_P8;
case 16: return D3DDDIFMT_R5G6B5;
case 24: return D3DDDIFMT_R8G8B8;
case 32: return D3DDDIFMT_X8R8G8B8;
default: QXL_LOG_ASSERTION1("A bit per pixel of 0x%I64x is not supported.", BPP); return D3DDDIFMT_UNKNOWN;
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "baseobject.h"
#include "qxl_dev.h"
#define MAX_CHILDREN 1
#define MAX_VIEWS 1
@ -216,6 +217,7 @@ public:
virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0;
virtual NTSTATUS GetCurrentMode(ULONG* Mode) = 0;
virtual NTSTATUS SetPowerState(POWER_ACTION ActionType) = 0;
virtual NTSTATUS HWInit(PCM_RESOURCE_LIST pResList) = 0;
ULONG GetModeCount(void) {return m_ModeCount;}
PVBE_MODEINFO GetModeInfo(UINT idx) {return &m_ModeInfo[idx];}
USHORT GetModeNumber(USHORT idx) {return m_ModeNumbers[idx];}
@ -233,13 +235,14 @@ class VgaDevice :
public HwDeviceIntrface
{
public:
VgaDevice(_In_ QxlDod* pQxlDod){m_pQxlDod = pQxlDod;}
virtual ~VgaDevice(void){;}
VgaDevice(_In_ QxlDod* pQxlDod);
virtual ~VgaDevice(void);
NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo);
NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode);
NTSTATUS SetCurrentMode(ULONG Mode);
NTSTATUS GetCurrentMode(ULONG* Mode);
NTSTATUS SetPowerState(POWER_ACTION ActionType);
NTSTATUS HWInit(PCM_RESOURCE_LIST pResList);
};
class QxlDevice :
@ -253,6 +256,25 @@ public:
NTSTATUS SetCurrentMode(ULONG Mode);
NTSTATUS GetCurrentMode(ULONG* Mode);
NTSTATUS SetPowerState(POWER_ACTION ActionType);
NTSTATUS HWInit(PCM_RESOURCE_LIST pResList);
private:
void UnmapMemory(void);
private:
PUCHAR m_IoBase;
BOOLEAN m_IoMapped;
ULONG m_IoSize;
PHYSICAL_ADDRESS m_RamPA;
UINT8 *m_RamStart;
QXLRam *m_RamHdr;
ULONG m_RamSize;
PHYSICAL_ADDRESS m_VRamPA;
UINT8 *m_VRamStart;
ULONG m_VRamSize;
QXLRom *m_RomHdr;
ULONG m_RomSize;
};
class QxlDod :
@ -364,6 +386,7 @@ public:
_In_ UINT SourceStride,
_In_ INT PositionX,
_In_ INT PositionY);
PDXGKRNL_INTERFACE GetDxgkInterrface(void) { return &m_DxgkInterface;}
private:
VOID CleanUp(VOID);
NTSTATUS WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR pszwValueName, _In_ PCSTR pszValue);
@ -434,29 +457,5 @@ UnmapFrameBuffer(
_In_ ULONG Length);
UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
{
switch (Format)
{
case D3DDDIFMT_UNKNOWN: return 0;
case D3DDDIFMT_P8: return 8;
case D3DDDIFMT_R5G6B5: return 16;
case D3DDDIFMT_R8G8B8: return 24;
case D3DDDIFMT_X8R8G8B8: // fall through
case D3DDDIFMT_A8R8G8B8: return 32;
default: QXL_LOG_ASSERTION1("Unknown D3DDDIFORMAT 0x%I64x", Format); return 0;
}
}
// Given bits per pixel, return the pixel format at the same bpp
D3DDDIFORMAT PixelFormatFromBPP(UINT BPP)
{
switch (BPP)
{
case 8: return D3DDDIFMT_P8;
case 16: return D3DDDIFMT_R5G6B5;
case 24: return D3DDDIFMT_R8G8B8;
case 32: return D3DDDIFMT_X8R8G8B8;
default: QXL_LOG_ASSERTION1("A bit per pixel of 0x%I64x is not supported.", BPP); return D3DDDIFMT_UNKNOWN;
}
}
UINT BPPFromPixelFormat(D3DDDIFORMAT Format);
D3DDDIFORMAT PixelFormatFromBPP(UINT BPP);

55
qxldod/include/barrier.h Executable file
View File

@ -0,0 +1,55 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009 Red Hat, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _H_SPICE_BARRIER
#define _H_SPICE_BARRIER
#ifdef __GNUC__
#ifdef __i386__
#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
#else
//mfence
#define spice_mb() __asm__ __volatile__ ("lock; addl $0,0(%%rsp)": : :"memory")
#endif
#else
#ifdef _WIN64
//__asm not supported on _WIN64, so use macro instead.
#define spice_mb MemoryBarrier
#else
#define spice_mb() __asm {lock add [esp], 0}
#endif
#endif
#endif /* _H_SPICE_BARRIER */

38
qxldod/include/end-packed.h Executable file
View File

@ -0,0 +1,38 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009 Red Hat, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* See start-packed.h for details */
#undef SPICE_ATTR_PACKED
#if defined(__MINGW32__) || !defined(__GNUC__)
#pragma pack(pop)
#endif

613
qxldod/include/enums.h Executable file
View File

@ -0,0 +1,613 @@
/* this is a file autogenerated by spice_codegen.py */
#ifndef _H_SPICE_ENUMS
#define _H_SPICE_ENUMS
/* Generated from spice.proto, don't edit */
typedef enum SpiceLinkErr {
SPICE_LINK_ERR_OK,
SPICE_LINK_ERR_ERROR,
SPICE_LINK_ERR_INVALID_MAGIC,
SPICE_LINK_ERR_INVALID_DATA,
SPICE_LINK_ERR_VERSION_MISMATCH,
SPICE_LINK_ERR_NEED_SECURED,
SPICE_LINK_ERR_NEED_UNSECURED,
SPICE_LINK_ERR_PERMISSION_DENIED,
SPICE_LINK_ERR_BAD_CONNECTION_ID,
SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE,
SPICE_LINK_ERR_ENUM_END
} SpiceLinkErr;
typedef enum SpiceWarnCode {
SPICE_WARN_GENERAL,
SPICE_WARN_CODE_ENUM_END
} SpiceWarnCode;
typedef enum SpiceInfoCode {
SPICE_INFO_GENERAL,
SPICE_INFO_CODE_ENUM_END
} SpiceInfoCode;
typedef enum SpiceMigrateFlags {
SPICE_MIGRATE_NEED_FLUSH = (1 << 0),
SPICE_MIGRATE_NEED_DATA_TRANSFER = (1 << 1),
SPICE_MIGRATE_FLAGS_MASK = 0x3
} SpiceMigrateFlags;
typedef enum SpiceCompositeFlags {
SPICE_COMPOSITE_OP0 = (1 << 0),
SPICE_COMPOSITE_OP1 = (1 << 1),
SPICE_COMPOSITE_OP2 = (1 << 2),
SPICE_COMPOSITE_OP3 = (1 << 3),
SPICE_COMPOSITE_OP4 = (1 << 4),
SPICE_COMPOSITE_OP5 = (1 << 5),
SPICE_COMPOSITE_OP6 = (1 << 6),
SPICE_COMPOSITE_OP7 = (1 << 7),
SPICE_COMPOSITE_SRC_FILTER0 = (1 << 8),
SPICE_COMPOSITE_SRC_FILTER1 = (1 << 9),
SPICE_COMPOSITE_SRC_FILTER2 = (1 << 10),
SPICE_COMPOSITE_MASK_FILTER0 = (1 << 11),
SPICE_COMPOSITE_MASK_FITLER1 = (1 << 12),
SPICE_COMPOSITE_MASK_FILTER2 = (1 << 13),
SPICE_COMPOSITE_SRC_REPEAT0 = (1 << 14),
SPICE_COMPOSITE_SRC_REPEAT1 = (1 << 15),
SPICE_COMPOSITE_MASK_REPEAT0 = (1 << 16),
SPICE_COMPOSITE_MASK_REPEAT1 = (1 << 17),
SPICE_COMPOSITE_COMPONENT_ALPHA = (1 << 18),
SPICE_COMPOSITE_HAS_MASK = (1 << 19),
SPICE_COMPOSITE_HAS_SRC_TRANSFORM = (1 << 20),
SPICE_COMPOSITE_HAS_MASK_TRANSFORM = (1 << 21),
SPICE_COMPOSITE_SOURCE_OPAQUE = (1 << 22),
SPICE_COMPOSITE_MASK_OPAQUE = (1 << 23),
SPICE_COMPOSITE_DEST_OPAQUE = (1 << 24),
SPICE_COMPOSITE_FLAGS_MASK = 0x1ffffff
} SpiceCompositeFlags;
typedef enum SpiceNotifySeverity {
SPICE_NOTIFY_SEVERITY_INFO,
SPICE_NOTIFY_SEVERITY_WARN,
SPICE_NOTIFY_SEVERITY_ERROR,
SPICE_NOTIFY_SEVERITY_ENUM_END
} SpiceNotifySeverity;
typedef enum SpiceNotifyVisibility {
SPICE_NOTIFY_VISIBILITY_LOW,
SPICE_NOTIFY_VISIBILITY_MEDIUM,
SPICE_NOTIFY_VISIBILITY_HIGH,
SPICE_NOTIFY_VISIBILITY_ENUM_END
} SpiceNotifyVisibility;
typedef enum SpiceMouseMode {
SPICE_MOUSE_MODE_SERVER = (1 << 0),
SPICE_MOUSE_MODE_CLIENT = (1 << 1),
SPICE_MOUSE_MODE_MASK = 0x3
} SpiceMouseMode;
typedef enum SpicePubkeyType {
SPICE_PUBKEY_TYPE_INVALID,
SPICE_PUBKEY_TYPE_RSA,
SPICE_PUBKEY_TYPE_RSA2,
SPICE_PUBKEY_TYPE_DSA,
SPICE_PUBKEY_TYPE_DSA1,
SPICE_PUBKEY_TYPE_DSA2,
SPICE_PUBKEY_TYPE_DSA3,
SPICE_PUBKEY_TYPE_DSA4,
SPICE_PUBKEY_TYPE_DH,
SPICE_PUBKEY_TYPE_EC,
SPICE_PUBKEY_TYPE_ENUM_END
} SpicePubkeyType;
typedef enum SpiceClipType {
SPICE_CLIP_TYPE_NONE,
SPICE_CLIP_TYPE_RECTS,
SPICE_CLIP_TYPE_ENUM_END
} SpiceClipType;
typedef enum SpicePathFlags {
SPICE_PATH_BEGIN = (1 << 0),
SPICE_PATH_END = (1 << 1),
SPICE_PATH_CLOSE = (1 << 3),
SPICE_PATH_BEZIER = (1 << 4),
SPICE_PATH_FLAGS_MASK = 0x1b
} SpicePathFlags;
typedef enum SpiceVideoCodecType {
SPICE_VIDEO_CODEC_TYPE_MJPEG = 1,
SPICE_VIDEO_CODEC_TYPE_ENUM_END
} SpiceVideoCodecType;
typedef enum SpiceStreamFlags {
SPICE_STREAM_FLAGS_TOP_DOWN = (1 << 0),
SPICE_STREAM_FLAGS_MASK = 0x1
} SpiceStreamFlags;
typedef enum SpiceBrushType {
SPICE_BRUSH_TYPE_NONE,
SPICE_BRUSH_TYPE_SOLID,
SPICE_BRUSH_TYPE_PATTERN,
SPICE_BRUSH_TYPE_ENUM_END
} SpiceBrushType;
typedef enum SpiceMaskFlags {
SPICE_MASK_FLAGS_INVERS = (1 << 0),
SPICE_MASK_FLAGS_MASK = 0x1
} SpiceMaskFlags;
typedef enum SpiceImageType {
SPICE_IMAGE_TYPE_BITMAP,
SPICE_IMAGE_TYPE_QUIC,
SPICE_IMAGE_TYPE_RESERVED,
SPICE_IMAGE_TYPE_LZ_PLT = 100,
SPICE_IMAGE_TYPE_LZ_RGB,
SPICE_IMAGE_TYPE_GLZ_RGB,
SPICE_IMAGE_TYPE_FROM_CACHE,
SPICE_IMAGE_TYPE_SURFACE,
SPICE_IMAGE_TYPE_JPEG,
SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS,
SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB,
SPICE_IMAGE_TYPE_JPEG_ALPHA,
SPICE_IMAGE_TYPE_ENUM_END
} SpiceImageType;
typedef enum SpiceImageFlags {
SPICE_IMAGE_FLAGS_CACHE_ME = (1 << 0),
SPICE_IMAGE_FLAGS_HIGH_BITS_SET = (1 << 1),
SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME = (1 << 2),
SPICE_IMAGE_FLAGS_MASK = 0x7
} SpiceImageFlags;
typedef enum SpiceBitmapFmt {
SPICE_BITMAP_FMT_INVALID,
SPICE_BITMAP_FMT_1BIT_LE,
SPICE_BITMAP_FMT_1BIT_BE,
SPICE_BITMAP_FMT_4BIT_LE,
SPICE_BITMAP_FMT_4BIT_BE,
SPICE_BITMAP_FMT_8BIT,
SPICE_BITMAP_FMT_16BIT,
SPICE_BITMAP_FMT_24BIT,
SPICE_BITMAP_FMT_32BIT,
SPICE_BITMAP_FMT_RGBA,
SPICE_BITMAP_FMT_8BIT_A,
SPICE_BITMAP_FMT_ENUM_END
} SpiceBitmapFmt;
typedef enum SpiceBitmapFlags {
SPICE_BITMAP_FLAGS_PAL_CACHE_ME = (1 << 0),
SPICE_BITMAP_FLAGS_PAL_FROM_CACHE = (1 << 1),
SPICE_BITMAP_FLAGS_TOP_DOWN = (1 << 2),
SPICE_BITMAP_FLAGS_MASK = 0x7
} SpiceBitmapFlags;
typedef enum SpiceJpegAlphaFlags {
SPICE_JPEG_ALPHA_FLAGS_TOP_DOWN = (1 << 0),
SPICE_JPEG_ALPHA_FLAGS_MASK = 0x1
} SpiceJpegAlphaFlags;
typedef enum SpiceImageScaleMode {
SPICE_IMAGE_SCALE_MODE_INTERPOLATE,
SPICE_IMAGE_SCALE_MODE_NEAREST,
SPICE_IMAGE_SCALE_MODE_ENUM_END
} SpiceImageScaleMode;
typedef enum SpiceRopd {
SPICE_ROPD_INVERS_SRC = (1 << 0),
SPICE_ROPD_INVERS_BRUSH = (1 << 1),
SPICE_ROPD_INVERS_DEST = (1 << 2),
SPICE_ROPD_OP_PUT = (1 << 3),
SPICE_ROPD_OP_OR = (1 << 4),
SPICE_ROPD_OP_AND = (1 << 5),
SPICE_ROPD_OP_XOR = (1 << 6),
SPICE_ROPD_OP_BLACKNESS = (1 << 7),
SPICE_ROPD_OP_WHITENESS = (1 << 8),
SPICE_ROPD_OP_INVERS = (1 << 9),
SPICE_ROPD_INVERS_RES = (1 << 10),
SPICE_ROPD_MASK = 0x7ff
} SpiceRopd;
typedef enum SpiceLineFlags {
SPICE_LINE_FLAGS_START_WITH_GAP = (1 << 2),
SPICE_LINE_FLAGS_STYLED = (1 << 3),
SPICE_LINE_FLAGS_MASK = 0xc
} SpiceLineFlags;
typedef enum SpiceStringFlags {
SPICE_STRING_FLAGS_RASTER_A1 = (1 << 0),
SPICE_STRING_FLAGS_RASTER_A4 = (1 << 1),
SPICE_STRING_FLAGS_RASTER_A8 = (1 << 2),
SPICE_STRING_FLAGS_RASTER_TOP_DOWN = (1 << 3),
SPICE_STRING_FLAGS_MASK = 0xf
} SpiceStringFlags;
typedef enum SpiceSurfaceFlags {
SPICE_SURFACE_FLAGS_PRIMARY = (1 << 0),
SPICE_SURFACE_FLAGS_MASK = 0x1
} SpiceSurfaceFlags;
typedef enum SpiceSurfaceFmt {
SPICE_SURFACE_FMT_INVALID,
SPICE_SURFACE_FMT_1_A,
SPICE_SURFACE_FMT_8_A = 8,
SPICE_SURFACE_FMT_16_555 = 16,
SPICE_SURFACE_FMT_32_xRGB = 32,
SPICE_SURFACE_FMT_16_565 = 80,
SPICE_SURFACE_FMT_32_ARGB = 96,
SPICE_SURFACE_FMT_ENUM_END
} SpiceSurfaceFmt;
typedef enum SpiceAlphaFlags {
SPICE_ALPHA_FLAGS_DEST_HAS_ALPHA = (1 << 0),
SPICE_ALPHA_FLAGS_SRC_SURFACE_HAS_ALPHA = (1 << 1),
SPICE_ALPHA_FLAGS_MASK = 0x3
} SpiceAlphaFlags;
typedef enum SpiceResourceType {
SPICE_RES_TYPE_INVALID,
SPICE_RES_TYPE_PIXMAP,
SPICE_RESOURCE_TYPE_ENUM_END
} SpiceResourceType;
typedef enum SpiceKeyboardModifierFlags {
SPICE_KEYBOARD_MODIFIER_FLAGS_SCROLL_LOCK = (1 << 0),
SPICE_KEYBOARD_MODIFIER_FLAGS_NUM_LOCK = (1 << 1),
SPICE_KEYBOARD_MODIFIER_FLAGS_CAPS_LOCK = (1 << 2),
SPICE_KEYBOARD_MODIFIER_FLAGS_MASK = 0x7
} SpiceKeyboardModifierFlags;
typedef enum SpiceMouseButton {
SPICE_MOUSE_BUTTON_INVALID,
SPICE_MOUSE_BUTTON_LEFT,
SPICE_MOUSE_BUTTON_MIDDLE,
SPICE_MOUSE_BUTTON_RIGHT,
SPICE_MOUSE_BUTTON_UP,
SPICE_MOUSE_BUTTON_DOWN,
SPICE_MOUSE_BUTTON_ENUM_END
} SpiceMouseButton;
typedef enum SpiceMouseButtonMask {
SPICE_MOUSE_BUTTON_MASK_LEFT = (1 << 0),
SPICE_MOUSE_BUTTON_MASK_MIDDLE = (1 << 1),
SPICE_MOUSE_BUTTON_MASK_RIGHT = (1 << 2),
SPICE_MOUSE_BUTTON_MASK_MASK = 0x7
} SpiceMouseButtonMask;
typedef enum SpiceCursorType {
SPICE_CURSOR_TYPE_ALPHA,
SPICE_CURSOR_TYPE_MONO,
SPICE_CURSOR_TYPE_COLOR4,
SPICE_CURSOR_TYPE_COLOR8,
SPICE_CURSOR_TYPE_COLOR16,
SPICE_CURSOR_TYPE_COLOR24,
SPICE_CURSOR_TYPE_COLOR32,
SPICE_CURSOR_TYPE_ENUM_END
} SpiceCursorType;
typedef enum SpiceCursorFlags {
SPICE_CURSOR_FLAGS_NONE = (1 << 0),
SPICE_CURSOR_FLAGS_CACHE_ME = (1 << 1),
SPICE_CURSOR_FLAGS_FROM_CACHE = (1 << 2),
SPICE_CURSOR_FLAGS_MASK = 0x7
} SpiceCursorFlags;
typedef enum SpiceAudioDataMode {
SPICE_AUDIO_DATA_MODE_INVALID,
SPICE_AUDIO_DATA_MODE_RAW,
SPICE_AUDIO_DATA_MODE_CELT_0_5_1,
SPICE_AUDIO_DATA_MODE_ENUM_END
} SpiceAudioDataMode;
typedef enum SpiceAudioFmt {
SPICE_AUDIO_FMT_INVALID,
SPICE_AUDIO_FMT_S16,
SPICE_AUDIO_FMT_ENUM_END
} SpiceAudioFmt;
typedef enum SpiceTunnelServiceType {
SPICE_TUNNEL_SERVICE_TYPE_INVALID,
SPICE_TUNNEL_SERVICE_TYPE_GENERIC,
SPICE_TUNNEL_SERVICE_TYPE_IPP,
SPICE_TUNNEL_SERVICE_TYPE_ENUM_END
} SpiceTunnelServiceType;
typedef enum SpiceTunnelIpType {
SPICE_TUNNEL_IP_TYPE_INVALID,
SPICE_TUNNEL_IP_TYPE_IPv4,
SPICE_TUNNEL_IP_TYPE_ENUM_END
} SpiceTunnelIpType;
typedef enum SpiceVscMessageType {
SPICE_VSC_MESSAGE_TYPE_Init = 1,
SPICE_VSC_MESSAGE_TYPE_Error,
SPICE_VSC_MESSAGE_TYPE_ReaderAdd,
SPICE_VSC_MESSAGE_TYPE_ReaderRemove,
SPICE_VSC_MESSAGE_TYPE_ATR,
SPICE_VSC_MESSAGE_TYPE_CardRemove,
SPICE_VSC_MESSAGE_TYPE_APDU,
SPICE_VSC_MESSAGE_TYPE_Flush,
SPICE_VSC_MESSAGE_TYPE_FlushComplete,
SPICE_VSC_MESSAGE_TYPE_ENUM_END
} SpiceVscMessageType;
enum {
SPICE_CHANNEL_MAIN = 1,
SPICE_CHANNEL_DISPLAY,
SPICE_CHANNEL_INPUTS,
SPICE_CHANNEL_CURSOR,
SPICE_CHANNEL_PLAYBACK,
SPICE_CHANNEL_RECORD,
SPICE_CHANNEL_TUNNEL,
SPICE_CHANNEL_SMARTCARD,
SPICE_CHANNEL_USBREDIR,
SPICE_CHANNEL_PORT,
SPICE_END_CHANNEL
};
enum {
SPICE_MSG_MIGRATE = 1,
SPICE_MSG_MIGRATE_DATA,
SPICE_MSG_SET_ACK,
SPICE_MSG_PING,
SPICE_MSG_WAIT_FOR_CHANNELS,
SPICE_MSG_DISCONNECTING,
SPICE_MSG_NOTIFY,
SPICE_MSG_LIST,
};
enum {
SPICE_MSGC_ACK_SYNC = 1,
SPICE_MSGC_ACK,
SPICE_MSGC_PONG,
SPICE_MSGC_MIGRATE_FLUSH_MARK,
SPICE_MSGC_MIGRATE_DATA,
SPICE_MSGC_DISCONNECTING,
};
enum {
SPICE_MSG_MAIN_MIGRATE_BEGIN = 101,
SPICE_MSG_MAIN_MIGRATE_CANCEL,
SPICE_MSG_MAIN_INIT,
SPICE_MSG_MAIN_CHANNELS_LIST,
SPICE_MSG_MAIN_MOUSE_MODE,
SPICE_MSG_MAIN_MULTI_MEDIA_TIME,
SPICE_MSG_MAIN_AGENT_CONNECTED,
SPICE_MSG_MAIN_AGENT_DISCONNECTED,
SPICE_MSG_MAIN_AGENT_DATA,
SPICE_MSG_MAIN_AGENT_TOKEN,
SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST,
SPICE_MSG_MAIN_MIGRATE_END,
SPICE_MSG_MAIN_NAME,
SPICE_MSG_MAIN_UUID,
SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS,
SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS,
SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK,
SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK,
SPICE_MSG_END_MAIN
};
enum {
SPICE_MSGC_MAIN_CLIENT_INFO = 101,
SPICE_MSGC_MAIN_MIGRATE_CONNECTED,
SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR,
SPICE_MSGC_MAIN_ATTACH_CHANNELS,
SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,
SPICE_MSGC_MAIN_AGENT_START,
SPICE_MSGC_MAIN_AGENT_DATA,
SPICE_MSGC_MAIN_AGENT_TOKEN,
SPICE_MSGC_MAIN_MIGRATE_END,
SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS,
SPICE_MSGC_MAIN_MIGRATE_CONNECTED_SEAMLESS,
SPICE_MSGC_END_MAIN
};
enum {
SPICE_MSG_DISPLAY_MODE = 101,
SPICE_MSG_DISPLAY_MARK,
SPICE_MSG_DISPLAY_RESET,
SPICE_MSG_DISPLAY_COPY_BITS,
SPICE_MSG_DISPLAY_INVAL_LIST,
SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS,
SPICE_MSG_DISPLAY_INVAL_PALETTE,
SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES,
SPICE_MSG_DISPLAY_STREAM_CREATE = 122,
SPICE_MSG_DISPLAY_STREAM_DATA,
SPICE_MSG_DISPLAY_STREAM_CLIP,
SPICE_MSG_DISPLAY_STREAM_DESTROY,
SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL,
SPICE_MSG_DISPLAY_DRAW_FILL = 302,
SPICE_MSG_DISPLAY_DRAW_OPAQUE,
SPICE_MSG_DISPLAY_DRAW_COPY,
SPICE_MSG_DISPLAY_DRAW_BLEND,
SPICE_MSG_DISPLAY_DRAW_BLACKNESS,
SPICE_MSG_DISPLAY_DRAW_WHITENESS,
SPICE_MSG_DISPLAY_DRAW_INVERS,
SPICE_MSG_DISPLAY_DRAW_ROP3,
SPICE_MSG_DISPLAY_DRAW_STROKE,
SPICE_MSG_DISPLAY_DRAW_TEXT,
SPICE_MSG_DISPLAY_DRAW_TRANSPARENT,
SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND,
SPICE_MSG_DISPLAY_SURFACE_CREATE,
SPICE_MSG_DISPLAY_SURFACE_DESTROY,
SPICE_MSG_DISPLAY_STREAM_DATA_SIZED,
SPICE_MSG_DISPLAY_MONITORS_CONFIG,
SPICE_MSG_DISPLAY_DRAW_COMPOSITE,
SPICE_MSG_END_DISPLAY
};
enum {
SPICE_MSGC_DISPLAY_INIT = 101,
SPICE_MSGC_END_DISPLAY
};
enum {
SPICE_MSG_INPUTS_INIT = 101,
SPICE_MSG_INPUTS_KEY_MODIFIERS,
SPICE_MSG_INPUTS_MOUSE_MOTION_ACK = 111,
SPICE_MSG_END_INPUTS
};
enum {
SPICE_MSGC_INPUTS_KEY_DOWN = 101,
SPICE_MSGC_INPUTS_KEY_UP,
SPICE_MSGC_INPUTS_KEY_MODIFIERS,
SPICE_MSGC_INPUTS_KEY_SCANCODE,
SPICE_MSGC_INPUTS_MOUSE_MOTION = 111,
SPICE_MSGC_INPUTS_MOUSE_POSITION,
SPICE_MSGC_INPUTS_MOUSE_PRESS,
SPICE_MSGC_INPUTS_MOUSE_RELEASE,
SPICE_MSGC_END_INPUTS
};
enum {
SPICE_MSG_CURSOR_INIT = 101,
SPICE_MSG_CURSOR_RESET,
SPICE_MSG_CURSOR_SET,
SPICE_MSG_CURSOR_MOVE,
SPICE_MSG_CURSOR_HIDE,
SPICE_MSG_CURSOR_TRAIL,
SPICE_MSG_CURSOR_INVAL_ONE,
SPICE_MSG_CURSOR_INVAL_ALL,
SPICE_MSG_END_CURSOR
};
enum {
SPICE_MSG_PLAYBACK_DATA = 101,
SPICE_MSG_PLAYBACK_MODE,
SPICE_MSG_PLAYBACK_START,
SPICE_MSG_PLAYBACK_STOP,
SPICE_MSG_PLAYBACK_VOLUME,
SPICE_MSG_PLAYBACK_MUTE,
SPICE_MSG_END_PLAYBACK
};
enum {
SPICE_MSG_RECORD_START = 101,
SPICE_MSG_RECORD_STOP,
SPICE_MSG_RECORD_VOLUME,
SPICE_MSG_RECORD_MUTE,
SPICE_MSG_END_RECORD
};
enum {
SPICE_MSGC_RECORD_DATA = 101,
SPICE_MSGC_RECORD_MODE,
SPICE_MSGC_RECORD_START_MARK,
SPICE_MSGC_END_RECORD
};
enum {
SPICE_MSG_TUNNEL_INIT = 101,
SPICE_MSG_TUNNEL_SERVICE_IP_MAP,
SPICE_MSG_TUNNEL_SOCKET_OPEN,
SPICE_MSG_TUNNEL_SOCKET_FIN,
SPICE_MSG_TUNNEL_SOCKET_CLOSE,
SPICE_MSG_TUNNEL_SOCKET_DATA,
SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK,
SPICE_MSG_TUNNEL_SOCKET_TOKEN,
SPICE_MSG_END_TUNNEL
};
enum {
SPICE_MSGC_TUNNEL_SERVICE_ADD = 101,
SPICE_MSGC_TUNNEL_SERVICE_REMOVE,
SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK,
SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK,
SPICE_MSGC_TUNNEL_SOCKET_FIN,
SPICE_MSGC_TUNNEL_SOCKET_CLOSED,
SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK,
SPICE_MSGC_TUNNEL_SOCKET_DATA,
SPICE_MSGC_TUNNEL_SOCKET_TOKEN,
SPICE_MSGC_END_TUNNEL
};
enum {
SPICE_MSG_SMARTCARD_DATA = 101,
SPICE_MSG_END_SMARTCARD
};
enum {
SPICE_MSGC_SMARTCARD_DATA = 101,
SPICE_MSGC_SMARTCARD_HEADER = 101,
SPICE_MSGC_SMARTCARD_ERROR = 101,
SPICE_MSGC_SMARTCARD_ATR = 101,
SPICE_MSGC_SMARTCARD_READER_ADD = 101,
SPICE_MSGC_END_SMARTCARD
};
enum {
SPICE_MSG_SPICEVMC_DATA = 101,
SPICE_MSG_END_SPICEVMC
};
enum {
SPICE_MSGC_SPICEVMC_DATA = 101,
SPICE_MSGC_END_SPICEVMC
};
enum {
SPICE_MSG_PORT_INIT = 201,
SPICE_MSG_PORT_EVENT,
SPICE_MSG_END_PORT
};
enum {
SPICE_MSGC_PORT_EVENT = 201,
SPICE_MSGC_END_PORT
};
#endif /* _H_SPICE_ENUMS */

136
qxldod/include/ipc_ring.h Executable file
View File

@ -0,0 +1,136 @@
/*
Copyright (C) 2009 Red Hat, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _H_SPICE_RING
#define _H_SPICE_RING
#include <include/types.h>
#define _SPICE_MSB_MASK4(x) \
(((x) & 0x8) ? 0x8 : \
((x) & 0x4) ? 0x4 : \
((x) & 0x2) ? 0x2 : \
((x) & 0x1) ? 0x1 : 0)
#define _SPICE_MSB_MASK8(x) \
(((x) & 0xf0) ? _SPICE_MSB_MASK4((x) >> 4) << 4 : _SPICE_MSB_MASK4(x))
#define _SPICE_MSB_MASK16(x) \
(((x) & 0xff00) ? _SPICE_MSB_MASK8((x) >> 8) << 8 : _SPICE_MSB_MASK8(x))
#define _SPICE_MSB_MASK(x) \
(((x) & 0xffff0000) ? _SPICE_MSB_MASK16((x) >> 16) << 16 : _SPICE_MSB_MASK16(x))
#define _SPICE_POWER2_ALIGN(x) _SPICE_MSB_MASK((x) * 2 - 1)
#define _SPICE_TOSHIFT_4(x) \
(((x) & 0x8) ? 3 : \
((x) & 0x4) ? 2 : \
((x) & 0x2) ? 1 : 0)
#define _SPICE_TOSHIFT_8(x) \
(((x) & 0xf0) ? _SPICE_TOSHIFT_4((x) >> 4) + 4 : _SPICE_TOSHIFT_4(x))
#define _SPICE_TOSHIFT_16(x) \
(((x) & 0xff00) ? _SPICE_TOSHIFT_8((x) >> 8) + 8 : _SPICE_TOSHIFT_8(x))
#define _SPICE_POWER2_TO_SHIFT(x) \
(((x) & 0xffff0000) ? _SPICE_TOSHIFT_16((x) >> 16) + 16 : _SPICE_TOSHIFT_16(x))
#define SPICE_RING_DECLARE(name, el_type, size) \
typedef struct SPICE_ATTR_PACKED name##_ring_el { \
union { \
el_type el; \
uint8_t data[_SPICE_POWER2_ALIGN(sizeof(el_type))]; \
} ; \
} name##_ring_el; \
\
typedef struct SPICE_ATTR_PACKED name { \
uint32_t num_items; \
uint32_t prod; \
uint32_t notify_on_prod; \
uint32_t cons; \
uint32_t notify_on_cons; \
name##_ring_el items[_SPICE_POWER2_ALIGN(size)]; \
} name;
#define SPICE_RING_INIT(r) \
(r)->num_items = sizeof((r)->items) >> \
_SPICE_POWER2_TO_SHIFT(sizeof((r)->items[0])); \
(r)->prod = (r)->cons = 0; \
(r)->notify_on_prod = 1; \
(r)->notify_on_cons = 0;
#define SPICE_RING_INDEX_MASK(r) ((r)->num_items - 1)
#define SPICE_RING_IS_PACKED(r) (sizeof((r)->items[0]) == sizeof((r)->items[0]).el)
#define SPICE_RING_IS_EMPTY(r) ((r)->cons == (r)->prod)
#define SPICE_RING_IS_FULL(r) (((r)->prod - (r)->cons) == (r)->num_items)
#define SPICE_RING_PROD_ITEM(r) (&(r)->items[(r)->prod & SPICE_RING_INDEX_MASK(r)].el)
#define SPICE_RING_PROD_WAIT(r, wait) \
if (((wait) = SPICE_RING_IS_FULL(r))) { \
(r)->notify_on_cons = (r)->cons + 1; \
spice_mb(); \
(wait) = SPICE_RING_IS_FULL(r); \
}
#define SPICE_RING_PUSH(r, notify) \
(r)->prod++; \
spice_mb(); \
(notify) = ((r)->prod == (r)->notify_on_prod);
#define SPICE_RING_CONS_ITEM(r) (&(r)->items[(r)->cons & SPICE_RING_INDEX_MASK(r)].el)
#define SPICE_RING_CONS_WAIT(r, wait) \
if (((wait) = SPICE_RING_IS_EMPTY(r))) { \
(r)->notify_on_prod = (r)->prod + 1; \
spice_mb(); \
(wait) = SPICE_RING_IS_EMPTY(r); \
}
#define SPICE_RING_POP(r, notify) \
(r)->cons++; \
spice_mb(); \
(notify) = ((r)->cons == (r)->notify_on_cons);
#endif /* _H_SPICE_RING */

808
qxldod/include/qxl_dev.h Executable file
View File

@ -0,0 +1,808 @@
/*
Copyright (C) 2009 Red Hat, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _H_QXL_DEV
#define _H_QXL_DEV
//#include <spice/types.h>
#include "barrier.h"
#include "ipc_ring.h"
#include "enums.h"
//
#include "start-packed.h"
#include "stdint.h"
#define CopyRectPoint(dest, src, width, height) \
(dest)->left = (src)->x; \
(dest)->right = (src)->x + width; \
(dest)->top = (src)->y; \
(dest)->bottom = (src)->y + height;
#define CopyRect(dest, src) \
(dest)->top = (src)->top; \
(dest)->left = (src)->left; \
(dest)->bottom = (src)->bottom; \
(dest)->right = (src)->right;
#define CopyPoint(dest, src) \
(dest)->x = (src)->x; \
(dest)->y = (src)->y;
#define REDHAT_PCI_VENDOR_ID 0x1b36
/* 0x100-0x11f reserved for spice, 0x1ff used for unstable work */
#define QXL_DEVICE_ID_STABLE 0x0100
enum {
QXL_REVISION_STABLE_V04=0x01,
QXL_REVISION_STABLE_V06=0x02,
QXL_REVISION_STABLE_V10=0x03,
QXL_REVISION_STABLE_V12=0x04,
};
#define QXL_DEVICE_ID_DEVEL 0x01ff
#define QXL_REVISION_DEVEL 0x01
#define QXL_ROM_MAGIC (*(const uint32_t*)"QXRO")
#define QXL_RAM_MAGIC (*(const uint32_t*)"QXRA")
enum {
QXL_RAM_RANGE_INDEX,
QXL_VRAM_RANGE_INDEX,
QXL_ROM_RANGE_INDEX,
QXL_IO_RANGE_INDEX,
QXL_PCI_RANGES
};
/* qxl-1 compat: append only */
enum {
QXL_IO_NOTIFY_CMD,
QXL_IO_NOTIFY_CURSOR,
QXL_IO_UPDATE_AREA,
QXL_IO_UPDATE_IRQ,
QXL_IO_NOTIFY_OOM,
QXL_IO_RESET,
QXL_IO_SET_MODE, /* qxl-1 */
QXL_IO_LOG,
/* appended for qxl-2 */
QXL_IO_MEMSLOT_ADD,
QXL_IO_MEMSLOT_DEL,
QXL_IO_DETACH_PRIMARY,
QXL_IO_ATTACH_PRIMARY,
QXL_IO_CREATE_PRIMARY,
QXL_IO_DESTROY_PRIMARY,
QXL_IO_DESTROY_SURFACE_WAIT,
QXL_IO_DESTROY_ALL_SURFACES,
/* appended for qxl-3 */
QXL_IO_UPDATE_AREA_ASYNC,
QXL_IO_MEMSLOT_ADD_ASYNC,
QXL_IO_CREATE_PRIMARY_ASYNC,
QXL_IO_DESTROY_PRIMARY_ASYNC,
QXL_IO_DESTROY_SURFACE_ASYNC,
QXL_IO_DESTROY_ALL_SURFACES_ASYNC,
QXL_IO_FLUSH_SURFACES_ASYNC,
QXL_IO_FLUSH_RELEASE,
/* appended for qxl-4 */
QXL_IO_MONITORS_CONFIG_ASYNC,
QXL_IO_RANGE_SIZE
};
typedef uint64_t QXLPHYSICAL;
typedef int32_t QXLFIXED; //fixed 28.4
//typedef struct SPICE_ATTR_PACKED QXLPointFix {
typedef struct SPICE_ATTR_PACKED QXLPointFix {
QXLFIXED x;
QXLFIXED y;
} QXLPointFix;
typedef struct SPICE_ATTR_PACKED QXLPoint {
int32_t x;
int32_t y;
} QXLPoint;
typedef struct SPICE_ATTR_PACKED QXLPoint16 {
int16_t x;
int16_t y;
} QXLPoint16;
typedef struct SPICE_ATTR_PACKED QXLRect {
int32_t top;
int32_t left;
int32_t bottom;
int32_t right;
} QXLRect;
typedef struct SPICE_ATTR_PACKED QXLURect {
uint32_t top;
uint32_t left;
uint32_t bottom;
uint32_t right;
} QXLURect;
/* qxl-1 compat: append only */
typedef struct SPICE_ATTR_PACKED QXLRom {
uint32_t magic;
uint32_t id;
uint32_t update_id;
uint32_t compression_level;
uint32_t log_level;
uint32_t mode; /* qxl-1 */
uint32_t modes_offset;
uint32_t num_pages;
uint32_t pages_offset; /* qxl-1 */
uint32_t draw_area_offset; /* qxl-1 */
uint32_t surface0_area_size; /* qxl-1 name: draw_area_size */
uint32_t ram_header_offset;
uint32_t mm_clock;
/* appended for qxl-2 */
uint32_t n_surfaces;
uint64_t flags;
uint8_t slots_start;
uint8_t slots_end;
uint8_t slot_gen_bits;
uint8_t slot_id_bits;
uint8_t slot_generation;
/* appended for qxl-4 */
uint8_t client_present;
uint8_t client_capabilities[58];
uint32_t client_monitors_config_crc;
struct {
uint16_t count;
uint16_t padding;
QXLURect heads[64];
} client_monitors_config;
} QXLRom;
#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
/* qxl-1 compat: fixed */
typedef struct SPICE_ATTR_PACKED QXLMode {
uint32_t id;
uint32_t x_res;
uint32_t y_res;
uint32_t bits;
uint32_t stride;
uint32_t x_mili;
uint32_t y_mili;
uint32_t orientation;
} QXLMode;
/* qxl-1 compat: fixed */
typedef struct SPICE_ATTR_PACKED QXLModes {
uint32_t n_modes;
QXLMode modes[0];
} QXLModes;
/* qxl-1 compat: append only */
typedef enum QXLCmdType {
QXL_CMD_NOP,
QXL_CMD_DRAW,
QXL_CMD_UPDATE,
QXL_CMD_CURSOR,
QXL_CMD_MESSAGE,
QXL_CMD_SURFACE,
} QXLCmdType;
/* qxl-1 compat: fixed */
typedef struct SPICE_ATTR_PACKED QXLCommand {
QXLPHYSICAL data;
uint32_t type;
uint32_t padding;
} QXLCommand;
#define QXL_COMMAND_FLAG_COMPAT (1<<0)
#define QXL_COMMAND_FLAG_COMPAT_16BPP (2<<0)
typedef struct SPICE_ATTR_PACKED QXLCommandExt {
QXLCommand cmd;
uint32_t group_id;
uint32_t flags;
} QXLCommandExt;
typedef struct SPICE_ATTR_PACKED QXLMemSlot {
uint64_t mem_start;
uint64_t mem_end;
} QXLMemSlot;
#define QXL_SURF_TYPE_PRIMARY 0
#define QXL_SURF_FLAG_KEEP_DATA (1 << 0)
typedef struct SPICE_ATTR_PACKED QXLSurfaceCreate {
uint32_t width;
uint32_t height;
int32_t stride;
uint32_t format;
uint32_t position;
uint32_t mouse_mode;
uint32_t flags;
uint32_t type;
QXLPHYSICAL mem;
} QXLSurfaceCreate;
#define QXL_COMMAND_RING_SIZE 32
#define QXL_CURSOR_RING_SIZE 32
#define QXL_RELEASE_RING_SIZE 8
SPICE_RING_DECLARE(QXLCommandRing, QXLCommand, QXL_COMMAND_RING_SIZE);
SPICE_RING_DECLARE(QXLCursorRing, QXLCommand, QXL_CURSOR_RING_SIZE);
SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, QXL_RELEASE_RING_SIZE);
#define QXL_LOG_BUF_SIZE 4096
#define QXL_INTERRUPT_DISPLAY (1 << 0)
#define QXL_INTERRUPT_CURSOR (1 << 1)
#define QXL_INTERRUPT_IO_CMD (1 << 2)
#define QXL_INTERRUPT_ERROR (1 << 3)
#define QXL_INTERRUPT_CLIENT (1 << 4)
#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG (1 << 5)
#define QXL_INTERRUPT_MASK (\
QXL_INTERRUPT_DISPLAY |\
QXL_INTERRUPT_CURSOR |\
QXL_INTERRUPT_IO_CMD |\
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG)
/* qxl-1 compat: append only */
typedef struct SPICE_ATTR_PACKED QXLRam {
uint32_t magic;
uint32_t int_pending;
uint32_t int_mask;
uint8_t log_buf[QXL_LOG_BUF_SIZE];
QXLCommandRing cmd_ring;
QXLCursorRing cursor_ring;
QXLReleaseRing release_ring;
QXLRect update_area;
/* appended for qxl-2 */
uint32_t update_surface;
QXLMemSlot mem_slot;
QXLSurfaceCreate create_surface;
uint64_t flags;
/* appended for qxl-4 */
/* used by QXL_IO_MONITORS_CONFIG_ASYNC */
QXLPHYSICAL monitors_config;
} QXLRam;
typedef union QXLReleaseInfo {
uint64_t id; // in
uint64_t next; // out
} QXLReleaseInfo;
typedef struct QXLReleaseInfoExt {
QXLReleaseInfo *info;
uint32_t group_id;
} QXLReleaseInfoExt;
typedef struct SPICE_ATTR_PACKED QXLDataChunk {
uint32_t data_size;
QXLPHYSICAL prev_chunk;
QXLPHYSICAL next_chunk;
uint8_t data[0];
} QXLDataChunk;
typedef struct SPICE_ATTR_PACKED QXLMessage {
QXLReleaseInfo release_info;
uint8_t data[0];
} QXLMessage;
typedef struct SPICE_ATTR_PACKED QXLCompatUpdateCmd {
QXLReleaseInfo release_info;
QXLRect area;
uint32_t update_id;
} QXLCompatUpdateCmd;
typedef struct SPICE_ATTR_PACKED QXLUpdateCmd {
QXLReleaseInfo release_info;
QXLRect area;
uint32_t update_id;
uint32_t surface_id;
} QXLUpdateCmd;
typedef struct SPICE_ATTR_PACKED QXLCursorHeader {
uint64_t unique;
uint16_t type;
uint16_t width;
uint16_t height;
uint16_t hot_spot_x;
uint16_t hot_spot_y;
} QXLCursorHeader;
typedef struct SPICE_ATTR_PACKED QXLCursor {
QXLCursorHeader header;
uint32_t data_size;
QXLDataChunk chunk;
} QXLCursor;
enum {
QXL_CURSOR_SET,
QXL_CURSOR_MOVE,
QXL_CURSOR_HIDE,
QXL_CURSOR_TRAIL,
};
#define QXL_CURSUR_DEVICE_DATA_SIZE 128
typedef struct SPICE_ATTR_PACKED QXLCursorCmd {
QXLReleaseInfo release_info;
uint8_t type;
union {
struct SPICE_ATTR_PACKED {
QXLPoint16 position;
uint8_t visible;
QXLPHYSICAL shape;
} set;
struct SPICE_ATTR_PACKED {
uint16_t length;
uint16_t frequency;
} trail;
QXLPoint16 position;
} u;
uint8_t device_data[QXL_CURSUR_DEVICE_DATA_SIZE]; //todo: dynamic size from rom
} QXLCursorCmd;
enum {
QXL_DRAW_NOP,
QXL_DRAW_FILL,
QXL_DRAW_OPAQUE,
QXL_DRAW_COPY,
QXL_COPY_BITS,
QXL_DRAW_BLEND,
QXL_DRAW_BLACKNESS,
QXL_DRAW_WHITENESS,
QXL_DRAW_INVERS,
QXL_DRAW_ROP3,
QXL_DRAW_STROKE,
QXL_DRAW_TEXT,
QXL_DRAW_TRANSPARENT,
QXL_DRAW_ALPHA_BLEND,
QXL_DRAW_COMPOSITE
};
typedef struct SPICE_ATTR_PACKED QXLRasterGlyph {
QXLPoint render_pos;
QXLPoint glyph_origin;
uint16_t width;
uint16_t height;
uint8_t data[0];
} QXLRasterGlyph;
typedef struct SPICE_ATTR_PACKED QXLString {
uint32_t data_size;
uint16_t length;
uint16_t flags;
QXLDataChunk chunk;
} QXLString;
typedef struct SPICE_ATTR_PACKED QXLCopyBits {
QXLPoint src_pos;
} QXLCopyBits;
typedef enum QXLEffectType
{
QXL_EFFECT_BLEND = 0,
QXL_EFFECT_OPAQUE = 1,
QXL_EFFECT_REVERT_ON_DUP = 2,
QXL_EFFECT_BLACKNESS_ON_DUP = 3,
QXL_EFFECT_WHITENESS_ON_DUP = 4,
QXL_EFFECT_NOP_ON_DUP = 5,
QXL_EFFECT_NOP = 6,
QXL_EFFECT_OPAQUE_BRUSH = 7
} QXLEffectType;
typedef struct SPICE_ATTR_PACKED QXLPattern {
QXLPHYSICAL pat;
QXLPoint pos;
} QXLPattern;
typedef struct SPICE_ATTR_PACKED QXLBrush {
uint32_t type;
union {
uint32_t color;
QXLPattern pattern;
} u;
} QXLBrush;
typedef struct SPICE_ATTR_PACKED QXLQMask {
uint8_t flags;
QXLPoint pos;
QXLPHYSICAL bitmap;
} QXLQMask;
typedef struct SPICE_ATTR_PACKED QXLFill {
QXLBrush brush;
uint16_t rop_descriptor;
QXLQMask mask;
} QXLFill;
typedef struct SPICE_ATTR_PACKED QXLOpaque {
QXLPHYSICAL src_bitmap;
QXLRect src_area;
QXLBrush brush;
uint16_t rop_descriptor;
uint8_t scale_mode;
QXLQMask mask;
} QXLOpaque;
typedef struct SPICE_ATTR_PACKED QXLCopy {
QXLPHYSICAL src_bitmap;
QXLRect src_area;
uint16_t rop_descriptor;
uint8_t scale_mode;
QXLQMask mask;
} QXLCopy, QXLBlend;
typedef struct SPICE_ATTR_PACKED QXLTransparent {
QXLPHYSICAL src_bitmap;
QXLRect src_area;
uint32_t src_color;
uint32_t true_color;
} QXLTransparent;
typedef struct SPICE_ATTR_PACKED QXLAlphaBlend {
uint16_t alpha_flags;
uint8_t alpha;
QXLPHYSICAL src_bitmap;
QXLRect src_area;
} QXLAlphaBlend;
typedef struct SPICE_ATTR_PACKED QXLCompatAlphaBlend {
uint8_t alpha;
QXLPHYSICAL src_bitmap;
QXLRect src_area;
} QXLCompatAlphaBlend;
typedef struct SPICE_ATTR_PACKED QXLRop3 {
QXLPHYSICAL src_bitmap;
QXLRect src_area;
QXLBrush brush;
uint8_t rop3;
uint8_t scale_mode;
QXLQMask mask;
} QXLRop3;
typedef struct SPICE_ATTR_PACKED QXLLineAttr {
uint8_t flags;
uint8_t join_style;
uint8_t end_style;
uint8_t style_nseg;
QXLFIXED width;
QXLFIXED miter_limit;
QXLPHYSICAL style;
} QXLLineAttr;
typedef struct SPICE_ATTR_PACKED QXLStroke {
QXLPHYSICAL path;
QXLLineAttr attr;
QXLBrush brush;
uint16_t fore_mode;
uint16_t back_mode;
} QXLStroke;
typedef struct SPICE_ATTR_PACKED QXLText {
QXLPHYSICAL str;
QXLRect back_area;
QXLBrush fore_brush;
QXLBrush back_brush;
uint16_t fore_mode;
uint16_t back_mode;
} QXLText;
typedef struct SPICE_ATTR_PACKED QXLBlackness {
QXLQMask mask;
} QXLBlackness, QXLInvers, QXLWhiteness;
typedef struct SPICE_ATTR_PACKED QXLClip {
uint32_t type;
QXLPHYSICAL data;
} QXLClip;
typedef enum {
QXL_OP_CLEAR = 0x00,
QXL_OP_SOURCE = 0x01,
QXL_OP_DST = 0x02,
QXL_OP_OVER = 0x03,
QXL_OP_OVER_REVERSE = 0x04,
QXL_OP_IN = 0x05,
QXL_OP_IN_REVERSE = 0x06,
QXL_OP_OUT = 0x07,
QXL_OP_OUT_REVERSE = 0x08,
QXL_OP_ATOP = 0x09,
QXL_OP_ATOP_REVERSE = 0x0a,
QXL_OP_XOR = 0x0b,
QXL_OP_ADD = 0x0c,
QXL_OP_SATURATE = 0x0d,
/* Note the jump here from 0x0d to 0x30 */
QXL_OP_MULTIPLY = 0x30,
QXL_OP_SCREEN = 0x31,
QXL_OP_OVERLAY = 0x32,
QXL_OP_DARKEN = 0x33,
QXL_OP_LIGHTEN = 0x34,
QXL_OP_COLOR_DODGE = 0x35,
QXL_OP_COLOR_BURN = 0x36,
QXL_OP_HARD_LIGHT = 0x37,
QXL_OP_SOFT_LIGHT = 0x38,
QXL_OP_DIFFERENCE = 0x39,
QXL_OP_EXCLUSION = 0x3a,
QXL_OP_HSL_HUE = 0x3b,
QXL_OP_HSL_SATURATION = 0x3c,
QXL_OP_HSL_COLOR = 0x3d,
QXL_OP_HSL_LUMINOSITY = 0x3e
} QXLOperator;
typedef struct {
uint32_t t00;
uint32_t t01;
uint32_t t02;
uint32_t t10;
uint32_t t11;
uint32_t t12;
} QXLTransform;
/* The flags field has the following bit fields:
*
* operator: [ 0 - 7 ]
* src_filter: [ 8 - 10 ]
* mask_filter: [ 11 - 13 ]
* src_repeat: [ 14 - 15 ]
* mask_repeat: [ 16 - 17 ]
* component_alpha: [ 18 - 18 ]
* reserved: [ 19 - 31 ]
*
* The repeat and filter values are those of pixman:
* REPEAT_NONE = 0
* REPEAT_NORMAL = 1
* REPEAT_PAD = 2
* REPEAT_REFLECT = 3
*
* The filter values are:
* FILTER_NEAREST = 0
* FILTER_BILINEAR = 1
*/
typedef struct SPICE_ATTR_PACKED QXLComposite {
uint32_t flags;
QXLPHYSICAL src;
QXLPHYSICAL src_transform; /* May be NULL */
QXLPHYSICAL mask; /* May be NULL */
QXLPHYSICAL mask_transform; /* May be NULL */
QXLPoint16 src_origin;
QXLPoint16 mask_origin;
} QXLComposite;
typedef struct SPICE_ATTR_PACKED QXLCompatDrawable {
QXLReleaseInfo release_info;
uint8_t effect;
uint8_t type;
uint16_t bitmap_offset;
QXLRect bitmap_area;
QXLRect bbox;
QXLClip clip;
uint32_t mm_time;
union {
QXLFill fill;
QXLOpaque opaque;
QXLCopy copy;
QXLTransparent transparent;
QXLCompatAlphaBlend alpha_blend;
QXLCopyBits copy_bits;
QXLBlend blend;
QXLRop3 rop3;
QXLStroke stroke;
QXLText text;
QXLBlackness blackness;
QXLInvers invers;
QXLWhiteness whiteness;
} u;
} QXLCompatDrawable;
typedef struct SPICE_ATTR_PACKED QXLDrawable {
QXLReleaseInfo release_info;
uint32_t surface_id;
uint8_t effect;
uint8_t type;
uint8_t self_bitmap;
QXLRect self_bitmap_area;
QXLRect bbox;
QXLClip clip;
uint32_t mm_time;
int32_t surfaces_dest[3];
QXLRect surfaces_rects[3];
union {
QXLFill fill;
QXLOpaque opaque;
QXLCopy copy;
QXLTransparent transparent;
QXLAlphaBlend alpha_blend;
QXLCopyBits copy_bits;
QXLBlend blend;
QXLRop3 rop3;
QXLStroke stroke;
QXLText text;
QXLBlackness blackness;
QXLInvers invers;
QXLWhiteness whiteness;
QXLComposite composite;
} u;
} QXLDrawable;
typedef enum QXLSurfaceCmdType {
QXL_SURFACE_CMD_CREATE,
QXL_SURFACE_CMD_DESTROY,
} QXLSurfaceCmdType;
typedef struct SPICE_ATTR_PACKED QXLSurface {
uint32_t format;
uint32_t width;
uint32_t height;
int32_t stride;
QXLPHYSICAL data;
} QXLSurface;
typedef struct SPICE_ATTR_PACKED QXLSurfaceCmd {
QXLReleaseInfo release_info;
uint32_t surface_id;
uint8_t type;
uint32_t flags;
union {
QXLSurface surface_create;
} u;
} QXLSurfaceCmd;
typedef struct SPICE_ATTR_PACKED QXLClipRects {
uint32_t num_rects;
QXLDataChunk chunk;
} QXLClipRects;
enum {
QXL_PATH_BEGIN = (1 << 0),
QXL_PATH_END = (1 << 1),
QXL_PATH_CLOSE = (1 << 3),
QXL_PATH_BEZIER = (1 << 4),
};
typedef struct SPICE_ATTR_PACKED QXLPathSeg {
uint32_t flags;
uint32_t count;
QXLPointFix points[0];
} QXLPathSeg;
typedef struct SPICE_ATTR_PACKED QXLPath {
uint32_t data_size;
QXLDataChunk chunk;
} QXLPath;
enum {
QXL_IMAGE_GROUP_DRIVER,
QXL_IMAGE_GROUP_DEVICE,
QXL_IMAGE_GROUP_RED,
QXL_IMAGE_GROUP_DRIVER_DONT_CACHE,
};
typedef struct SPICE_ATTR_PACKED QXLImageID {
uint32_t group;
uint32_t unique;
} QXLImageID;
typedef union {
QXLImageID id;
uint64_t value;
} QXLImageIDUnion;
typedef enum QXLImageFlags {
QXL_IMAGE_CACHE = (1 << 0),
QXL_IMAGE_HIGH_BITS_SET = (1 << 1),
} QXLImageFlags;
typedef enum QXLBitmapFlags {
QXL_BITMAP_DIRECT = (1 << 0),
QXL_BITMAP_UNSTABLE = (1 << 1),
QXL_BITMAP_TOP_DOWN = (1 << 2), // == SPICE_BITMAP_FLAGS_TOP_DOWN
} QXLBitmapFlags;
#define QXL_SET_IMAGE_ID(image, _group, _unique) { \
(image)->descriptor.id = (((uint64_t)_unique) << 32) | _group; \
}
typedef struct SPICE_ATTR_PACKED QXLImageDescriptor {
uint64_t id;
uint8_t type;
uint8_t flags;
uint32_t width;
uint32_t height;
} QXLImageDescriptor;
typedef struct SPICE_ATTR_PACKED QXLPalette {
uint64_t unique;
uint16_t num_ents;
uint32_t ents[0];
} QXLPalette;
typedef struct SPICE_ATTR_PACKED QXLBitmap {
uint8_t format;
uint8_t flags;
uint32_t x;
uint32_t y;
uint32_t stride;
QXLPHYSICAL palette;
QXLPHYSICAL data; //data[0] ?
} QXLBitmap;
typedef struct SPICE_ATTR_PACKED QXLSurfaceId {
uint32_t surface_id;
} QXLSurfaceId;
typedef struct SPICE_ATTR_PACKED QXLQUICData {
uint32_t data_size;
uint8_t data[0];
} QXLQUICData, QXLLZRGBData, QXLJPEGData;
typedef struct SPICE_ATTR_PACKED QXLImage {
QXLImageDescriptor descriptor;
union { // variable length
QXLBitmap bitmap;
QXLQUICData quic;
QXLSurfaceId surface_image;
};
} QXLImage;
/* A QXLHead is a single monitor output backed by a QXLSurface.
* x and y offsets are unsigned since they are used in relation to
* the given surface, not the same as the x, y coordinates in the guest
* screen reference frame. */
typedef struct SPICE_ATTR_PACKED QXLHead {
uint32_t id;
uint32_t surface_id;
uint32_t width;
uint32_t height;
uint32_t x;
uint32_t y;
uint32_t flags;
} QXLHead;
typedef struct SPICE_ATTR_PACKED QXLMonitorsConfig {
uint16_t count;
uint16_t max_allowed; /* If it is 0 no fixed limit is given by the driver */
QXLHead heads[0];
} QXLMonitorsConfig;
#include "include/end-packed.h"
#endif /* _H_QXL_DEV */

64
qxldod/include/start-packed.h Executable file
View File

@ -0,0 +1,64 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009 Red Hat, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Ideally this should all have been macros in a common headers, but
* its not possible to put pragmas into header files, so we have
* to use include magic.
*
* Use it like this:
*
* #include <spice/start-packed.h>
*
* typedef struct SPICE_ATTR_PACKED {
* ...
* } Type;
*
* #include <spice/end-packed.h>
*
*/
#ifdef __GNUC__
#define SPICE_ATTR_PACKED __attribute__ ((__packed__))
#ifdef __MINGW32__
#pragma pack(push,1)
#endif
#else
#pragma pack(push)
#pragma pack(1)
#define SPICE_ATTR_PACKED
#pragma warning(disable:4200)
#pragma warning(disable:4103)
#endif

397
qxldod/include/stdint.h Executable file
View File

@ -0,0 +1,397 @@
/* ISO C9x 7.18 Integer types <stdint.h>
* Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Date: 2000-12-02
*/
#ifndef _STDINT_H
#define _STDINT_H
#define __need_wint_t
#define __need_wchar_t
#include <stddef.h>
#ifdef _WIN32_WCE
typedef _int64 int64_t;
typedef unsigned _int64 uint64_t;
#else
typedef long long int64_t;
typedef unsigned long long uint64_t;
#endif /* _WIN32_WCE */
/* 7.18.1.1 Exact-width integer types */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned uint32_t;
/* 7.18.1.2 Minimum-width integer types */
typedef signed char int_least8_t;
typedef unsigned char uint_least8_t;
typedef short int_least16_t;
typedef unsigned short uint_least16_t;
typedef int int_least32_t;
typedef unsigned uint_least32_t;
#ifndef _WIN32_WCE
typedef long long int_least64_t;
typedef unsigned long long uint_least64_t;
#endif
/* 7.18.1.3 Fastest minimum-width integer types
* Not actually guaranteed to be fastest for all purposes
* Here we use the exact-width types for 8 and 16-bit ints.
*/
typedef char int_fast8_t;
typedef unsigned char uint_fast8_t;
typedef short int_fast16_t;
typedef unsigned short uint_fast16_t;
typedef int int_fast32_t;
typedef unsigned int uint_fast32_t;
#ifndef _WIN32_WCE
typedef long long int_fast64_t;
typedef unsigned long long uint_fast64_t;
#endif
/* 7.18.1.4 Integer types capable of holding object pointers */
#ifndef _WIN64
typedef int intptr_t;
typedef unsigned uintptr_t;
#endif
/* 7.18.1.5 Greatest-width integer types */
#ifndef _WIN32_WCE
typedef long long intmax_t;
typedef unsigned long long uintmax_t;
#endif
/* 7.18.2 Limits of specified-width integer types */
#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MIN (-128)
#define INT16_MIN (-32768)
#define INT32_MIN (-2147483647 - 1)
#define INT64_MIN (-9223372036854775807LL - 1)
#define INT8_MAX 127
#define INT16_MAX 32767
#define INT32_MAX 2147483647
#define INT64_MAX 9223372036854775807LL
#define UINT8_MAX 0xff /* 255U */
#define UINT16_MAX 0xffff /* 65535U */
#define UINT32_MAX 0xffffffff /* 4294967295U */
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
/* 7.18.2.2 Limits of minimum-width integer types */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
/* 7.18.2.3 Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
/* 7.18.2.4 Limits of integer types capable of holding
object pointers */
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
/* 7.18.2.5 Limits of greatest-width integer types */
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
/* 7.18.3 Limits of other integer types */
#define PTRDIFF_MIN INT32_MIN
#define PTRDIFF_MAX INT32_MAX
#define SIG_ATOMIC_MIN INT32_MIN
#define SIG_ATOMIC_MAX INT32_MAX
#ifndef SIZE_MAX
#define SIZE_MAX UINT32_MAX
#endif
#ifndef WCHAR_MIN /* also in wchar.h */
#define WCHAR_MIN 0
#define WCHAR_MAX 0xffff /* UINT16_MAX */
#endif
/*
* wint_t is unsigned short for compatibility with MS runtime
*/
#define WINT_MIN 0
#define WINT_MAX 0xffff /* UINT16_MAX */
#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
/* 7.18.4 Macros for integer constants */
#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
/* 7.18.4.1 Macros for minimum-width integer constants
Accoding to Douglas Gwyn <gwyn@arl.mil>:
"This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
9899:1999 as initially published, the expansion was required
to be an integer constant of precisely matching type, which
is impossible to accomplish for the shorter types on most
platforms, because C99 provides no standard way to designate
an integer constant with width less than that of type int.
TC1 changed this to require just an integer constant
*expression* with *promoted* type."
*/
#define INT8_C(val) ((int8_t) + (val))
#define UINT8_C(val) ((uint8_t) + (val##U))
#define INT16_C(val) ((int16_t) + (val))
#define UINT16_C(val) ((uint16_t) + (val##U))
#define INT32_C(val) val##L
#define UINT32_C(val) val##UL
#define INT64_C(val) val##LL
#define UINT64_C(val) val##ULL
/* 7.18.4.2 Macros for greatest-width integer constants */
#define INTMAX_C(val) INT64_C(val)
#define UINTMAX_C(val) UINT64_C(val)
#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
#endif

41
qxldod/include/types.h Executable file
View File

@ -0,0 +1,41 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009 Red Hat, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _H_SPICE_TYPES
#define _H_SPICE_TYPES
/* We always want the standard int types
* If they are not in stdint.h on your system,
* include the right one here. */
#include <include/stdint.h>
//#include <limits.h>
#endif /* _H_SPICE_TYPES */