|
@@ -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)
|
|
|
{
|