@@ -48,7 +48,7 @@ extern DeviceIntPtr lorieMouse, lorieKeyboard;
48
48
#define CREATE_PIXMAP_USAGE_LORIEBUFFER_BACKED 5
49
49
50
50
struct vblank {
51
- struct xorg_list list ;
51
+ struct xorg_list link ;
52
52
uint64_t id , msc ;
53
53
};
54
54
@@ -99,6 +99,8 @@ typedef struct {
99
99
void * mem ;
100
100
} LoriePixmapPriv ;
101
101
102
+ #define LORIE_BUFFER_FROM_PIXMAP (pixmap ) (pixmap ? ((LoriePixmapPriv*) exaGetPixmapDriverPrivate(pixmap))->buffer : NULL)
103
+
102
104
void OsVendorInit (void ) {
103
105
pthread_mutexattr_t mutex_attr ;
104
106
pthread_condattr_t cond_attr ;
@@ -128,8 +130,9 @@ void OsVendorInit(void) {
128
130
}
129
131
130
132
void lorieActivityConnected (void ) {
133
+ pvfb -> state -> drawRequested = pvfb -> state -> cursor .updated = true;
131
134
lorieSendSharedServerState (pvfb -> stateFd );
132
- lorieSendRootWindowBuffer ((( LoriePixmapPriv * ) exaGetPixmapDriverPrivate ( pScreenPtr -> devPrivate )) -> buffer );
135
+ lorieSendRootWindowBuffer (LORIE_BUFFER_FROM_PIXMAP ( pScreenPtr -> devPrivate ));
133
136
}
134
137
135
138
static LoriePixmapPriv * lorieRootWindowPixmapPriv (void ) {
@@ -404,7 +407,11 @@ static Bool lorieRedraw(__unused ClientPtr pClient, __unused void *closure) {
404
407
nonEmpty = RegionNotEmpty (DamageRegion (pvfb -> damage ));
405
408
priv = lorieRootWindowPixmapPriv ();
406
409
407
- if (nonEmpty && priv && priv -> buffer ) {
410
+ if (!priv )
411
+ // Impossible situation, but let's skip this step
412
+ return TRUE;
413
+
414
+ if (nonEmpty && priv -> buffer ) {
408
415
// We should unlock and lock buffer in order to update texture content on some devices
409
416
// In most cases AHardwareBuffer uses DMA memory which is shared between CPU and GPU
410
417
// and this is not needed. But according to docs we should do it for any case.
@@ -420,6 +427,8 @@ static Bool lorieRedraw(__unused ClientPtr pClient, __unused void *closure) {
420
427
}
421
428
422
429
if (pvfb -> state -> drawRequested || pvfb -> state -> cursor .moved || pvfb -> state -> cursor .updated ) {
430
+ pvfb -> state -> rootWindowTextureID = LorieBuffer_description (priv -> buffer )-> id ;
431
+
423
432
// Sending signal about pending root window changes to renderer thread.
424
433
// We do not explicitly lock the pvfb->state->lock here because we do not want to wait
425
434
// for all drawing operations to be finished.
@@ -448,7 +457,7 @@ static Bool lorieCreateScreenResources(ScreenPtr pScreen) {
448
457
DamageRegister (& (* pScreen -> GetScreenPixmap )(pScreen )-> drawable , pvfb -> damage );
449
458
pvfb -> fpsTimer = TimerSet (NULL , 0 , 5000 , lorieFramecounter , pScreen );
450
459
451
- lorieSendRootWindowBuffer ((( LoriePixmapPriv * ) exaGetPixmapDriverPrivate ( pScreen -> devPrivate )) -> buffer );
460
+ lorieSendRootWindowBuffer (LORIE_BUFFER_FROM_PIXMAP ( pScreen -> devPrivate ));
452
461
453
462
return TRUE;
454
463
}
@@ -508,7 +517,7 @@ static Bool lorieRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
508
517
pScreen -> DestroyPixmap (oldPixmap );
509
518
}
510
519
511
- lorieSendRootWindowBuffer ((( LoriePixmapPriv * ) exaGetPixmapDriverPrivate ( pScreen -> devPrivate )) -> buffer );
520
+ lorieSendRootWindowBuffer (LORIE_BUFFER_FROM_PIXMAP ( pScreen -> devPrivate ));
512
521
513
522
pScreen -> ResizeWindow (pScreen -> root , 0 , 0 , width , height , NULL );
514
523
RegionReset (& pScreen -> root -> winSize , & box );
@@ -699,7 +708,7 @@ static Bool loriePresentQueueVblank(__unused RRCrtcPtr crtc, uint64_t event_id,
699
708
return BadAlloc ;
700
709
701
710
* vblank = (struct vblank ) { .id = event_id , .msc = msc };
702
- xorg_list_add (& vblank -> list , & pvfb -> vblank_queue );
711
+ xorg_list_add (& vblank -> link , & pvfb -> vblank_queue );
703
712
704
713
return Success ;
705
714
#pragma clang diagnostic pop
@@ -708,9 +717,9 @@ static Bool loriePresentQueueVblank(__unused RRCrtcPtr crtc, uint64_t event_id,
708
717
static void loriePresentAbortVblank (__unused RRCrtcPtr crtc , uint64_t id , __unused uint64_t msc ) {
709
718
struct vblank * vblank , * tmp ;
710
719
711
- xorg_list_for_each_entry_safe (vblank , tmp , & pvfb -> vblank_queue , list ) {
720
+ xorg_list_for_each_entry_safe (vblank , tmp , & pvfb -> vblank_queue , link ) {
712
721
if (vblank -> id == id ) {
713
- xorg_list_del (& vblank -> list );
722
+ xorg_list_del (& vblank -> link );
714
723
free (vblank );
715
724
break ;
716
725
}
@@ -722,11 +731,11 @@ static void loriePerformVblanks(void) {
722
731
uint64_t ust , msc ;
723
732
pvfb -> current_msc ++ ;
724
733
725
- xorg_list_for_each_entry_safe (vblank , tmp , & pvfb -> vblank_queue , list ) {
734
+ xorg_list_for_each_entry_safe (vblank , tmp , & pvfb -> vblank_queue , link ) {
726
735
if (vblank -> msc <= pvfb -> current_msc ) {
727
736
loriePresentGetUstMsc (NULL , & ust , & msc );
728
737
present_event_notify (vblank -> id , ust , msc );
729
- xorg_list_del (& vblank -> list );
738
+ xorg_list_del (& vblank -> link );
730
739
free (vblank );
731
740
}
732
741
}
0 commit comments