1- diff -ruN westeros-soc.orig/drm/westeros-gl/westeros-gl.c westeros-soc/drm/westeros-gl/westeros-gl.c
2- --- westeros-soc.orig/drm/westeros-gl/westeros-gl.c 2021-06-04 21:14:52.000000000 +0530
3- +++ westeros-soc/drm/westeros-gl/westeros-gl.c 2021-06-24 15:42:12.565757151 +0530
4- @@ -65,7 +65,7 @@
1+ diff --git a/drm/westeros-gl/westeros-gl.c b/drm/westeros-gl/westeros-gl.c
2+ index 38559ba..42a6174 100644
3+ --- a/drm/westeros-gl/westeros-gl.c
4+ +++ b/drm/westeros-gl/westeros-gl.c
5+ @@ -66,7 +66,7 @@
56 #define TRACE3(...) INT_TRACE3(__VA_ARGS__, "")
67 #define FRAME(...) INT_FRAME(__VA_ARGS__, "")
78
@@ -10,13 +11,16 @@ diff -ruN westeros-soc.orig/drm/westeros-gl/westeros-gl.c westeros-soc/drm/weste
1011 #ifdef WESTEROS_PLATFORM_QEMUX86
1112 #define DEFAULT_MODE_WIDTH (1280)
1213 #define DEFAULT_MODE_HEIGHT (1024)
13- @@ -3627,10 +3627,12 @@
14- drmver->desc_len, drmver->desc );
15-
16- len= strlen( drmver->name );
17- - if ( (len == 5) && !strncmp( drmver->name, "meson", len ) )
18- + if ( ((len == 5) && !strncmp( drmver->name, "meson", len )) ||
19- + ((len == 3) && !strncmp( drmver->name, "vc4", len )) )
14+ @@ -336,6 +336,7 @@ typedef struct _WstGLCtx
15+ bool useVideoServer;
16+ bool usePlanes;
17+ bool useGBMModifiers;
18+ + bool useZPos;
19+ bool haveAtomic;
20+ bool haveNativeFence;
21+ bool graphicsPreferPrimary;
22+ @@ -3655,7 +3656,8 @@ static WstGLCtx *wstInitCtx( void )
23+ ((len == 3) && !strncmp( drmver->name, "vc4", len )) )
2024 {
2125 #ifdef USE_REFRESH_LOCK
2226- if ( getenv("WESTEROS_GL_USE_REFRESH_LOCK") )
@@ -25,3 +29,76 @@ diff -ruN westeros-soc.orig/drm/westeros-gl/westeros-gl.c westeros-soc/drm/weste
2529 {
2630 g_useRefreshLock= true;
2731
32+ @@ -3669,6 +3671,11 @@ static WstGLCtx *wstInitCtx( void )
33+ wstInitUEvent( ctx );
34+ #endif
35+ }
36+ + if ( (len == 3) && !strncmp( drmver->name, "vc4", len ) )
37+ + {
38+ + ctx->useZPos= true;
39+ + INFO("using zpos");
40+ + }
41+
42+ drmFreeVersion( drmver );
43+ }
44+ @@ -3882,6 +3889,10 @@ static WstGLCtx *wstInitCtx( void )
45+ else if ( (len == 4) && !strncmp( prop->name, "zpos", len) )
46+ {
47+ zpos= props->prop_values[j];
48+ + if ( prop->flags & DRM_MODE_PROP_IMMUTABLE )
49+ + {
50+ + ctx->useZPos= false;
51+ + }
52+ }
53+ }
54+ }
55+ @@ -3934,7 +3945,22 @@ static WstGLCtx *wstInitCtx( void )
56+ newPlane->plane= plane;
57+ newPlane->supportsVideo= isVideo;
58+ newPlane->supportsGraphics= isGraphics;
59+ - newPlane->zOrder= n + zpos*16+((isVideo && !isGraphics) ? 0 : 256);
60+ + if ( ctx->useZPos )
61+ + {
62+ + newPlane->zOrder= n;
63+ + if ( isPrimary )
64+ + {
65+ + newPlane->zOrder += planeRes->count_planes;
66+ + }
67+ + else if ( isGraphics && !isVideo )
68+ + {
69+ + newPlane->zOrder += planeRes->count_planes*2;
70+ + }
71+ + }
72+ + else
73+ + {
74+ + newPlane->zOrder= n + zpos*16+((isVideo && !isGraphics) ? 0 : 256);
75+ + }
76+ newPlane->inUse= false;
77+ newPlane->crtc_id= ctx->enc->crtc_id;
78+ for( i= 0; i < ACTIVE_FRAMES; ++i )
79+ @@ -5161,6 +5187,12 @@ static void wstSwapDRMBuffersAtomic( WstGLCtx *ctx )
80+ wstAtomicAddProperty( ctx, req, nw->windowPlane->plane->plane_id,
81+ nw->windowPlane->planeProps->count_props, nw->windowPlane->planePropRes,
82+ "IN_FENCE_FD", -1 );
83+ + if ( ctx->useZPos )
84+ + {
85+ + wstAtomicAddProperty( ctx, req, nw->windowPlane->plane->plane_id,
86+ + nw->windowPlane->planeProps->count_props, nw->windowPlane->planePropRes,
87+ + "zpos", nw->windowPlane->zOrder );
88+ + }
89+ }
90+ }
91+ }
92+ @@ -5334,6 +5366,12 @@ static void wstSwapDRMBuffersAtomic( WstGLCtx *ctx )
93+ wstAtomicAddProperty( ctx, req, iter->plane->plane_id,
94+ iter->planeProps->count_props, iter->planePropRes,
95+ "IN_FENCE_FD", -1 );
96+ + if ( ctx->useZPos )
97+ + {
98+ + wstAtomicAddProperty( ctx, req, iter->plane->plane_id,
99+ + iter->planeProps->count_props, iter->planePropRes,
100+ + "zpos", iter->zOrder );
101+ + }
102+
103+ FRAME("commit frame %d buffer %d", iter->videoFrame[FRAME_CURR].frameNumber, iter->videoFrame[FRAME_CURR].bufferId);
104+ avProgLog( iter->videoFrame[FRAME_CURR].frameTime*1000LL, 0, "WtoD", "");
0 commit comments