Commit 67d2e229 authored by Siarhei Siamashka's avatar Siarhei Siamashka
Browse files

DRI2: Debugging code for testing the frames order correctness



If DEBUG_WITH_RGB_PATTERN is defined, then we check that the
frames colors are changed as "R -> G -> B -> R -> G -> ..."
pattern and print debugging messages when this is not the
case. Such color change pattern can be generated by the
"test/gles-rgb-cycle-demo.c" program.
Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
parent e30ea496
...@@ -566,6 +566,47 @@ static void FlushOverlay(ScreenPtr pScreen) ...@@ -566,6 +566,47 @@ static void FlushOverlay(ScreenPtr pScreen)
} }
} }
#ifdef DEBUG_WITH_RGB_PATTERN
static void check_rgb_pattern(DRI2WindowStatePtr window_state,
UMPBufferInfoPtr umpbuf)
{
switch (*(uint32_t *)(umpbuf->addr + umpbuf->offs)) {
case 0xFFFF0000:
if (window_state->rgb_pattern_state == 0) {
ErrorF("starting RGB pattern with [Red]\n");
}
else if (window_state->rgb_pattern_state != 'B') {
ErrorF("warning - transition to [Red] not from [Blue]\n");
}
window_state->rgb_pattern_state = 'R';
break;
case 0xFF00FF00:
if (window_state->rgb_pattern_state == 0) {
ErrorF("starting RGB pattern with [Green]\n");
}
else if (window_state->rgb_pattern_state != 'R') {
ErrorF("warning - transition to [Green] not from [Red]\n");
}
window_state->rgb_pattern_state = 'G';
break;
case 0xFF0000FF:
if (window_state->rgb_pattern_state == 0) {
ErrorF("starting RGB pattern with [Blue]\n");
}
else if (window_state->rgb_pattern_state != 'G') {
ErrorF("warning - transition to [Blue] not from [Green]\n");
}
window_state->rgb_pattern_state = 'B';
break;
default:
if (window_state->rgb_pattern_state != 0) {
ErrorF("stopping RGB pattern\n");
}
window_state->rgb_pattern_state = 0;
}
}
#endif
static void MaliDRI2CopyRegion(DrawablePtr pDraw, static void MaliDRI2CopyRegion(DrawablePtr pDraw,
RegionPtr pRegion, RegionPtr pRegion,
DRI2BufferPtr pDstBuffer, DRI2BufferPtr pDstBuffer,
...@@ -607,6 +648,10 @@ static void MaliDRI2CopyRegion(DrawablePtr pDraw, ...@@ -607,6 +648,10 @@ static void MaliDRI2CopyRegion(DrawablePtr pDraw,
if (!umpbuf || !umpbuf->addr) if (!umpbuf || !umpbuf->addr)
return; return;
#ifdef DEBUG_WITH_RGB_PATTERN
check_rgb_pattern(window_state, umpbuf);
#endif
UpdateOverlay(pScreen); UpdateOverlay(pScreen);
if (!drvpriv->bOverlayWinEnabled || umpbuf->handle != UMP_INVALID_MEMORY_HANDLE) { if (!drvpriv->bOverlayWinEnabled || umpbuf->handle != UMP_INVALID_MEMORY_HANDLE) {
......
...@@ -97,6 +97,18 @@ typedef struct ...@@ -97,6 +97,18 @@ typedef struct
UMPBufferInfoPtr ump_queue[16]; UMPBufferInfoPtr ump_queue[16];
int ump_queue_head; int ump_queue_head;
int ump_queue_tail; int ump_queue_tail;
/*
* In the case DEBUG_WITH_RGB_PATTERN is defined, we add extra debugging
* code for verifying that for each new frame, the background color is
* changed as "R -> G -> B -> R -> G -> B -> ..." pattern and there are
* no violations of this color change order. It is intended to be used
* together with "test/gles-rgb-cycle-demo.c" program, which can generate
* such pattern.
*/
#ifdef DEBUG_WITH_RGB_PATTERN
char rgb_pattern_state;
#endif
} DRI2WindowStateRec, *DRI2WindowStatePtr; } DRI2WindowStateRec, *DRI2WindowStatePtr;
typedef struct { typedef struct {
......
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