Commit 03cfb069 authored by Marico Xu's avatar Marico Xu

Fix the wakeup handler lost and modify the logic of reporting damage

1. Init and fini wakeup handler during screen init/fini instead of preinit
   The frequent screen init/close will happen when the user do the test with
 only "X", that will trigger the wakeup handler does not take effect, 
 then some VBLANK events will not be obtained.
2. Update damage region only in the "exchange buffer" case
   there is no need to report damage in other flip/blit case in swapbuffer,
and we only need to report it when the app wants to notify the composite manager. 
   Otherwise, some pontential issues will happen in some versions of X

Change-Id: Ic0c73bc5f0bc6c24d5a31cf48e814af2d994c7f5
parent 85854e07
......@@ -787,13 +787,6 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
cmd->func = func;
cmd->data = data;
region.extents.x1 = region.extents.y1 = 0;
region.extents.x2 = pDstPixmap->drawable.width;
region.extents.y2 = pDstPixmap->drawable.height;
region.data = NULL;
DamageRegionAppend(&pDstPixmap->drawable, &region);
DamageRegionProcessPending(&pDstPixmap->drawable);
/* obtain extra ref on DRI buffers to avoid them going
* away while we await the page flip event.
*/
......@@ -930,6 +923,13 @@ ARMSOCDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw,
if (pSrcBuffer->attachment == DRI2BufferBackLeft)
nextBuffer(pDraw, ARMSOCBUF(pSrcBuffer));
region.extents.x1 = region.extents.y1 = 0;
region.extents.x2 = pDstPixmap->drawable.width;
region.extents.y2 = pDstPixmap->drawable.height;
region.data = NULL;
DamageRegionAppend(&pDstPixmap->drawable, &region);
DamageRegionProcessPending(&pDstPixmap->drawable);
cmd->type = DRI2_EXCHANGE_COMPLETE;
ARMSOCDRI2SwapComplete(cmd);
} else {
......
......@@ -312,7 +312,6 @@ ARMSOCOpenDRM(ScrnInfoPtr pScrn)
connection.fd = pARMSOC->drmFD;
connection.open_count = 1;
connection.master_count = 1;
drmmode_init_wakeup_handler(pARMSOC);
} else {
assert(connection.open_count);
connection.open_count++;
......@@ -337,7 +336,6 @@ ARMSOCCloseDRM(ScrnInfoPtr pScrn)
connection.open_count--;
if (!connection.open_count) {
assert(!connection.master_count);
drmmode_fini_wakeup_handler(pARMSOC);
drmClose(pARMSOC->drmFD);
connection.fd = -1;
}
......
......@@ -1923,11 +1923,15 @@ drmmode_wait_for_event(ScrnInfoPtr pScrn)
void
drmmode_screen_init(ScrnInfoPtr pScrn)
{
struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
drmmode_uevent_init(pScrn);
drmmode_init_wakeup_handler(pARMSOC);
}
void
drmmode_screen_fini(ScrnInfoPtr pScrn)
{
struct ARMSOCRec *pARMSOC = ARMSOCPTR(pScrn);
drmmode_uevent_fini(pScrn);
drmmode_fini_wakeup_handler(pARMSOC);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment