diff options
author | Boram Park <boram1288.park@samsung.com> | 2016-06-16 13:29:11 +0900 |
---|---|---|
committer | Boram Park <boram1288.park@samsung.com> | 2016-06-16 13:29:11 +0900 |
commit | 881130ded76243d317c8664567c61d69aef8b6b6 (patch) | |
tree | a2285f95a753b1cd7b09dd359085493c3b3cb532 | |
parent | bc134448f90a23e66ed246ada0bc497bb8cd8575 (diff) | |
download | libtdm-drm-881130ded76243d317c8664567c61d69aef8b6b6.tar.gz libtdm-drm-881130ded76243d317c8664567c61d69aef8b6b6.tar.bz2 libtdm-drm-881130ded76243d317c8664567c61d69aef8b6b6.zip |
checking drm version to avoid build-breaksubmit/tizen/20160616.045434accepted/tizen/wearable/20160616.105423accepted/tizen/tv/20160616.105406accepted/tizen/mobile/20160616.105355accepted/tizen/ivi/20160616.105443accepted/tizen/common/20160616.151847
Change-Id: I614910cb4f3763e60d5cb9a02997b57d7c88eebb
-rw-r--r-- | src/tdm_drm.h | 6 | ||||
-rw-r--r-- | src/tdm_drm_display.c | 97 |
2 files changed, 57 insertions, 46 deletions
diff --git a/src/tdm_drm.h b/src/tdm_drm.h index 333c670..d284475 100644 --- a/src/tdm_drm.h +++ b/src/tdm_drm.h @@ -1,6 +1,10 @@ #ifndef _TDM_DRM_H_ #define _TDM_DRM_H_ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -102,7 +106,9 @@ typedef struct _tdm_drm_data int drm_fd; +#if LIBDRM_MAJOR_VERSION >= 2 && LIBDRM_MINOR_VERSION >= 4 && LIBDRM_MICRO_VERSION >= 47 int has_universal_plane; +#endif #if HAVE_UDEV struct udev_monitor *uevent_monitor; diff --git a/src/tdm_drm_display.c b/src/tdm_drm_display.c index 868c25d..fc7e93d 100644 --- a/src/tdm_drm_display.c +++ b/src/tdm_drm_display.c @@ -185,43 +185,6 @@ _tdm_drm_display_wait_vblank(int fd, int pipe, uint *target_msc, void *data) } static tdm_error -_tdm_drm_display_get_property(tdm_drm_data *drm_data, - unsigned int obj_id, unsigned int obj_type, - const char *name, unsigned int *value, - int *is_immutable) -{ - drmModeObjectPropertiesPtr props = NULL; - int i; - - props = drmModeObjectGetProperties(drm_data->drm_fd, obj_id, obj_type); - if (!props) - return TDM_ERROR_OPERATION_FAILED; - - for (i = 0; i < props->count_props; i++) { - drmModePropertyPtr prop = drmModeGetProperty(drm_data->drm_fd, - props->props[i]); - - if (!prop) - continue; - - if (!strcmp(prop->name, name)) { - if (is_immutable) - *is_immutable = prop->flags & DRM_MODE_PROP_IMMUTABLE; - if (value) - *value = (unsigned int)props->prop_values[i]; - drmModeFreeProperty(prop); - drmModeFreeObjectProperties(props); - return TDM_ERROR_NONE; - } - - drmModeFreeProperty(prop); - } - drmModeFreeObjectProperties(props); - TDM_DBG("coundn't find '%s' property", name); - return TDM_ERROR_OPERATION_FAILED; -} - -static tdm_error _tdm_drm_display_commit_primary_layer(tdm_drm_layer_data *layer_data, void *user_data, int *do_waitvblank) { @@ -439,9 +402,9 @@ _tdm_drm_display_create_layer_list(tdm_drm_data *drm_data) TDM_LAYER_CAPABILITY_GRAPHIC; output_data->primary_layer = layer_data; - TDM_DBG("layer_data(%p) plane_id(%d) crtc_id(%d) capabilities(%x)", - layer_data, layer_data->plane_id, layer_data->output_data->crtc_id, - layer_data->capabilities); + TDM_INFO("layer_data(%p) plane_id(%d) crtc_id(%d) capabilities(%x)", + layer_data, layer_data->plane_id, layer_data->output_data->crtc_id, + layer_data->capabilities); LIST_ADDTAIL(&layer_data->link, &output_data->layer_list); @@ -454,6 +417,45 @@ _tdm_drm_display_create_layer_list(tdm_drm_data *drm_data) return TDM_ERROR_NONE; } +#if LIBDRM_MAJOR_VERSION >= 2 && LIBDRM_MINOR_VERSION >= 4 && LIBDRM_MICRO_VERSION >= 47 + +static tdm_error +_tdm_drm_display_get_property(tdm_drm_data *drm_data, + unsigned int obj_id, unsigned int obj_type, + const char *name, unsigned int *value, + int *is_immutable) +{ + drmModeObjectPropertiesPtr props = NULL; + int i; + + props = drmModeObjectGetProperties(drm_data->drm_fd, obj_id, obj_type); + if (!props) + return TDM_ERROR_OPERATION_FAILED; + + for (i = 0; i < props->count_props; i++) { + drmModePropertyPtr prop = drmModeGetProperty(drm_data->drm_fd, + props->props[i]); + + if (!prop) + continue; + + if (!strcmp(prop->name, name)) { + if (is_immutable) + *is_immutable = prop->flags & DRM_MODE_PROP_IMMUTABLE; + if (value) + *value = (unsigned int)props->prop_values[i]; + drmModeFreeProperty(prop); + drmModeFreeObjectProperties(props); + return TDM_ERROR_NONE; + } + + drmModeFreeProperty(prop); + } + drmModeFreeObjectProperties(props); + TDM_DBG("coundn't find '%s' property", name); + return TDM_ERROR_OPERATION_FAILED; +} + static tdm_error _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) { @@ -554,9 +556,9 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) continue; } - TDM_DBG("layer_data(%p) plane_id(%d) crtc_id(%d) zpos(%d) capabilities(%x)", - layer_data, layer_data->plane_id, layer_data->output_data->crtc_id, - layer_data->zpos, layer_data->capabilities); + TDM_INFO("layer_data(%p) plane_id(%d) crtc_id(%d) zpos(%d) capabilities(%x)", + layer_data, layer_data->plane_id, layer_data->output_data->crtc_id, + layer_data->zpos, layer_data->capabilities); LIST_ADDTAIL(&layer_data->link, &output_data->layer_list); @@ -565,6 +567,7 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) return TDM_ERROR_NONE; } +#endif static void _tdm_drm_display_cb_destroy_buffer(tbm_surface_h buffer, void *user_data) @@ -610,10 +613,12 @@ tdm_drm_display_create_layer_list(tdm_drm_data *drm_data) tdm_drm_output_data *output_data = NULL; tdm_error ret; - if (!drm_data->has_universal_plane) - ret = _tdm_drm_display_create_layer_list(drm_data); - else +#if LIBDRM_MAJOR_VERSION >= 2 && LIBDRM_MINOR_VERSION >= 4 && LIBDRM_MICRO_VERSION >= 47 + if (drm_data->has_universal_plane) ret = _tdm_drm_display_create_layer_list_type(drm_data); + else +#endif + ret = _tdm_drm_display_create_layer_list(drm_data); if (ret != TDM_ERROR_NONE) return ret; |