[KMS/DRM] Unused code cleaning.
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c
index 4b25620..a20a494 100644
--- a/src/video/kmsdrm/SDL_kmsdrmopengles.c
+++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -72,7 +72,12 @@ SDL_EGL_CreateContext_impl(KMSDRM)
int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) {
- /*
+ /* Issuing a new pageflip before the previous has completed
+ causes drmModePageFlip() to return EBUSY errors.
+ So just set egl_swapinterval to 1 to prevent that. */
+
+#if 0
+
if (!_this->egl_data) {
return SDL_SetError("EGL not initialized");
}
@@ -81,23 +86,14 @@ int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) {
_this->egl_data->egl_swapinterval = interval;
} else {
return SDL_SetError("Only swap intervals of 0 or 1 are supported");
- }*/
+ }
+#endif
- /* Issuing a new pageflip before the previous has completed
- causes drmModePageFlip() to return EBUSY errors. Don't do it. */
_this->egl_data->egl_swapinterval = 1;
return 0;
}
-/* Check if we need to re-create the GBM and EGL surfaces and setup a new mode on the CRTC
- matching the new GBM surface size so the buffers from these surfaces can be displayed
- on the CRTC (remember we need the CRTC mode and the buffer size to match). */
-/*KMSDRM_CheckKMSDRM (_THIS, window) {
-
-
-}*/
-
int
KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
SDL_WindowData *windata = ((SDL_WindowData *) window->driverdata);
@@ -147,47 +143,6 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
return 0;
}
-#if 0
- /* Get an actual usable fb (of the specified dimensions) form the BO,
- so we can pass it to the CRTC. */
- fb_info = KMSDRM_FBFromBO2(_this, windata->next_bo, window->w, window->h);
- if (!fb_info) {
- return 0;
- }
-#endif
-
-#if 0
- /* If the window size does not match the current videomode configured on the CRTC,
- update the current video mode and configure the new mode on the CRTC. */
- if (dispdata->mode.hdisplay != window->w || dispdata->mode.vdisplay != window->h) {
- for (int i = 0; i < dispdata->connector->count_modes; i++) {
- drmModeModeInfo mode = dispdata->connector->modes[i] ;
- if (mode.hdisplay == window->w && mode.vdisplay == window->h) {
- dispdata->mode = mode;
- ret = KMSDRM_drmModeSetCrtc(viddata->drm_fd,
- dispdata->crtc->crtc_id, fb_info->fb_id, 0, 0,
- &dispdata->connector->connector_id, 1, &dispdata->mode);
-
- if (ret) {
- SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set mode on CRTC.");
- printf("********Could not set mode on CRTC.\n");
- }
- return 0;
- }
- }
- return 0;
- }
-#endif
-
-#if 0
- /* Get an actual usable fb for the next front buffer. */
- fb_info = KMSDRM_FBFromBO(_this, windata->next_bo);
- if (!fb_info) {
- return 0;
- }
-#endif
-
-#if 1
/* Do we have a modeset pending? If so, configure the new mode on the CRTC.
Has to be done before the upcoming pageflip issue, so the buffer with the
new size is big enough so the CRTC doesn't read out of bounds. */
@@ -205,7 +160,6 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
return 0;
}
-#endif
/* Issue pageflip on the next front buffer.
The pageflip will be done during the next vblank. */
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index f860815..0817906 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -332,115 +332,6 @@ KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
return fb_info;
}
-#if 0
-/* Get an actual usable fb from a BO, specifying the size of the desired fb. */
-KMSDRM_FBInfo *
-KMSDRM_FBFromBO2(_THIS, struct gbm_bo *bo, int width, int height)
-{
- SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
- int ret;
- Uint32 stride, handle;
-
- uint32_t format, strides[4] = {0}, handles[4] = {0}, offsets[4] = {0};
-
- /* Check for an existing framebuffer */
- KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo);
-
- if (fb_info) {
- /* TODO We used to simply return the old fb_info if there was one here.
- Now free it AND the actual buffer IF the sizes have changed (maybe
- add them to fb_info? to avoid leaking.)*/
- SDL_free(fb_info);
- }
-
- /* Create a structure that contains enough info to remove the framebuffer
- when the backing buffer is destroyed */
- fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo));
-
- if (!fb_info) {
- SDL_OutOfMemory();
- return NULL;
- }
-
- fb_info->drm_fd = viddata->drm_fd;
-
-#if 0
- /* Create framebuffer object for the buffer */
- stride = KMSDRM_gbm_bo_get_stride(bo);
- handle = KMSDRM_gbm_bo_get_handle(bo).u32;
- ret = KMSDRM_drmModeAddFB(viddata->drm_fd, width, height, 24, 32, stride, handle,
- &fb_info->fb_id);
-#endif
-
- handles[0] = KMSDRM_gbm_bo_get_handle(bo).u32;
- strides[0] = KMSDRM_gbm_bo_get_stride(bo);
- offsets[0] = KMSDRM_gbm_bo_get_offset(bo, 0);
- format = KMSDRM_gbm_bo_get_format(bo);
-
- ret = KMSDRM_drmModeAddFB2(viddata->drm_fd, width, height, format,
- handles, strides, offsets, &fb_info->fb_id, 0);
-
-
- if (ret) {
- SDL_free(fb_info);
- return NULL;
- }
-
- /* Associate our DRM framebuffer with this buffer object */
- KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback);
-
- return fb_info;
-}
-#endif
-
-#if 0
-/* Get an actual usable fb from a BO, specifying the size of the desired fb. */
-KMSDRM_FBInfo *
-KMSDRM_FBFromBO2(_THIS, struct gbm_bo *bo, int width, int height)
-{
- SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
- int ret;
- Uint32 stride, handle;
-
- /* Check for an existing framebuffer */
- KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo);
-
- if (fb_info) {
- /* TODO We used to simply return the old fb_info if there was one here.
- Now free it AND the actual buffer IF the sizes have changed (maybe
- add them to fb_info? to avoid leaking.)*/
- SDL_free(fb_info);
- }
-
- /* Create a structure that contains enough info to remove the framebuffer
- when the backing buffer is destroyed */
- fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo));
-
- if (!fb_info) {
- SDL_OutOfMemory();
- return NULL;
- }
-
- fb_info->drm_fd = viddata->drm_fd;
-
- /* Create framebuffer object for the buffer */
- stride = KMSDRM_gbm_bo_get_stride(bo);
- handle = KMSDRM_gbm_bo_get_handle(bo).u32;
- ret = KMSDRM_drmModeAddFB(viddata->drm_fd, width, height, 24, 32, stride, handle,
- &fb_info->fb_id);
-
- if (ret) {
- SDL_free(fb_info);
- return NULL;
- }
-
- /* Associate our DRM framebuffer with this buffer object */
- KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback);
-
- return fb_info;
-}
-#endif
-
static void
KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data)
{