kmsdrm: move FENCE FD props setting to SwapWindow(), where it belongs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index d79608c..ace1790 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -151,6 +151,18 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window)
return SDL_SetError("Failed to request prop changes for setting plane buffer and CRTC");
}
+ /* Set the IN_FENCE and OUT_FENCE props only here, since this is the only place
+ on which we're interested in managing who and when should access the buffers
+ that the display plane uses, and that's what these props are for. */
+ if (dispdata->kms_in_fence_fd != -1)
+ {
+ if (add_crtc_property(dispdata->atomic_req, dispdata->crtc, "OUT_FENCE_PTR",
+ VOID2U64(&dispdata->kms_out_fence_fd)) < 0)
+ return SDL_SetError("Failed to set CRTC OUT_FENCE_PTR prop");
+ if (add_plane_property(dispdata->atomic_req, dispdata->display_plane, "IN_FENCE_FD", dispdata->kms_in_fence_fd) < 0)
+ return SDL_SetError("Failed to set plane IN_FENCE_FD prop");
+ }
+
/* Issue the one and only atomic commit where all changes will be requested!.
We need e a non-blocking atomic commit for triple buffering, because we
must not block on this atomic commit so we can re-enter program loop once more. */
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index feae6ce..dbb7223 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -150,7 +150,7 @@ get_driindex(void)
#define VOID2U64(x) ((uint64_t)(unsigned long)(x))
static int add_connector_property(drmModeAtomicReq *req, struct connector *connector,
- const char *name, uint64_t value)
+ const char *name, uint64_t value)
{
unsigned int i;
int prop_id = 0;
@@ -170,8 +170,8 @@ static int add_connector_property(drmModeAtomicReq *req, struct connector *conne
return KMSDRM_drmModeAtomicAddProperty(req, connector->connector->connector_id, prop_id, value);
}
-static int add_crtc_property(drmModeAtomicReq *req, struct crtc *crtc,
- const char *name, uint64_t value)
+int add_crtc_property(drmModeAtomicReq *req, struct crtc *crtc,
+ const char *name, uint64_t value)
{
unsigned int i;
int prop_id = -1;
@@ -192,7 +192,7 @@ static int add_crtc_property(drmModeAtomicReq *req, struct crtc *crtc,
}
int add_plane_property(drmModeAtomicReq *req, struct plane *plane,
- const char *name, uint64_t value)
+ const char *name, uint64_t value)
{
unsigned int i;
int prop_id = -1;
@@ -493,18 +493,6 @@ drm_atomic_set_plane_props(struct KMSDRM_PlaneInfo *info)
if (add_plane_property(dispdata->atomic_req, info->plane, "CRTC_Y", info->crtc_y) < 0)
return SDL_SetError("Failed to set plane CRTC_Y prop");
- /* Set the IN_FENCE and OUT_FENCE props only if we're operating on the display plane,
- since that's the only plane for which we manage who and when should access the buffers
- it uses. */
- if (info->plane == dispdata->display_plane && dispdata->kms_in_fence_fd != -1)
- {
- if (add_crtc_property(dispdata->atomic_req, dispdata->crtc, "OUT_FENCE_PTR",
- VOID2U64(&dispdata->kms_out_fence_fd)) < 0)
- return SDL_SetError("Failed to set CRTC OUT_FENCE_PTR prop");
- if (add_plane_property(dispdata->atomic_req, info->plane, "IN_FENCE_FD", dispdata->kms_in_fence_fd) < 0)
- return SDL_SetError("Failed to set plane IN_FENCE_FD prop");
- }
-
return 0;
}
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h
index 102c2fd..fcc33a7 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h
@@ -161,6 +161,8 @@ void drm_atomic_waitpending(_THIS);
int drm_atomic_commit(_THIS, SDL_bool blocking);
int add_plane_property(drmModeAtomicReq *req, struct plane *plane,
const char *name, uint64_t value);
+int add_crtc_property(drmModeAtomicReq *req, struct crtc *crtc,
+ const char *name, uint64_t value);
int setup_plane(_THIS, struct plane **plane, uint32_t plane_type);
void free_plane(struct plane **plane);