Merge pull request #730 from C-o-r-E/master

wfreerdp-server: added windows 8 server support
This commit is contained in:
Marc-André Moreau 2012-09-19 12:31:09 -07:00
commit 88d7d891e2
13 changed files with 584 additions and 35 deletions

View File

@ -13,6 +13,7 @@ endif()
if(MSVC)
option(WITH_NATIVE_SSPI "Use native SSPI modules" ON)
option(WITH_MSVC_STATIC "Use static MSVC runtime" OFF)
option(WITH_WIN8 "Required for wfreedrp-server on windows 8" OFF)
endif()
if(${CMAKE_VERSION} VERSION_GREATER 2.8.8)

View File

@ -31,6 +31,7 @@
#cmakedefine WITH_NEON
#cmakedefine WITH_NATIVE_SSPI
#cmakedefine WITH_JPEG
#cmakedefine WITH_WIN8
/* Debug */
#cmakedefine WITH_DEBUG_CERTIFICATE

View File

@ -34,7 +34,7 @@ set(WFREERDP_SERVER_SRCS
wf_peer.h
wf_settings.c
wf_settings.h
wf_info.c
wf_info.c
wf_info.h)
if(WITH_SERVER_INTERFACE)
@ -49,15 +49,32 @@ if(WITH_MONOLITHIC_BUILD)
set(WFREERDP_SERVER_LIBS freerdp)
else()
set(WFREERDP_SERVER_LIBS
freerdp-core
if(WITH_WIN8)
set(WFREERDP_SERVER_LIBS
freerdp-core
freerdp-utils
freerdp-utils
freerdp-codec
freerdp-codec
freerdp-channels)
freerdp-channels
d3d11.lib
dxgi.lib
dxguid.lib)
else()
set(WFREERDP_SERVER_LIBS
freerdp-core
freerdp-utils
freerdp-codec
freerdp-channels)
endif()
endif()
target_link_libraries(wfreerdp-server ${WFREERDP_SERVER_LIBS})

View File

