Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
kmsdrm: remove redundant function, use drm_atomic_setbuffers() for di…
…sconnecting planes instead.
  • Loading branch information
vanfanel committed Aug 23, 2020
1 parent 16c04f2 commit 0b7b772
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/video/kmsdrm/SDL_kmsdrmopengles.c
Expand Up @@ -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
Expand Down Expand Up @@ -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. */
Expand Down
33 changes: 3 additions & 30 deletions src/video/kmsdrm/SDL_kmsdrmvideo.c
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/kmsdrm/SDL_kmsdrmvideo.h
Expand Up @@ -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);
Expand Down

0 comments on commit 0b7b772

Please sign in to comment.