@@ -41,12 +41,16 @@ RandR draw calls
41
41
#include <fb.h>
42
42
#include <micmap.h>
43
43
#include <mi.h>
44
+ #include <pixman.h>
45
+ #include <xorg/rrtransform.h>
46
+ #include <xorg/picturestr.h>
44
47
45
48
#include "rdp.h"
46
49
#include "rdpDraw.h"
47
50
#include "rdpReg.h"
48
51
#include "rdpMisc.h"
49
52
#include "rdpRandR.h"
53
+ #include "rdpClientCon.h"
50
54
51
55
#if defined(XORGXRDP_GLAMOR )
52
56
#include <glamor.h>
@@ -364,9 +368,42 @@ rdpRRSetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea,
364
368
return TRUE;
365
369
}
366
370
371
+ /******************************************************************************/
372
+ static void
373
+ rdpRRSetOutputPhysicalSize (const char * func , RROutputPtr output ,
374
+ struct monitor_info * monitor )
375
+ {
376
+ if (monitor -> physical_height == 0 || monitor -> physical_width == 0 )
377
+ {
378
+ return ;
379
+ }
380
+ if (!RROutputSetPhysicalSize (output ,
381
+ monitor -> physical_width , monitor -> physical_height ))
382
+ {
383
+ LLOGLN (0 , ("%s: RROutputSetPhysicalSize failed" , func ));
384
+ }
385
+ }
386
+
387
+ /******************************************************************************/
388
+ static Rotation
389
+ rdpGetRotation (uint32_t orientation )
390
+ {
391
+ switch (orientation )
392
+ {
393
+ case 90 :
394
+ return RR_Rotate_90 ;
395
+ case 180 :
396
+ return RR_Rotate_180 ;
397
+ case 270 :
398
+ return RR_Rotate_270 ;
399
+ default :
400
+ return RR_Rotate_0 ;
401
+ }
402
+ }
403
+
367
404
/******************************************************************************/
368
405
static RROutputPtr
369
- rdpRRAddOutput (rdpPtr dev , const char * aname , int x , int y , int width , int height )
406
+ rdpRRAddOutput (rdpPtr dev , const char * aname , struct monitor_info * monitor )
370
407
{
371
408
RRModePtr mode ;
372
409
RRCrtcPtr crtc ;
@@ -375,6 +412,10 @@ rdpRRAddOutput(rdpPtr dev, const char *aname, int x, int y, int width, int heigh
375
412
char name [64 ];
376
413
const int vfreq = 50 ;
377
414
int i ;
415
+ int width = (monitor -> right - monitor -> left + 1 );
416
+ int height = (monitor -> bottom - monitor -> top + 1 );
417
+ int x = monitor -> left ;
418
+ int y = monitor -> top ;
378
419
379
420
sprintf (name , "%dx%d" , width , height );
380
421
memset (& modeInfo , 0 , sizeof (modeInfo ));
@@ -416,6 +457,7 @@ rdpRRAddOutput(rdpPtr dev, const char *aname, int x, int y, int width, int heigh
416
457
RRModeDestroy (mode );
417
458
return 0 ;
418
459
}
460
+ rdpRRSetOutputPhysicalSize (__func__ , output , monitor );
419
461
if (!RROutputSetClones (output , NULL , 0 ))
420
462
{
421
463
LLOGLN (0 , ("rdpRRAddOutput: RROutputSetClones failed" ));
@@ -432,19 +474,24 @@ rdpRRAddOutput(rdpPtr dev, const char *aname, int x, int y, int width, int heigh
432
474
{
433
475
LLOGLN (0 , ("rdpRRAddOutput: RROutputSetConnection failed" ));
434
476
}
435
- RRCrtcNotify (crtc , mode , x , y , RR_Rotate_0 , NULL , 1 , & output );
477
+ RRCrtcNotify (crtc , mode , x , y , rdpGetRotation (monitor -> orientation ),
478
+ NULL , 1 , & output );
436
479
return output ;
437
480
}
438
481
439
482
/******************************************************************************/
440
483
static RROutputPtr
441
484
rdpRRUpdateOutput (RROutputPtr output , RRCrtcPtr crtc ,
442
- int x , int y , int width , int height )
485
+ struct monitor_info * monitor )
443
486
{
444
487
RRModePtr mode ;
445
488
xRRModeInfo modeInfo ;
446
489
char name [64 ];
447
490
const int vfreq = 50 ;
491
+ int width = monitor -> right - monitor -> left + 1 ;
492
+ int height = monitor -> bottom - monitor -> top + 1 ;
493
+ int x = monitor -> left ;
494
+ int y = monitor -> top ;
448
495
449
496
LLOGLN (0 , ("rdpRRUpdateOutput:" ));
450
497
sprintf (name , "%dx%d" , width , height );
@@ -465,7 +512,9 @@ rdpRRUpdateOutput(RROutputPtr output, RRCrtcPtr crtc,
465
512
{
466
513
LLOGLN (0 , ("rdpRRUpdateOutput: RROutputSetModes failed" ));
467
514
}
468
- RRCrtcNotify (crtc , mode , x , y , RR_Rotate_0 , NULL , 1 , & output );
515
+ rdpRRSetOutputPhysicalSize (__func__ , output , monitor );
516
+ RRCrtcNotify (crtc , mode , x , y , rdpGetRotation (monitor -> orientation ),
517
+ NULL , 1 , & output );
469
518
RROutputChanged (output , 1 );
470
519
return output ;
471
520
}
@@ -516,14 +565,10 @@ rdpRRRemoveExtra(rrScrPrivPtr pRRScrPriv, int count)
516
565
517
566
/******************************************************************************/
518
567
int
519
- rdpRRSetRdpOutputs (rdpPtr dev )
568
+ rdpRRSetRdpOutputs (rdpPtr dev , rdpClientCon * clientCon )
520
569
{
521
570
rrScrPrivPtr pRRScrPriv ;
522
571
int index ;
523
- int left ;
524
- int top ;
525
- int width ;
526
- int height ;
527
572
char text [256 ];
528
573
RROutputPtr output ;
529
574
@@ -532,29 +577,40 @@ rdpRRSetRdpOutputs(rdpPtr dev)
532
577
pRRScrPriv -> numCrtcs , pRRScrPriv -> numOutputs , dev -> monitorCount ));
533
578
if (dev -> monitorCount <= 0 )
534
579
{
535
- left = 0 ;
536
- top = 0 ;
537
- width = dev -> width ;
538
- height = dev -> height ;
580
+ struct monitor_info monitor ;
581
+ memset (& monitor , 0 , sizeof (monitor ));
582
+ monitor .top = 0 ;
583
+ monitor .left = 0 ;
584
+ monitor .right = dev -> width - 1 ;
585
+ monitor .bottom = dev -> height - 1 ;
586
+ monitor .physical_width
587
+ = clientCon -> client_info .display_sizes .session_width ;
588
+ monitor .physical_height
589
+ = clientCon -> client_info .display_sizes .session_height ;
590
+ monitor .orientation = 0 ;
591
+ monitor .desktop_scale_factor = 100 ;
592
+ monitor .device_scale_factor = 100 ;
593
+
539
594
if (pRRScrPriv -> numCrtcs > 0 )
540
595
{
541
596
/* update */
542
597
LLOGLN (0 , ("rdpRRSetRdpOutputs: update output %d "
543
- "left %d top %d width %d height %d" ,
544
- 0 , left , top , width , height ));
598
+ "left %d top %d right %d bottom %d" ,
599
+ 0 , monitor .left , monitor .top ,
600
+ monitor .right , monitor .bottom ));
545
601
output = rdpRRUpdateOutput (pRRScrPriv -> outputs [0 ],
546
602
pRRScrPriv -> crtcs [0 ],
547
- left , top , width , height );
603
+ & monitor );
548
604
}
549
605
else
550
606
{
551
607
/* add */
552
608
LLOGLN (0 , ("rdpRRSetRdpOutputs: add output %d "
553
- "left %d top %d width %d height %d" ,
554
- 0 , left , top , width , height ));
609
+ "left %d top %d right %d bottom %d" ,
610
+ 0 , monitor .left , monitor .top ,
611
+ monitor .right , monitor .bottom ));
555
612
snprintf (text , 255 , "rdp%d" , 0 );
556
- output = rdpRRAddOutput (dev , text ,
557
- left , top , width , height );
613
+ output = rdpRRAddOutput (dev , text , & monitor );
558
614
}
559
615
if (output == NULL )
560
616
{
@@ -568,29 +624,28 @@ rdpRRSetRdpOutputs(rdpPtr dev)
568
624
{
569
625
for (index = 0 ; index < dev -> monitorCount ; index ++ )
570
626
{
571
- left = dev -> minfo [index ].left ;
572
- top = dev -> minfo [index ].top ;
573
- width = dev -> minfo [index ].right - dev -> minfo [index ].left + 1 ;
574
- height = dev -> minfo [index ].bottom - dev -> minfo [index ].top + 1 ;
575
627
if (index < pRRScrPriv -> numCrtcs )
576
628
{
577
629
/* update */
578
630
LLOGLN (0 , ("rdpRRSetRdpOutputs: update output %d "
579
- "left %d top %d width %d height %d" ,
580
- index , left , top , width , height ));
631
+ "left %d top %d right %d bottom %d scale %d" ,
632
+ index , dev -> minfo [index ].left , dev -> minfo [index ].top ,
633
+ dev -> minfo [index ].right , dev -> minfo [index ].bottom ,
634
+ dev -> minfo [index ].desktop_scale_factor ));
581
635
output = rdpRRUpdateOutput (pRRScrPriv -> outputs [index ],
582
636
pRRScrPriv -> crtcs [index ],
583
- left , top , width , height );
637
+ & dev -> minfo [ index ] );
584
638
}
585
639
else
586
640
{
587
641
/* add */
588
642
LLOGLN (0 , ("rdpRRSetRdpOutputs: add output %d "
589
- "left %d top %d width %d height %d" ,
590
- index , left , top , width , height ));
643
+ "left %d top %d right %d bottom %d scale %d" ,
644
+ index , dev -> minfo [index ].left , dev -> minfo [index ].top ,
645
+ dev -> minfo [index ].right , dev -> minfo [index ].bottom ,
646
+ dev -> minfo [index ].desktop_scale_factor ));
591
647
snprintf (text , 255 , "rdp%d" , index );
592
- output = rdpRRAddOutput (dev , text ,
593
- left , top , width , height );
648
+ output = rdpRRAddOutput (dev , text , & dev -> minfo [index ]);
594
649
}
595
650
if ((output != 0 ) && (dev -> minfo [index ].is_primary ))
596
651
{
0 commit comments