summaryrefslogtreecommitdiffstats
path: root/gralloc_drm_kms.c
diff options
context:
space:
mode:
Diffstat (limited to 'gralloc_drm_kms.c')
-rw-r--r--gralloc_drm_kms.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index 8f45fd8..3310807 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -59,6 +59,8 @@ static unsigned int drm_format_from_hal(int hal_format)
return DRM_FORMAT_RGB565;
case HAL_PIXEL_FORMAT_YV12:
return DRM_FORMAT_YUV420;
+ case HAL_PIXEL_FORMAT_DRM_NV12:
+ return DRM_FORMAT_NV12;
default:
return 0;
}
@@ -95,6 +97,16 @@ static int resolve_drm_format(struct gralloc_drm_bo_t *bo,
pitches[2] * bo->handle->height/2;
handles[1] = handles[2] = handles[0];
+ break;
+
+ case HAL_PIXEL_FORMAT_DRM_NV12:
+
+ // U and V are interleaved in 2nd plane
+ pitches[1] = pitches[0];
+ offsets[1] = offsets[0] +
+ pitches[0] * bo->handle->height;
+ handles[1] = handles[0];
+ break;
}
return format;
}
@@ -211,7 +223,8 @@ static int drm_kms_page_flip(struct gralloc_drm_t *drm,
ALOGE("failed to perform page flip for primary (%s) (crtc %d fb %d))",
strerror(errno), drm->primary.crtc_id, bo->fb_id);
/* try to set mode for next frame */
- drm->first_post = 1;
+ if (errno != EBUSY)
+ drm->first_post = 1;
}
else
drm->next_front = bo;
@@ -773,6 +786,12 @@ int gralloc_drm_init_kms(struct gralloc_drm_t *drm)
/* check if hdmi is connected already */
hdmi = fetch_connector(drm, DRM_MODE_CONNECTOR_HDMIA);
if (hdmi) {
+
+ if (hdmi->connector_id == drm->primary.connector_id) {
+ /* special case: our primary connector is hdmi */
+ goto skip_hdmi_modes;
+ }
+
drm_kms_init_with_connector(drm, &drm->hdmi, hdmi);
drmModeFreeConnector(hdmi);
@@ -788,6 +807,8 @@ int gralloc_drm_init_kms(struct gralloc_drm_t *drm)
pthread_mutex_init(&drm->hdmi_mutex, NULL);
pthread_create(&drm->hdmi_hotplug_thread, NULL, hdmi_observer, drm);
+skip_hdmi_modes:
+
drm_kms_init_features(drm);
drm->first_post = 1;