Merge pull request #3560 from akallabeth/gfx_10_2

Gfx 10.2 caps and deactivate GDI unsupported functions
This commit is contained in:
David Fort 2016-10-21 09:29:51 +02:00 committed by GitHub
commit 043243f43c
9 changed files with 84 additions and 57 deletions

View File

@ -26,9 +26,10 @@
#include <winpr/stream.h>
#include <freerdp/channels/rdpgfx.h>
#include <freerdp/api.h>
#include "rdpgfx_main.h"
UINT rdpgfx_decode(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd);
FREERDP_LOCAL UINT rdpgfx_decode(RDPGFX_PLUGIN* gfx, RDPGFX_SURFACE_COMMAND* cmd);
#endif /* FREERDP_CHANNEL_RDPGFX_CLIENT_CODEC_H */

View File

@ -60,7 +60,7 @@ static UINT rdpgfx_send_caps_advertise_pdu(RDPGFX_CHANNEL_CALLBACK* callback)
RDPGFX_PLUGIN* gfx;
RDPGFX_HEADER header;
RDPGFX_CAPSET* capsSet;
RDPGFX_CAPSET capsSets[3];
RDPGFX_CAPSET capsSets[RDPGFX_NUMBER_CAPSETS];
RDPGFX_CAPS_ADVERTISE_PDU pdu;
gfx = (RDPGFX_PLUGIN*) callback->plugin;
header.flags = 0;
@ -101,6 +101,9 @@ static UINT rdpgfx_send_caps_advertise_pdu(RDPGFX_CHANNEL_CALLBACK* callback)
if (!gfx->H264)
capsSet->flags |= RDPGFX_CAPS_FLAG_AVC_DISABLED;
capsSets[pdu.capsSetCount] = *capsSet;
capsSets[pdu.capsSetCount++].version = RDPGFX_CAPVERSION_102;
}
header.pduLength = RDPGFX_HEADER_SIZE + 2 + (pdu.capsSetCount *
@ -319,8 +322,8 @@ static UINT rdpgfx_recv_evict_cache_entry_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_recv_cache_import_reply_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
static UINT rdpgfx_recv_cache_import_reply_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
{
UINT16 index;
RDPGFX_CACHE_IMPORT_REPLY_PDU pdu;
@ -413,8 +416,8 @@ static UINT rdpgfx_recv_create_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_recv_delete_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
static UINT rdpgfx_recv_delete_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
{
RDPGFX_DELETE_SURFACE_PDU pdu;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
@ -709,7 +712,7 @@ static UINT rdpgfx_recv_delete_encoding_context_pdu(RDPGFX_CHANNEL_CALLBACK*
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_recv_solid_fill_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
static UINT rdpgfx_recv_solid_fill_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT16 index;
RECTANGLE_16* fillRect;
@ -905,8 +908,8 @@ static UINT rdpgfx_recv_surface_to_cache_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_recv_cache_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
static UINT rdpgfx_recv_cache_to_surface_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
{
UINT16 index;
RDPGFX_POINT16* destPt;
@ -1011,7 +1014,7 @@ static UINT rdpgfx_recv_map_surface_to_output_pdu(RDPGFX_CHANNEL_CALLBACK*
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_recv_map_surface_to_window_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
static UINT rdpgfx_recv_map_surface_to_window_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
wStream* s)
{
RDPGFX_MAP_SURFACE_TO_WINDOW_PDU pdu;
@ -1554,7 +1557,7 @@ static UINT rdpgfx_set_cache_slot_data(RdpgfxClientContext* context,
return CHANNEL_RC_OK;
}
void* rdpgfx_get_cache_slot_data(RdpgfxClientContext* context, UINT16 cacheSlot)
static void* rdpgfx_get_cache_slot_data(RdpgfxClientContext* context, UINT16 cacheSlot)
{
void* pData = NULL;
RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) context->handle;

View File

@ -31,7 +31,7 @@
#include "rdpgfx_common.h"
const char* RDPGFX_CMDID_STRINGS[] =
static const char* RDPGFX_CMDID_STRINGS[] =
{
"RDPGFX_CMDID_UNUSED_0000",
"RDPGFX_CMDID_WIRETOSURFACE_1",
@ -72,20 +72,28 @@ const char* rdpgfx_get_codec_id_string(UINT16 codecId)
{
case RDPGFX_CODECID_UNCOMPRESSED:
return "RDPGFX_CODECID_UNCOMPRESSED";
case RDPGFX_CODECID_CAVIDEO:
return "RDPGFX_CODECID_CAVIDEO";
case RDPGFX_CODECID_CLEARCODEC:
return "RDPGFX_CODECID_CLEARCODEC";
case RDPGFX_CODECID_PLANAR:
return "RDPGFX_CODECID_PLANAR";
case RDPGFX_CODECID_AVC420:
return "RDPGFX_CODECID_AVC420";
case RDPGFX_CODECID_AVC444:
return "RDPGFX_CODECID_AVC444";
case RDPGFX_CODECID_ALPHA:
return "RDPGFX_CODECID_ALPHA";
case RDPGFX_CODECID_CAPROGRESSIVE:
return "RDPGFX_CODECID_CAPROGRESSIVE";
case RDPGFX_CODECID_CAPROGRESSIVE_V2:
return "RDPGFX_CODECID_CAPROGRESSIVE_V2";
}
@ -109,7 +117,6 @@ UINT rdpgfx_read_header(wStream* s, RDPGFX_HEADER* header)
Stream_Read_UINT16(s, header->cmdId); /* cmdId (2 bytes) */
Stream_Read_UINT16(s, header->flags); /* flags (2 bytes) */
Stream_Read_UINT32(s, header->pduLength); /* pduLength (4 bytes) */
return CHANNEL_RC_OK;
}
@ -123,7 +130,6 @@ UINT rdpgfx_write_header(wStream* s, RDPGFX_HEADER* header)
Stream_Write_UINT16(s, header->cmdId); /* cmdId (2 bytes) */
Stream_Write_UINT16(s, header->flags); /* flags (2 bytes) */
Stream_Write_UINT32(s, header->pduLength); /* pduLength (4 bytes) */
return CHANNEL_RC_OK;
}
@ -142,7 +148,6 @@ UINT rdpgfx_read_point16(wStream* s, RDPGFX_POINT16* pt16)
Stream_Read_UINT16(s, pt16->x); /* x (2 bytes) */
Stream_Read_UINT16(s, pt16->y); /* y (2 bytes) */
return CHANNEL_RC_OK;
}
@ -155,7 +160,6 @@ UINT rdpgfx_write_point16(wStream* s, RDPGFX_POINT16* point16)
{
Stream_Write_UINT16(s, point16->x); /* x (2 bytes) */
Stream_Write_UINT16(s, point16->y); /* y (2 bytes) */
return CHANNEL_RC_OK;
}
@ -176,7 +180,6 @@ UINT rdpgfx_read_rect16(wStream* s, RECTANGLE_16* rect16)
Stream_Read_UINT16(s, rect16->top); /* top (2 bytes) */
Stream_Read_UINT16(s, rect16->right); /* right (2 bytes) */
Stream_Read_UINT16(s, rect16->bottom); /* bottom (2 bytes) */
return CHANNEL_RC_OK;
}
@ -191,7 +194,6 @@ UINT rdpgfx_write_rect16(wStream* s, RECTANGLE_16* rect16)
Stream_Write_UINT16(s, rect16->top); /* top (2 bytes) */
Stream_Write_UINT16(s, rect16->right); /* right (2 bytes) */
Stream_Write_UINT16(s, rect16->bottom); /* bottom (2 bytes) */
return CHANNEL_RC_OK;
}
@ -212,7 +214,6 @@ UINT rdpgfx_read_color32(wStream* s, RDPGFX_COLOR32* color32)
Stream_Read_UINT8(s, color32->G); /* G (1 byte) */
Stream_Read_UINT8(s, color32->R); /* R (1 byte) */
Stream_Read_UINT8(s, color32->XA); /* XA (1 byte) */
return CHANNEL_RC_OK;
}
@ -227,6 +228,5 @@ UINT rdpgfx_write_color32(wStream* s, RDPGFX_COLOR32* color32)
Stream_Write_UINT8(s, color32->G); /* G (1 byte) */
Stream_Write_UINT8(s, color32->R); /* R (1 byte) */
Stream_Write_UINT8(s, color32->XA); /* XA (1 byte) */
return CHANNEL_RC_OK;
}