@ -2,7 +2,7 @@
* FreeRDP: A Remote Desktop Protocol Client
* FreeRDP Windows Server
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,11 +16,417 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "wf_interface.h"
#ifdef WITH_WIN8
#define CINTERFACE
#include <D3D11.h>
#include <dxgi1_2.h>
#include <tchar.h>
#include "wf_dxgi.h"
// Driver types supported
D3D_DRIVER_TYPE DriverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE,
};
UINT NumDriverTypes = ARRAYSIZE(DriverTypes);
// Feature levels supported
D3D_FEATURE_LEVEL FeatureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_1
};
UINT NumFeatureLevels = ARRAYSIZE(FeatureLevels);
D3D_FEATURE_LEVEL FeatureLevel;
ID3D11Device* MeinDevice = NULL;
ID3D11DeviceContext* MeinContext = NULL;
IDXGIOutputDuplication* MeinDeskDupl = NULL;
ID3D11Texture2D* MeinAcquiredDesktopImage = NULL;
IDXGISurface* surf;
ID3D11Texture2D * sStage;
DXGI_OUTDUPL_FRAME_INFO FrameInfo;
int wf_dxgi_init(wfInfo* context)
{
HRESULT hr;
UINT DriverTypeIndex;
IDXGIDevice* DxgiDevice = NULL;
IDXGIAdapter* DxgiAdapter = NULL;
DXGI_OUTPUT_DESC desc;
UINT dTop, i = 0;
IDXGIOutput * pOutput;
IDXGIOutput* DxgiOutput = NULL;
IDXGIOutput1* DxgiOutput1 = NULL;
/////////////////////////////////////////////////////////
//guessing this must be null
MeinAcquiredDesktopImage = NULL;
// Create device
for (DriverTypeIndex = 0; DriverTypeIndex < NumDriverTypes; ++DriverTypeIndex)
{
hr = D3D11CreateDevice(NULL, DriverTypes[DriverTypeIndex], NULL, D3D11_CREATE_DEVICE_DEBUG, FeatureLevels, NumFeatureLevels,
D3D11_SDK_VERSION, &MeinDevice, &FeatureLevel, &MeinContext);
if (SUCCEEDED(hr))
{
// Device creation success, no need to loop anymore
break;
}
}
if (FAILED(hr))
{
_tprintf(_T("Failed to create device in InitializeDx\n"));
return 1;
}
///////////////////////////////////////////////////////
hr = MeinDevice->lpVtbl->QueryInterface(MeinDevice, &IID_IDXGIDevice, (void**) &DxgiDevice);
if (FAILED(hr))
{
_tprintf(_T("Failed to get QI for DXGI Device\n"));
return 1;
}
//////////////////////////////////////////////////////////
hr = DxgiDevice->lpVtbl->GetParent(DxgiDevice, &IID_IDXGIAdapter, (void**) &DxgiAdapter);
DxgiDevice->lpVtbl->Release(DxgiDevice);
DxgiDevice = NULL;
if (FAILED(hr))
{
_tprintf(_T("Failed to get parent DXGI Adapter\n"));
return 1;
}
////////////////////////////////////////////////////////////
memset(&desc, 0, sizeof(desc));
pOutput = NULL;
while(DxgiAdapter->lpVtbl->EnumOutputs(DxgiAdapter, i, &pOutput) != DXGI_ERROR_NOT_FOUND)
{
DXGI_OUTPUT_DESC* pDesc = &desc;
hr = pOutput->lpVtbl->GetDesc(pOutput, pDesc);
if (FAILED(hr))
{
_tprintf(_T("Failed to get description\n"));
return 1;
}
_tprintf(_T("Output %d: [%s] [%d]\n"), i, pDesc->DeviceName, pDesc->AttachedToDesktop);
if(pDesc->AttachedToDesktop)
dTop = i;
pOutput->lpVtbl->Release(pOutput);
++i;
}
//for now stick to the first one -- need to change this for multimon
dTop = 0;
hr = DxgiAdapter->lpVtbl->EnumOutputs(DxgiAdapter, dTop, &DxgiOutput);
DxgiAdapter->lpVtbl->Release(DxgiAdapter);
DxgiAdapter = NULL;
if (FAILED(hr))
{
_tprintf(_T("Failed to get output\n"));
return 1;
}
//////////////////////////////////////////////
hr = DxgiOutput->lpVtbl->QueryInterface(DxgiOutput, &IID_IDXGIOutput1, (void**) &DxgiOutput1);
DxgiOutput->lpVtbl->Release(DxgiOutput);
DxgiOutput = NULL;
if (FAILED(hr))
{
_tprintf(_T("Failed to get IDXGIOutput1\n"));
return 1;
}
//////////////////////////////////////////////
hr = DxgiOutput1->lpVtbl->DuplicateOutput(DxgiOutput1, (IUnknown*)MeinDevice, &MeinDeskDupl);
DxgiOutput1->lpVtbl->Release(DxgiOutput1);
DxgiOutput1 = NULL;
if (FAILED(hr))
{
if (hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE)
{
_tprintf(_T("There is already the maximum number of applications using the Desktop Duplication API running, please close one of those applications and then try again.\n"));
return 1;
}
_tprintf(_T("Failed to get duplicate output\n"));
return 1;
}
return 0;
}
int wf_dxgi_cleanup(wfInfo* wfi)
{
if(wfi->framesWaiting > 0)
{
wf_dxgi_releasePixelData(wfi);
}
if(MeinAcquiredDesktopImage)
{
MeinAcquiredDesktopImage->lpVtbl->Release(MeinAcquiredDesktopImage);
MeinAcquiredDesktopImage = NULL;
}
if(MeinDeskDupl)
{
MeinDeskDupl->lpVtbl->Release(MeinDeskDupl);
MeinDeskDupl = NULL;
}
if(MeinContext)
{
MeinContext->lpVtbl->Release(MeinContext);
MeinContext = NULL;
}
if(MeinDevice)
{
MeinDevice->lpVtbl->Release(MeinDevice);
MeinDevice = NULL;
}
return 0;
}
int wf_dxgi_nextFrame(wfInfo* wfi, UINT timeout)
{
HRESULT hr;
IDXGIResource* DesktopResource = NULL;
BYTE* MeinMetaDataBuffer = NULL;
UINT MeinMetaDataSize = 0;
UINT i = 0;
if(wfi->framesWaiting > 0)
{
wf_dxgi_releasePixelData(wfi);
}
if(MeinAcquiredDesktopImage)
{
MeinAcquiredDesktopImage->lpVtbl->Release(MeinAcquiredDesktopImage);
MeinAcquiredDesktopImage = NULL;
}
hr = MeinDeskDupl->lpVtbl->AcquireNextFrame(MeinDeskDupl, timeout, &FrameInfo, &DesktopResource);
if (hr == DXGI_ERROR_WAIT_TIMEOUT)
{
return 1;
}
if (FAILED(hr))
{
_tprintf(_T("Failed to acquire next frame\n"));
hr = MeinDeskDupl->lpVtbl->ReleaseFrame(MeinDeskDupl);
if (FAILED(hr))
{
_tprintf(_T("Failed to release frame\n"));
}
return 1;
}
///////////////////////////////////////////////
hr = DesktopResource->lpVtbl->QueryInterface(DesktopResource, &IID_ID3D11Texture2D, (void**) &MeinAcquiredDesktopImage);
DesktopResource->lpVtbl->Release(DesktopResource);
DesktopResource = NULL;
if (FAILED(hr))
{
return 1;
}
wfi->framesWaiting = FrameInfo.AccumulatedFrames;
return 0;
}
int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch, RECT* invalid)
{
HRESULT hr;
DXGI_MAPPED_RECT MeinData;
D3D11_TEXTURE2D_DESC tDesc;
D3D11_BOX Box;
tDesc.Width = (invalid->right - invalid->left);
tDesc.Height = (invalid->bottom - invalid->top);
tDesc.MipLevels = 1;
tDesc.ArraySize = 1;
tDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
tDesc.SampleDesc.Count = 1;
tDesc.SampleDesc.Quality = 0;
tDesc.Usage = D3D11_USAGE_STAGING;
tDesc.BindFlags = 0;
tDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;// | D3D11_CPU_ACCESS_WRITE;
tDesc.MiscFlags = 0;
Box.top = invalid->top;
Box.left = invalid->left;
Box.right = invalid->right;
Box.bottom = invalid->bottom;
Box.front = 0;
Box.back = 1;
hr = MeinDevice->lpVtbl->CreateTexture2D(MeinDevice, &tDesc, NULL, &sStage);
if (FAILED(hr))
{
_tprintf(_T("Failed to create staging surface\n"));
exit(1);
return 1;
}
MeinContext->lpVtbl->CopySubresourceRegion(MeinContext, (ID3D11Resource*)sStage, 0,0,0,0, (ID3D11Resource*)MeinAcquiredDesktopImage, 0, &Box);
hr = sStage->lpVtbl->QueryInterface(sStage, &IID_IDXGISurface, (void**)&surf);
if (FAILED(hr))
{
_tprintf(_T("Failed to QI staging surface\n"));
exit(1);
return 1;
}
surf->lpVtbl->Map(surf, &MeinData, DXGI_MAP_READ);
if (FAILED(hr))
{
_tprintf(_T("Failed to map staging surface\n"));
exit(1);
return 1;
}
*data = MeinData.pBits;
*pitch = MeinData.Pitch;
return 0;
}
int wf_dxgi_releasePixelData(wfInfo* wfi)
{
HRESULT hr;
surf->lpVtbl->Unmap(surf);
surf->lpVtbl->Release(surf);
surf = NULL;
sStage->lpVtbl->Release(sStage);
sStage = NULL;
hr = MeinDeskDupl->lpVtbl->ReleaseFrame(MeinDeskDupl);
if (FAILED(hr))
{
_tprintf(_T("Failed to release frame\n"));
return 1;
}
wfi->framesWaiting = 0;
return 0;
}
int wf_dxgi_getInvalidRegion(RECT* invalid)
{
HRESULT hr;
UINT MeinMetaDataSize = 0;
UINT BufSize;
UINT i;
BYTE* DirtyRects;
UINT dirty;
RECT* pRect;
//optimization note: make this buffer global and allocate only once (or grow only when needed)
BYTE* MeinMetaDataBuffer = NULL;
if(FrameInfo.AccumulatedFrames == 0)
{
//we dont care
return 1;
}
if(FrameInfo.TotalMetadataBufferSize)
{
if (FrameInfo.TotalMetadataBufferSize > MeinMetaDataSize)
{
if (MeinMetaDataBuffer)
{
free(MeinMetaDataBuffer);
MeinMetaDataBuffer = NULL;
}
MeinMetaDataBuffer = (BYTE*) malloc(FrameInfo.TotalMetadataBufferSize);
if (!MeinMetaDataBuffer)
{
MeinMetaDataSize = 0;
_tprintf(_T("Failed to allocate memory for metadata\n"));
exit(1);
}
MeinMetaDataSize = FrameInfo.TotalMetadataBufferSize;
}
BufSize = FrameInfo.TotalMetadataBufferSize;
// Get move rectangles
hr = MeinDeskDupl->lpVtbl->GetFrameMoveRects(MeinDeskDupl, BufSize, (DXGI_OUTDUPL_MOVE_RECT*) MeinMetaDataBuffer, &BufSize);
if (FAILED(hr))
{
_tprintf(_T("Failed to get frame move rects\n"));
return 1;
}
DirtyRects = MeinMetaDataBuffer + BufSize;
BufSize = FrameInfo.TotalMetadataBufferSize - BufSize;
// Get dirty rectangles
hr = MeinDeskDupl->lpVtbl->GetFrameDirtyRects(MeinDeskDupl, BufSize, (RECT*) DirtyRects, &BufSize);
if (FAILED(hr))
{
_tprintf(_T("Failed to get frame dirty rects\n"));
return 1;
}
dirty = BufSize / sizeof(RECT);
pRect = (RECT*) DirtyRects;
for(i = 0; i<dirty; ++i)
{
UnionRect(invalid, invalid, pRect);
++pRect;
}
}
return 0;
}
#endif

