summaryrefslogtreecommitdiffstats
path: root/gralloc_drm_kms.c
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2011-07-31 17:09:11 +0900
committerChia-I Wu <olvaffe@gmail.com>2011-07-31 17:58:37 +0900
commitd5c39c961b11b314b6d13e79036e740cdefee67b (patch)
treedd3deacbbed122cd728bbfb07aba19c722c3a118 /gralloc_drm_kms.c
parent333d56660c8c364f39a004e24413588c261ca49d (diff)
downloadexternal_drm_gralloc-d5c39c961b11b314b6d13e79036e740cdefee67b.zip
external_drm_gralloc-d5c39c961b11b314b6d13e79036e740cdefee67b.tar.gz
external_drm_gralloc-d5c39c961b11b314b6d13e79036e740cdefee67b.tar.bz2
add more functions to gralloc_drm kms interface
Make it more complete.
Diffstat (limited to 'gralloc_drm_kms.c')
-rw-r--r--gralloc_drm_kms.c59
1 files changed, 47 insertions, 12 deletions
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index 77115b3..6b4a63d 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -277,18 +277,18 @@ static struct gralloc_drm_t *drm_singleton;
static void on_signal(int sig)
{
- struct sigaction act;
-
- /* wait the pending flip */
- if (drm_singleton && drm_singleton->next_front) {
- /* there is race, but this function is hacky enough to ignore that */
- if (drm_singleton->waiting_flip)
- usleep(100 * 1000); /* 100ms */
- else
- drm_kms_page_flip(drm_singleton, NULL);
- }
-
- exit(-1);
+ struct gralloc_drm_t *drm = drm_singleton;
+
+ /* wait the pending flip */
+ if (drm && drm->swap_mode == DRM_SWAP_FLIP && drm->next_front) {
+ /* there is race, but this function is hacky enough to ignore that */
+ if (drm_singleton->waiting_flip)
+ usleep(100 * 1000); /* 100ms */
+ else
+ drm_kms_page_flip(drm_singleton, NULL);
+ }
+
+ exit(-1);
}
static void drm_kms_init_features(struct gralloc_drm_t *drm)
@@ -516,6 +516,41 @@ int gralloc_drm_init_kms(struct gralloc_drm_t *drm)
return 0;
}
+void gralloc_drm_fini_kms(struct gralloc_drm_t *drm)
+{
+ switch (drm->swap_mode) {
+ case DRM_SWAP_FLIP:
+ drm_kms_page_flip(drm, NULL);
+ break;
+ case DRM_SWAP_COPY:
+ {
+ struct gralloc_drm_bo_t **bo = (drm->current_front) ?
+ &drm->current_front : &drm->next_front;
+
+ if (*bo)
+ gralloc_drm_bo_destroy(*bo);
+ *bo = NULL;
+ }
+ break;
+ default:
+ break;
+ }
+
+ /* restore crtc? */
+
+ if (drm->resources) {
+ drmModeFreeResources(drm->resources);
+ drm->resources = NULL;
+ }
+
+ drm_singleton = NULL;
+}
+
+int gralloc_drm_is_kms_initialized(struct gralloc_drm_t *drm)
+{
+ return (drm->resources != NULL);
+}
+
/*
* Initialize a framebuffer device with KMS info.
*/