View File

@ -26,21 +26,22 @@
#include <winpr/stream.h>
#include <freerdp/channels/rdpgfx.h>
#include <freerdp/api.h>
const char* rdpgfx_get_cmd_id_string(UINT16 cmdId);
const char* rdpgfx_get_codec_id_string(UINT16 codecId);
FREERDP_LOCAL const char* rdpgfx_get_cmd_id_string(UINT16 cmdId);
FREERDP_LOCAL const char* rdpgfx_get_codec_id_string(UINT16 codecId);
UINT rdpgfx_read_header(wStream* s, RDPGFX_HEADER* header);
UINT rdpgfx_write_header(wStream* s, RDPGFX_HEADER* header);
FREERDP_LOCAL UINT rdpgfx_read_header(wStream* s, RDPGFX_HEADER* header);
FREERDP_LOCAL UINT rdpgfx_write_header(wStream* s, RDPGFX_HEADER* header);
UINT rdpgfx_read_point16(wStream* s, RDPGFX_POINT16* pt16);
UINT rdpgfx_write_point16(wStream* s, RDPGFX_POINT16* point16);
FREERDP_LOCAL UINT rdpgfx_read_point16(wStream* s, RDPGFX_POINT16* pt16);
FREERDP_LOCAL UINT rdpgfx_write_point16(wStream* s, RDPGFX_POINT16* point16);
UINT rdpgfx_read_rect16(wStream* s, RECTANGLE_16* rect16);
UINT rdpgfx_write_rect16(wStream* s, RECTANGLE_16* rect16);
FREERDP_LOCAL UINT rdpgfx_read_rect16(wStream* s, RECTANGLE_16* rect16);
FREERDP_LOCAL UINT rdpgfx_write_rect16(wStream* s, RECTANGLE_16* rect16);
UINT rdpgfx_read_color32(wStream* s, RDPGFX_COLOR32* color32);
UINT rdpgfx_write_color32(wStream* s, RDPGFX_COLOR32* color32);
FREERDP_LOCAL UINT rdpgfx_read_color32(wStream* s, RDPGFX_COLOR32* color32);
FREERDP_LOCAL UINT rdpgfx_write_color32(wStream* s, RDPGFX_COLOR32* color32);
#endif /* FREERDP_CHANNEL_RDPGFX_CLIENT_COMMON_H */