View File

@ -2,7 +2,7 @@
* FreeRDP: A Remote Desktop Protocol Client
* FreeRDP Windows Server
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +22,17 @@
#include "wf_interface.h"
int wf_dxgi_init(wfInfo* context);
int wf_dxgi_cleanup(wfInfo* context);
int wf_dxgi_nextFrame(wfInfo* context, UINT timeout);
int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch, RECT* invalid);
int wf_dxgi_releasePixelData(wfInfo* context);
int wf_dxgi_getInvalidRegion(RECT* invalid);
#endif /* WF_DXGI_H */
#endif

View File

@ -29,6 +29,7 @@
#include "wf_info.h"
#include "wf_update.h"
#include "wf_mirage.h"
#include "wf_dxgi.h"
static wfInfo* wfInfoInstance = NULL;
@ -99,6 +100,14 @@ wfInfo* wf_info_init()
{
wfInfo* wfi;
/*
OSVERSIONINFOEX osvi;
SYSTEM_INFO si;
BOOL bOsVersionInfoEx;
*/
wfi = (wfInfo*) malloc(sizeof(wfInfo));
ZeroMemory(wfi, sizeof(wfInfo));
@ -142,6 +151,29 @@ wfInfo* wf_info_init()
}
RegCloseKey(hKey);
//detect windows version
/*
ZeroMemory(&si, sizeof(SYSTEM_INFO));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
wfi->win8 = FALSE;
if(bOsVersionInfoEx != 0 )
{
if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId &&
osvi.dwMajorVersion > 4 )
{
if ( osvi.dwMajorVersion == 6 &&
osvi.dwMinorVersion == 2)
{
wfi->win8 = TRUE;
}
}
}
*/
}
return wfi;
@ -155,6 +187,7 @@ wfInfo* wf_info_get_instance()
return wfInfoInstance;
}
void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
{
if (wf_info_lock(wfi) > 0)
@ -162,7 +195,16 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
context->info = wfi;
context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
wf_mirror_driver_activate(wfi);
if(wfi->peerCount == 0)
{
#ifdef WITH_WIN8
wf_dxgi_init(wfi);
#endif
}
else
{
wf_mirror_driver_activate(wfi);
}
wfi->peers[wfi->peerCount++] = ((rdpContext*) context)->peer;
@ -181,28 +223,59 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
printf("Unregistering Peer: %d\n", wfi->peerCount);
if(wfi->peerCount == 0)
{
#ifdef WITH_WIN8
wf_dxgi_cleanup(wfi);
#endif
}
wf_info_unlock(wfi);
}
}
BOOL wf_info_have_updates(wfInfo* wfi)
{
#ifdef WITH_WIN8
if(wfi->framesWaiting == 0)
return FALSE;
#else
if (wfi->nextUpdate == wfi->lastUpdate)
return FALSE;
#endif
return TRUE;
}
void wf_info_update_changes(wfInfo* wfi)
{
#ifdef WITH_WIN8
wf_dxgi_nextFrame(wfi, wfi->framesPerSecond / 1000);
#else
GETCHANGESBUF* buf;
buf = (GETCHANGESBUF*) wfi->changeBuffer;
wfi->nextUpdate = buf->buffer->counter;
#endif
}
void wf_info_find_invalid_region(wfInfo* wfi)
{
#ifdef WITH_WIN8
wf_dxgi_getInvalidRegion(&wfi->invalid);
#else
int i;
GETCHANGESBUF* buf;
@ -212,9 +285,11 @@ void wf_info_find_invalid_region(wfInfo* wfi)
{
UnionRect(&wfi->invalid, &wfi->invalid, &buf->buffer->pointrect[i].rect);
}
#endif
if (wfi->invalid.left < 0)
wfi->invalid.left = 0;
wfi->invalid.left = 0;
if (wfi->invalid.top < 0)
wfi->invalid.top = 0;
@ -224,6 +299,7 @@ void wf_info_find_invalid_region(wfInfo* wfi)
if (wfi->invalid.bottom >= wfi->height)
wfi->invalid.bottom = wfi->height - 1;
}
void wf_info_clear_invalid_region(wfInfo* wfi)
@ -241,3 +317,29 @@ BOOL wf_info_have_invalid_region(wfInfo* wfi)
{
return IsRectEmpty(&wfi->invalid);
}
void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits, int* pitch)
{
*width = (wfi->invalid.right - wfi->invalid.left);
*height = (wfi->invalid.bottom - wfi->invalid.top);
#ifdef WITH_WIN8
wf_dxgi_getPixelData(wfi, pBits, pitch, &wfi->invalid);
#else
{
long offset;
GETCHANGESBUF* changes;
changes = (GETCHANGESBUF*) wfi->changeBuffer;
*width += 1;
*height += 1;
offset = (4 * wfi->invalid.left) + (wfi->invalid.top * wfi->width * 4);
*pBits = ((uint8*) (changes->Userbuffer)) + offset;
*pitch = wfi->width * 4;
}
#endif
}

