kmsdrm: remove redundant function, use drm_atomic_setbuffers() for disconnecting planes instead.
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 89 90 91 92 93 94 95 96 97 98 99 100
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index 29a3478..4b3f6e0 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -119,7 +119,7 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window)
}
/* Add the pageflip to te request list. */
- drm_atomic_setbuffer(_this, dispdata->display_plane, fb->fb_id);
+ drm_atomic_setbuffer(_this, dispdata->display_plane, fb->fb_id, dispdata->crtc->crtc->crtc_id);
/* 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
@@ -188,7 +188,7 @@ KMSDRM_GLES_SwapWindowDB(_THIS, SDL_Window * window)
}
/* Add the pageflip to te request list. */
- drm_atomic_setbuffer(_this, dispdata->display_plane, fb->fb_id);
+ drm_atomic_setbuffer(_this, dispdata->display_plane, fb->fb_id, dispdata->crtc->crtc->crtc_id);
/* Issue the one and only atomic commit where all changes will be requested!.
Blocking for double buffering: won't return until completed. */
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 57c24ad..b8f0d1c 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -466,7 +466,7 @@ free_plane(struct plane **plane) {
/* buffers and/or the GBM surface containig them. */
/**********************************************************************************/
void
-drm_atomic_setbuffer(_THIS, struct plane *plane, uint32_t fb_id)
+drm_atomic_setbuffer(_THIS, struct plane *plane, uint32_t fb_id, uint32_t crtc_id)
{
SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
@@ -475,7 +475,7 @@ drm_atomic_setbuffer(_THIS, struct plane *plane, uint32_t fb_id)
dispdata->atomic_req = KMSDRM_drmModeAtomicAlloc();
add_plane_property(dispdata->atomic_req, plane, "FB_ID", fb_id);
- add_plane_property(dispdata->atomic_req, plane, "CRTC_ID", dispdata->crtc->crtc->crtc_id);
+ add_plane_property(dispdata->atomic_req, plane, "CRTC_ID", crtc_id);
add_plane_property(dispdata->atomic_req, plane, "SRC_W", dispdata->mode.hdisplay << 16);
add_plane_property(dispdata->atomic_req, plane, "SRC_H", dispdata->mode.vdisplay << 16);
add_plane_property(dispdata->atomic_req, plane, "SRC_X", 0);
@@ -492,33 +492,6 @@ drm_atomic_setbuffer(_THIS, struct plane *plane, uint32_t fb_id)
}
}
-void
-drm_atomic_unsetbuffer(_THIS, struct plane *plane)
-{
- SDL_DisplayData *dispdata = (SDL_DisplayData *)SDL_GetDisplayDriverData(0);
-
- /* Do we have a set of changes already in the making? If not, allocate a new one. */
- if (!dispdata->atomic_req)
- dispdata->atomic_req = KMSDRM_drmModeAtomicAlloc();
-
- add_plane_property(dispdata->atomic_req, plane, "FB_ID", 0);
- add_plane_property(dispdata->atomic_req, plane, "CRTC_ID", 0);
- add_plane_property(dispdata->atomic_req, plane, "SRC_W", 0);
- add_plane_property(dispdata->atomic_req, plane, "SRC_H", 0);
- add_plane_property(dispdata->atomic_req, plane, "SRC_X", 0);
- add_plane_property(dispdata->atomic_req, plane, "SRC_Y", 0);
- add_plane_property(dispdata->atomic_req, plane, "CRTC_W", 0);
- add_plane_property(dispdata->atomic_req, plane, "CRTC_H", 0);
- add_plane_property(dispdata->atomic_req, plane, "CRTC_X", 0);
- add_plane_property(dispdata->atomic_req, plane, "CRTC_Y", 0);
-
- if (dispdata->kms_in_fence_fd != -1) {
- add_crtc_property(dispdata->atomic_req, dispdata->crtc, "OUT_FENCE_PTR",
- VOID2U64(&dispdata->kms_out_fence_fd));
- add_plane_property(dispdata->atomic_req, plane, "IN_FENCE_FD", dispdata->kms_in_fence_fd);
- }
-}
-
int
drm_atomic_setcursor(KMSDRM_CursorData *curdata, int x, int y)
{
@@ -849,7 +822,7 @@ KMSDRM_DestroySurfaces(_THIS, SDL_Window * window)
the display plane from the GBM surface buffer it's reading by setting
it's CRTC_ID and FB_ID props to 0.
*/
- drm_atomic_unsetbuffer(_this, dispdata->display_plane);
+ drm_atomic_setbuffer(_this, dispdata->display_plane, 0, 0);
drm_atomic_commit(_this, SDL_TRUE);
if (windata->bo) {
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.h b/src/video/kmsdrm/SDL_kmsdrmvideo.h
index fe15b71..9948897 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.h
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.h
@@ -138,7 +138,7 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo);
/* Atomic functions that are used from SDL_kmsdrmopengles.c and SDL_kmsdrmmouse.c */
void drm_atomic_modeset(_THIS, int mode_index);
-void drm_atomic_setbuffer(_THIS, struct plane *plane, uint32_t fb_id);
+void drm_atomic_setbuffer(_THIS, struct plane *plane, uint32_t fb_id, uint32_t crtc_id);
void drm_atomic_waitpending(_THIS);
int drm_atomic_commit(_THIS, SDL_bool blocking);
int drm_atomic_setcursor(KMSDRM_CursorData *curdata, int x, int y);