View File

@ -345,8 +345,8 @@ static UINT rdpgfx_send_create_surface_pdu(RdpgfxServerContext* context,
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_send_delete_surface_pdu(RdpgfxServerContext* context,
RDPGFX_DELETE_SURFACE_PDU* pdu)
static UINT rdpgfx_send_delete_surface_pdu(RdpgfxServerContext* context,
RDPGFX_DELETE_SURFACE_PDU* pdu)
{
wStream* s = rdpgfx_server_single_packet_new(RDPGFX_CMDID_DELETESURFACE, 2);
@ -572,6 +572,7 @@ static UINT rdpgfx_write_surface_command(wStream* s,
UINT32 bitmapDataStart = 0;
UINT32 bitmapDataLength = 0;
UINT8 pixelFormat = 0;
switch (cmd->format)
{
case PIXEL_FORMAT_BGRX32:
@ -828,8 +829,8 @@ static UINT rdpgfx_send_delete_encoding_context_pdu(RdpgfxServerContext*
*
* @return 0 on success, otherwise a Win32 error code
*/
UINT rdpgfx_send_solid_fill_pdu(RdpgfxServerContext* context,
RDPGFX_SOLID_FILL_PDU* pdu)
static UINT rdpgfx_send_solid_fill_pdu(RdpgfxServerContext* context,
RDPGFX_SOLID_FILL_PDU* pdu)
{
UINT error = CHANNEL_RC_OK;
UINT16 index;
@ -1156,8 +1157,7 @@ static UINT rdpgfx_recv_caps_advertise_pdu(RdpgfxServerContext* context,
wStream* s)
{
UINT16 index;
RDPGFX_CAPSET* capsSet;
RDPGFX_CAPSET capsSets[3];
RDPGFX_CAPSET* capsSets;
RDPGFX_CAPS_ADVERTISE_PDU pdu;
UINT error = CHANNEL_RC_OK;
UINT32 capsDataLength;
@ -1170,24 +1170,22 @@ static UINT rdpgfx_recv_caps_advertise_pdu(RdpgfxServerContext* context,
Stream_Read_UINT16(s, pdu.capsSetCount); /* capsSetCount (2 bytes) */
if (pdu.capsSetCount > 3)
{
/* According to the latest spec, capsSetCount <= 3 */
WLog_ERR(TAG, "capsSetCount is greater than 3: %u", pdu.capsSetCount);
return ERROR_INVALID_DATA;
}
if (Stream_GetRemainingLength(s) < (pdu.capsSetCount * 12))
if (Stream_GetRemainingLength(s) < (pdu.capsSetCount * RDPGFX_CAPSET_SIZE))
{
WLog_ERR(TAG, "not enough data!");
return ERROR_INVALID_DATA;
}
capsSets = calloc(pdu.capsSetCount, RDPGFX_CAPSET_SIZE);
if (!capsSets)
return ERROR_OUTOFMEMORY;
pdu.capsSets = (RDPGFX_CAPSET*) capsSets;
for (index = 0; index < pdu.capsSetCount; index++)
{
capsSet = &(pdu.capsSets[index]);
RDPGFX_CAPSET* capsSet = &(pdu.capsSets[index]);
Stream_Read_UINT32(s, capsSet->version); /* version (4 bytes) */
Stream_Read_UINT32(s, capsDataLength); /* capsDataLength (4 bytes) */
@ -1195,6 +1193,7 @@ static UINT rdpgfx_recv_caps_advertise_pdu(RdpgfxServerContext* context,
{
WLog_ERR(TAG, "capsDataLength does not equal to 4: %lu",
capsDataLength);
free(capsSets);
return ERROR_INVALID_DATA;
}
@ -1209,6 +1208,7 @@ static UINT rdpgfx_recv_caps_advertise_pdu(RdpgfxServerContext* context,
WLog_ERR(TAG, "context->CapsAdvertise failed with error %lu", error);
}
free(capsSets);
return error;
}
@ -1576,7 +1576,7 @@ void rdpgfx_server_context_free(RdpgfxServerContext* context)
free(context);
}
FREERDP_API HANDLE rdpgfx_server_get_event_handle(RdpgfxServerContext* context)
HANDLE rdpgfx_server_get_event_handle(RdpgfxServerContext* context)
{
return context->priv->channelEvent;
}

View File

@ -136,8 +136,8 @@ static BOOL wl_pre_connect(freerdp* instance)
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
PubSub_SubscribeChannelConnected(instance->context->pubSub,

View File

@ -1112,8 +1112,8 @@ static BOOL xf_pre_connect(freerdp* instance)
settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
settings->OrderSupport[NEG_POLYGON_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
PubSub_SubscribeChannelConnected(instance->context->pubSub,

View File

@ -86,13 +86,15 @@ struct _RDPGFX_HEADER
typedef struct _RDPGFX_HEADER RDPGFX_HEADER;
/**
* Capability Sets
* Capability Sets [MS-RDPEGFX] 2.2.3
*/
#define RDPGFX_CAPVERSION_8 0x00080004
#define RDPGFX_CAPVERSION_81 0x00080105
#define RDPGFX_CAPVERSION_10 0x000A0002
#define RDPGFX_CAPVERSION_8 0x00080004 /** [MS-RDPEGFX] 2.2.3.1 */
#define RDPGFX_CAPVERSION_81 0x00080105 /** [MS-RDPEGFX] 2.2.3.2 */
#define RDPGFX_CAPVERSION_10 0x000A0002 /** [MS-RDPEGFX] 2.2.3.3 */
#define RDPGFX_CAPVERSION_102 0x000A0200 /** [MS-RDPEGFX] 2.2.3.4 */
#define RDPGFX_NUMBER_CAPSETS 4
#define RDPGFX_CAPSET_SIZE 12
struct _RDPGFX_CAPSET

View File

@ -617,19 +617,37 @@ static UINT shadow_client_rdpgfx_qoe_frame_acknowledge(RdpgfxServerContext*
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context, RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise)
static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise)
{
UINT16 index;
RDPGFX_CAPS_CONFIRM_PDU pdu;
rdpSettings* settings = context->rdpcontext->settings;
UINT32 flags = 0;
/* Request full screen update for new gfx channel */
shadow_client_refresh_rect((rdpShadowClient *)context->custom, 0, NULL);
shadow_client_refresh_rect((rdpShadowClient*)context->custom, 0, NULL);
for (index = 0; index < capsAdvertise->capsSetCount; index++)
{
pdu.capsSet = &(capsAdvertise->capsSets[index]);
if (pdu.capsSet->version == RDPGFX_CAPVERSION_102)
{
if (settings)
{
flags = pdu.capsSet->flags;
settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE);
settings->GfxH264 = !(flags & RDPGFX_CAPS_FLAG_AVC_DISABLED);
}
return context->CapsConfirm(context, &pdu);
}
}
for (index = 0; index < capsAdvertise->capsSetCount; index++)
{
pdu.capsSet = &(capsAdvertise->capsSets[index]);
if (pdu.capsSet->version == RDPGFX_CAPVERSION_10)
{
if (settings)
@ -642,6 +660,7 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context, RD
return context->CapsConfirm(context, &pdu);
}
}
for (index = 0; index < capsAdvertise->capsSetCount; index++)
{
if (pdu.capsSet->version == RDPGFX_CAPVERSION_81)
@ -657,6 +676,7 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context, RD
return context->CapsConfirm(context, &pdu);
}
}
for (index = 0; index < capsAdvertise->capsSetCount; index++)
{
if (pdu.capsSet->version == RDPGFX_CAPVERSION_8)