View File

@ -36,5 +36,6 @@ void wf_info_find_invalid_region(wfInfo* wfi);
void wf_info_clear_invalid_region(wfInfo* wfi);
void wf_info_invalidate_full_screen(wfInfo* wfi);
BOOL wf_info_have_invalid_region(wfInfo* wfi);
void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits, int* pitch);
#endif /* WF_INFO_H */
#endif /* WF_INFO_H */

View File

@ -48,6 +48,7 @@ struct wf_info
TCHAR deviceName[32];
freerdp_peer** peers;
BOOL mirrorDriverActive;
UINT framesWaiting;
RECT invalid;
HANDLE mutex;

View File

@ -311,4 +311,4 @@ void wf_mirror_driver_deactivate(wfInfo* wfi)
wf_mirror_driver_update(wfi, 1);
wfi->mirrorDriverActive = FALSE;
}
}
}

View File

@ -276,4 +276,4 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
printf("Exiting Peer Main Loop Thread\n");
return 0;
}
}

View File

@ -24,11 +24,14 @@
#include <freerdp/listener.h>
void wf_peer_context_new(freerdp_peer* client, wfPeerContext* context);
void wf_peer_context_free(freerdp_peer* client, wfPeerContext* context);
void wf_peer_init(freerdp_peer* client);
void wf_dxgi_encode(freerdp_peer* client, UINT timeout);
void wf_rfx_encode(freerdp_peer* client);
boolean wf_peer_post_connect(freerdp_peer* client);
@ -37,9 +40,12 @@ boolean wf_peer_activate(freerdp_peer* client);
void wf_peer_synchronize_event(rdpInput* input, uint32 flags);
void wf_peer_send_changes(freerdp_peer* client);
void wf_detect_win_ver();
void wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
DWORD WINAPI wf_peer_main_loop(LPVOID lpParam);
#endif /* WF_PEER_H */

View File

@ -61,7 +61,7 @@ BOOL wf_settings_read_string_ascii(HKEY key, LPTSTR subkey, LPTSTR name, char**
DWORD dwType;
DWORD dwSize;
char* strA;
TCHAR* strX;
TCHAR* strX = NULL;
status = RegOpenKeyEx(key, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);

View File

@ -59,24 +59,24 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
{
wf_update_encode(wfi);
printf("Start of parallel sending\n");
//printf("Start of parallel sending\n");
for (index = 0; index < wfi->peerCount; index++)
{
if (wfi->peers[index]->activated)
{
printf("Setting event for %d of %d\n", index + 1, wfi->activePeerCount);
//printf("Setting event for %d of %d\n", index + 1, wfi->activePeerCount);
SetEvent(((wfPeerContext*) wfi->peers[index]->context)->updateEvent);
}
}
for (index = 0; index < wfi->activePeerCount; index++)
{
printf("Waiting for %d of %d\n", index + 1, wfi->activePeerCount);
//printf("Waiting for %d of %d\n", index + 1, wfi->activePeerCount);
WaitForSingleObject(wfi->updateSemaphore, INFINITE);
}
printf("End of parallel sending\n");
//printf("End of parallel sending\n");
wf_info_clear_invalid_region(wfi);
}
@ -94,29 +94,30 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
}
}
printf("Exiting Update Thread\n");
//printf("Exiting Update Thread\n");
return 0;
}
void wf_update_encode(wfInfo* wfi)
{
long offset;
RFX_RECT rect;
long height, width;
GETCHANGESBUF* changes;
uint8* pDataBits = NULL;
int stride;
SURFACE_BITS_COMMAND* cmd;
wf_info_find_invalid_region(wfi);
cmd = &wfi->cmd;
changes = (GETCHANGESBUF*) wfi->changeBuffer;
width = (wfi->invalid.right - wfi->invalid.left) + 1;
height = (wfi->invalid.bottom - wfi->invalid.top) + 1;
stream_set_pos(wfi->s, 0);
wf_info_getScreenData(wfi, &width, &height, &pDataBits, &stride);
rect.x = 0;
rect.y = 0;
rect.width = (uint16) width;
@ -124,10 +125,8 @@ void wf_update_encode(wfInfo* wfi)
//printf("x:%d y:%d w:%d h:%d\n", wfi->invalid.left, wfi->invalid.top, width, height);
offset = (4 * wfi->invalid.left) + (wfi->invalid.top * wfi->width * 4);
rfx_compose_message(wfi->rfx_context, wfi->s, &rect, 1,
((uint8*) (changes->Userbuffer)) + offset, width, height, wfi->width * 4);
pDataBits, width, height, stride);
wfi->frame_idx = wfi->rfx_context->frame_idx;
@ -209,7 +208,9 @@ void wf_update_peer_activate(wfInfo* wfi, wfPeerContext* context)
{
if (wfi->activePeerCount < 1)
{
//wf_mirror_driver_activate(wfi);
#ifndef WITH_WIN8
wf_mirror_driver_activate(wfi);
#endif
ResumeThread(wfi->updateThread);
}
@ -230,8 +231,10 @@ void wf_update_peer_deactivate(wfInfo* wfi, wfPeerContext* context)
if (client->activated)
{
//if (wfi->activePeerCount <= 1)
//wf_mirror_driver_deactivate(wfi);
if (wfi->activePeerCount <= 1)
{
wf_mirror_driver_deactivate(wfi);
}
client->activated = false;
wfi->activePeerCount--;