diff options
author | SooChan Lim <sc1.lim@samsung.com> | 2017-09-11 15:14:23 +0900 |
---|---|---|
committer | SooChan Lim <sc1.lim@samsung.com> | 2017-09-11 15:14:23 +0900 |
commit | 45fbeab7c9d5b357ae6384ed0efeb7bdf3ae0545 (patch) | |
tree | 99f1d28699a289153dc245c9f91215cc128e2fed | |
parent | 8c226a737cd29ff2c848a7d84f64936d6ae952ae (diff) | |
download | libtdm-drm-45fbeab7c9d5b357ae6384ed0efeb7bdf3ae0545.tar.gz libtdm-drm-45fbeab7c9d5b357ae6384ed0efeb7bdf3ae0545.tar.bz2 libtdm-drm-45fbeab7c9d5b357ae6384ed0efeb7bdf3ae0545.zip |
apply coding rulesubmit/tizen_4.0/20170911.080340submit/tizen/20170911.080123accepted/tizen/unified/20170911.160106accepted/tizen/4.0/unified/20170913.003235
Change-Id: I400705fc78b92ecd2dcfae37ab808cd123571d72
-rw-r--r-- | src/tdm_drm.c | 19 | ||||
-rw-r--r-- | src/tdm_drm.h | 133 | ||||
-rw-r--r-- | src/tdm_drm_display.c | 166 | ||||
-rw-r--r-- | src/tdm_drm_format.c | 2 | ||||
-rw-r--r-- | src/tdm_drm_pp.c | 60 | ||||
-rw-r--r-- | src/tdm_drm_pp.h | 14 |
6 files changed, 195 insertions, 199 deletions
diff --git a/src/tdm_drm.c b/src/tdm_drm.c index 1817c6e..9c08cf3 100644 --- a/src/tdm_drm.c +++ b/src/tdm_drm.c @@ -44,7 +44,7 @@ _tdm_find_primary_gpu(void) continue; pci = udev_device_get_parent_with_subsystem_devtype(device, - "pci", NULL); + "pci", NULL); if (pci) { id = udev_device_get_sysattr_value(pci, "boot_vga"); if (id && !strcmp(id, "1")) { @@ -91,9 +91,8 @@ _tdm_drm_udev_fd_handler(int fd, tdm_event_loop_mask mask, void *user_data) hotplug = udev_device_get_property_value(dev, "HOTPLUG"); - if (memcmp(&s.st_rdev, &udev_devnum, sizeof (dev_t)) == 0 && - hotplug && atoi(hotplug) == 1) - { + if (memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 && + hotplug && atoi(hotplug) == 1) { TDM_INFO("HotPlug"); tdm_drm_display_update_output_status(edata); } @@ -122,16 +121,16 @@ _tdm_drm_udev_init(tdm_drm_data *edata) } if (udev_monitor_filter_add_match_subsystem_devtype(mon, "drm", "drm_minor") > 0 || - udev_monitor_enable_receiving(mon) < 0) { + udev_monitor_enable_receiving(mon) < 0) { TDM_ERR("add match subsystem failed"); goto failed; } edata->uevent_source = tdm_event_loop_add_fd_handler(edata->dpy, udev_monitor_get_fd(mon), - TDM_EVENT_LOOP_READABLE, - _tdm_drm_udev_fd_handler, - edata, NULL); + TDM_EVENT_LOOP_READABLE, + _tdm_drm_udev_fd_handler, + edata, NULL); if (!edata->uevent_source) { TDM_ERR("couldn't create udev event source"); goto failed; @@ -173,9 +172,8 @@ _tdm_drm_open_drm(void) int fd = -1; fd = drmOpen(TDM_DRM_NAME, NULL); - if (fd < 0) { + if (fd < 0) TDM_WRN("Cannot open '%s' drm", TDM_DRM_NAME); - } #ifdef HAVE_UDEV if (fd < 0) { @@ -331,7 +329,6 @@ tdm_drm_init(tdm_display *dpy, tdm_error *error) /* The drm master fd can be opened by a tbm backend module in * tbm_bufmgr_init() time. In this case, we just get it from * TBM_DRM_MASTER_FD enviroment. - * */ drm_data->drm_fd = tdm_helper_get_fd("TBM_DRM_MASTER_FD"); if (drm_data->drm_fd < 0) diff --git a/src/tdm_drm.h b/src/tdm_drm.h index 99d6a36..9cd3b02 100644 --- a/src/tdm_drm.h +++ b/src/tdm_drm.h @@ -30,104 +30,103 @@ #endif /* drm backend functions (display) */ -tdm_error drm_display_get_capability(tdm_backend_data *bdata, tdm_caps_display *caps); -tdm_error drm_display_get_pp_capability(tdm_backend_data *bdata, tdm_caps_pp *caps); +tdm_error drm_display_get_capability(tdm_backend_data *bdata, tdm_caps_display *caps); +tdm_error drm_display_get_pp_capability(tdm_backend_data *bdata, tdm_caps_pp *caps); tdm_output** drm_display_get_outputs(tdm_backend_data *bdata, int *count, tdm_error *error); -tdm_error drm_display_get_fd(tdm_backend_data *bdata, int *fd); -tdm_error drm_display_handle_events(tdm_backend_data *bdata); -tdm_pp* drm_display_create_pp(tdm_backend_data *bdata, tdm_error *error); -tdm_error drm_output_get_capability(tdm_output *output, tdm_caps_output *caps); +tdm_error drm_display_get_fd(tdm_backend_data *bdata, int *fd); +tdm_error drm_display_handle_events(tdm_backend_data *bdata); +tdm_pp* drm_display_create_pp(tdm_backend_data *bdata, tdm_error *error); +tdm_error drm_output_get_capability(tdm_output *output, tdm_caps_output *caps); tdm_layer** drm_output_get_layers(tdm_output *output, int *count, tdm_error *error); -tdm_error drm_output_set_property(tdm_output *output, unsigned int id, tdm_value value); -tdm_error drm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value); -tdm_error drm_output_wait_vblank(tdm_output *output, int interval, int sync, void *user_data); -tdm_error drm_output_set_vblank_handler(tdm_output *output, tdm_output_vblank_handler func); -tdm_error drm_output_commit(tdm_output *output, int sync, void *user_data); -tdm_error drm_output_set_commit_handler(tdm_output *output, tdm_output_commit_handler func); -tdm_error drm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value); -tdm_error drm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value); -tdm_error drm_output_set_mode(tdm_output *output, const tdm_output_mode *mode); -tdm_error drm_output_get_mode(tdm_output *output, const tdm_output_mode **mode); -tdm_error drm_output_set_status_handler(tdm_output *output, tdm_output_status_handler func, void *user_data); -tdm_error drm_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps); -tdm_error drm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value); -tdm_error drm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value); -tdm_error drm_layer_set_info(tdm_layer *layer, tdm_info_layer *info); -tdm_error drm_layer_get_info(tdm_layer *layer, tdm_info_layer *info); -tdm_error drm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer); -tdm_error drm_layer_unset_buffer(tdm_layer *layer); -void drm_pp_destroy(tdm_pp *pp); -tdm_error drm_pp_set_info(tdm_pp *pp, tdm_info_pp *info); -tdm_error drm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst); -tdm_error drm_pp_commit(tdm_pp *pp); -tdm_error drm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data); +tdm_error drm_output_set_property(tdm_output *output, unsigned int id, tdm_value value); +tdm_error drm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value); +tdm_error drm_output_wait_vblank(tdm_output *output, int interval, int sync, void *user_data); +tdm_error drm_output_set_vblank_handler(tdm_output *output, tdm_output_vblank_handler func); +tdm_error drm_output_commit(tdm_output *output, int sync, void *user_data); +tdm_error drm_output_set_commit_handler(tdm_output *output, tdm_output_commit_handler func); +tdm_error drm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value); +tdm_error drm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value); +tdm_error drm_output_set_mode(tdm_output *output, const tdm_output_mode *mode); +tdm_error drm_output_get_mode(tdm_output *output, const tdm_output_mode **mode); +tdm_error drm_output_set_status_handler(tdm_output *output, tdm_output_status_handler func, void *user_data); +tdm_error drm_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps); +tdm_error drm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value); +tdm_error drm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value); +tdm_error drm_layer_set_info(tdm_layer *layer, tdm_info_layer *info); +tdm_error drm_layer_get_info(tdm_layer *layer, tdm_info_layer *info); +tdm_error drm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer); +tdm_error drm_layer_unset_buffer(tdm_layer *layer); +void drm_pp_destroy(tdm_pp *pp); +tdm_error drm_pp_set_info(tdm_pp *pp, tdm_info_pp *info); +tdm_error drm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst); +tdm_error drm_pp_commit(tdm_pp *pp); +tdm_error drm_pp_set_done_handler(tdm_pp *pp, tdm_pp_done_handler func, void *user_data); /* drm module internal macros, structures, functions */ #define NEVER_GET_HERE() TDM_ERR("** NEVER GET HERE **") -#define C(b,m) (((b) >> (m)) & 0xFF) -#define B(c,s) ((((unsigned int)(c)) & 0xff) << (s)) -#define FOURCC(a,b,c,d) (B(d,24) | B(c,16) | B(b,8) | B(a,0)) -#define FOURCC_STR(id) C(id,0), C(id,8), C(id,16), C(id,24) +#define C(b, m) (((b) >> (m)) & 0xFF) +#define B(c, s) ((((unsigned int)(c)) & 0xff) << (s)) +#define FOURCC(a, b, c, d) (B(d, 24) | B(c, 16) | B(b, 8) | B(a, 0)) +#define FOURCC_STR(id) C(id, 0), C(id, 8), C(id, 16), C(id, 24) -#define IS_RGB(format) (format == TBM_FORMAT_XRGB8888 || format == TBM_FORMAT_ARGB8888 || \ - format == TBM_FORMAT_XBGR8888 || format == TBM_FORMAT_ABGR8888) +#define IS_RGB(format) (format == TBM_FORMAT_XRGB8888 || format == TBM_FORMAT_ARGB8888 || \ + format == TBM_FORMAT_XBGR8888 || format == TBM_FORMAT_ABGR8888) #define CLEAR(x) memset(&(x), 0, sizeof(x)) -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#define SWAP(a, b) ({int t; t = a; a = b; b = t;}) -#define ROUNDUP(x) (ceil (floor ((float)(height) / 4))) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define SWAP(a, b) ({int t; t = a; a = b; b = t; }) +#define ROUNDUP(x) (ceil(floor((float)(height) / 4))) -#define ALIGN_TO_16B(x) ((((x) + (1 << 4) - 1) >> 4) << 4) -#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) +#define ALIGN_TO_16B(x) ((((x) + (1 << 4) - 1) >> 4) << 4) +#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) #define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7) -#define ALIGN_TO_2KB(x) ((((x) + (1 << 11) - 1) >> 11) << 11) -#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) +#define ALIGN_TO_2KB(x) ((((x) + (1 << 11) - 1) >> 11) << 11) +#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) #define ALIGN_TO_64KB(x) ((((x) + (1 << 16) - 1) >> 16) << 16) #define RETURN_VAL_IF_FAIL(cond, val) {\ - if (!(cond)) {\ - TDM_ERR("'%s' failed", #cond);\ - return val;\ - }\ + if (!(cond)) {\ + TDM_ERR("'%s' failed", #cond);\ + return val;\ + } \ } #define GOTO_IF_FAIL(cond, val) {\ - if (!(cond)) {\ - TDM_ERR("'%s' failed", #cond);\ - goto val;\ - }\ + if (!(cond)) {\ + TDM_ERR("'%s' failed", #cond);\ + goto val;\ + } \ } -typedef struct _tdm_drm_data -{ - tdm_display *dpy; +typedef struct _tdm_drm_data { + tdm_display *dpy; - int drm_fd; + int drm_fd; #if LIBDRM_MAJOR_VERSION >= 2 && LIBDRM_MINOR_VERSION >= 4 && LIBDRM_MICRO_VERSION >= 47 - int has_universal_plane; + int has_universal_plane; #endif #if HAVE_UDEV - struct udev_monitor *uevent_monitor; - tdm_event_loop_source *uevent_source; + struct udev_monitor *uevent_monitor; + tdm_event_loop_source *uevent_source; #endif - drmModeResPtr mode_res; - drmModePlaneResPtr plane_res; + drmModeResPtr mode_res; + drmModePlaneResPtr plane_res; - struct list_head output_list; - struct list_head buffer_list; + struct list_head output_list; + struct list_head buffer_list; } tdm_drm_data; -uint32_t tdm_drm_format_to_drm_format(tbm_format format); +uint32_t tdm_drm_format_to_drm_format(tbm_format format); tbm_format tdm_drm_format_to_tbm_format(uint32_t format); -void tdm_drm_display_update_output_status(tdm_drm_data *drm_data); -tdm_error tdm_drm_display_create_output_list(tdm_drm_data *drm_data); -void tdm_drm_display_destroy_output_list(tdm_drm_data *drm_data); -tdm_error tdm_drm_display_create_layer_list(tdm_drm_data *drm_data); +void tdm_drm_display_update_output_status(tdm_drm_data *drm_data); +tdm_error tdm_drm_display_create_output_list(tdm_drm_data *drm_data); +void tdm_drm_display_destroy_output_list(tdm_drm_data *drm_data); +tdm_error tdm_drm_display_create_layer_list(tdm_drm_data *drm_data); #endif /* _TDM_DRM_H_ */ diff --git a/src/tdm_drm_display.c b/src/tdm_drm_display.c index 6ca8f66..fe4d75a 100644 --- a/src/tdm_drm_display.c +++ b/src/tdm_drm_display.c @@ -15,9 +15,9 @@ typedef struct _tdm_drm_layer_data tdm_drm_layer_data; typedef struct _tdm_drm_event_data tdm_drm_event_data; typedef enum { - TDM_DRM_EVENT_TYPE_WAIT, - TDM_DRM_EVENT_TYPE_COMMIT, - TDM_DRM_EVENT_TYPE_PAGEFLIP, + TDM_DRM_EVENT_TYPE_WAIT, + TDM_DRM_EVENT_TYPE_COMMIT, + TDM_DRM_EVENT_TYPE_PAGEFLIP, } tdm_drm_event_type; typedef struct _tdm_drm_display_buffer { @@ -95,11 +95,11 @@ _tdm_drm_display_get_mode(tdm_drm_output_data *output_data) for (i = 0; i < output_data->count_modes; i++) { drmModeModeInfoPtr drm_mode = &output_data->drm_modes[i]; if ((drm_mode->hdisplay == output_data->current_mode->hdisplay) && - (drm_mode->vdisplay == output_data->current_mode->vdisplay) && - (drm_mode->vrefresh == output_data->current_mode->vrefresh) && - (drm_mode->flags == output_data->current_mode->flags) && - (drm_mode->type == output_data->current_mode->type) && - !(strncmp(drm_mode->name, output_data->current_mode->name, TDM_NAME_LEN))) + (drm_mode->vdisplay == output_data->current_mode->vdisplay) && + (drm_mode->vrefresh == output_data->current_mode->vrefresh) && + (drm_mode->flags == output_data->current_mode->flags) && + (drm_mode->type == output_data->current_mode->type) && + !(strncmp(drm_mode->name, output_data->current_mode->name, TDM_NAME_LEN))) return drm_mode; } @@ -121,7 +121,7 @@ _tdm_drm_display_find_buffer(tdm_drm_data *drm_data, tbm_surface_h buffer) static void _tdm_drm_display_to_tdm_mode(drmModeModeInfoPtr drm_mode, - tdm_output_mode *tdm_mode) + tdm_output_mode *tdm_mode) { tdm_mode->clock = drm_mode->clock; tdm_mode->hdisplay = drm_mode->hdisplay; @@ -141,7 +141,7 @@ _tdm_drm_display_to_tdm_mode(drmModeModeInfoPtr drm_mode, } static tdm_error -_tdm_drm_display_get_cur_msc (int fd, int pipe, uint *msc) +_tdm_drm_display_get_cur_msc(int fd, int pipe, uint *msc) { drmVBlank vbl; @@ -186,7 +186,7 @@ _tdm_drm_display_wait_vblank(int fd, int pipe, uint *target_msc, void *data) static tdm_error _tdm_drm_output_update_status(tdm_drm_output_data *output_data, - tdm_output_conn_status status) + tdm_output_conn_status status) { RETURN_VAL_IF_FAIL(output_data, TDM_ERROR_INVALID_PARAMETER); @@ -197,14 +197,14 @@ _tdm_drm_output_update_status(tdm_drm_output_data *output_data, if (output_data->status_func) output_data->status_func(output_data, status, - output_data->status_user_data); + output_data->status_user_data); return TDM_ERROR_NONE; } static tdm_error _tdm_drm_display_commit_primary_layer(tdm_drm_layer_data *layer_data, - void *user_data, int *do_waitvblank) + void *user_data, int *do_waitvblank) { tdm_drm_data *drm_data = layer_data->drm_data; tdm_drm_output_data *output_data = layer_data->output_data; @@ -228,8 +228,8 @@ _tdm_drm_display_commit_primary_layer(tdm_drm_layer_data *layer_data, } if (drmModeSetCrtc(drm_data->drm_fd, output_data->crtc_id, - layer_data->display_buffer->fb_id, 0, 0, - &output_data->connector_id, 1, mode)) { + layer_data->display_buffer->fb_id, 0, 0, + &output_data->connector_id, 1, mode)) { TDM_ERR("set crtc failed: %m"); return TDM_ERROR_OPERATION_FAILED; } @@ -243,7 +243,7 @@ _tdm_drm_display_commit_primary_layer(tdm_drm_layer_data *layer_data, if (!layer_data->display_buffer) { if (drmModeSetCrtc(drm_data->drm_fd, output_data->crtc_id, - 0, 0, 0, NULL, 0, NULL)) { + 0, 0, 0, NULL, 0, NULL)) { TDM_ERR("unset crtc failed: %m"); return TDM_ERROR_OPERATION_FAILED; } @@ -264,7 +264,7 @@ _tdm_drm_display_commit_primary_layer(tdm_drm_layer_data *layer_data, event_data->output_data = output_data; event_data->user_data = user_data; if (drmModePageFlip(drm_data->drm_fd, output_data->crtc_id, - layer_data->display_buffer->fb_id, DRM_MODE_PAGE_FLIP_EVENT, event_data)) { + layer_data->display_buffer->fb_id, DRM_MODE_PAGE_FLIP_EVENT, event_data)) { TDM_ERR("pageflip failed: %m"); free(event_data); return TDM_ERROR_OPERATION_FAILED; @@ -309,7 +309,7 @@ _tdm_drm_display_commit_layer(tdm_drm_layer_data *layer_data) if (!layer_data->display_buffer) { if (drmModeSetPlane(drm_data->drm_fd, layer_data->plane_id, - output_data->crtc_id, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) + output_data->crtc_id, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) TDM_ERR("unset plane(%d) filed: %m", layer_data->plane_id); return TDM_ERROR_NONE; @@ -322,10 +322,10 @@ _tdm_drm_display_commit_layer(tdm_drm_layer_data *layer_data) fh = ((unsigned int)layer_data->info.src_config.pos.h) << 16; if (drmModeSetPlane(drm_data->drm_fd, layer_data->plane_id, - output_data->crtc_id, layer_data->display_buffer->fb_id, 0, - layer_data->info.dst_pos.x, layer_data->info.dst_pos.y, - layer_data->info.dst_pos.w, layer_data->info.dst_pos.h, - fx, fy, fw, fh) < 0) { + output_data->crtc_id, layer_data->display_buffer->fb_id, 0, + layer_data->info.dst_pos.x, layer_data->info.dst_pos.y, + layer_data->info.dst_pos.w, layer_data->info.dst_pos.h, + fx, fy, fw, fh) < 0) { TDM_ERR("set plane(%d) failed: %m", layer_data->plane_id); return TDM_ERROR_OPERATION_FAILED; } @@ -343,8 +343,8 @@ _tdm_drm_display_commit_layer(tdm_drm_layer_data *layer_data) static void _tdm_drm_display_cb_event(int fd, unsigned int sequence, - unsigned int tv_sec, unsigned int tv_usec, - void *user_data) + unsigned int tv_sec, unsigned int tv_usec, + void *user_data) { tdm_drm_event_data *event_data = user_data; tdm_drm_output_data *output_data; @@ -360,17 +360,17 @@ _tdm_drm_display_cb_event(int fd, unsigned int sequence, case TDM_DRM_EVENT_TYPE_PAGEFLIP: if (output_data->commit_func) output_data->commit_func(output_data, sequence, tv_sec, tv_usec, - event_data->user_data); + event_data->user_data); break; case TDM_DRM_EVENT_TYPE_WAIT: if (output_data->vblank_func) output_data->vblank_func(output_data, sequence, tv_sec, tv_usec, - event_data->user_data); + event_data->user_data); break; case TDM_DRM_EVENT_TYPE_COMMIT: if (output_data->commit_func) output_data->commit_func(output_data, sequence, tv_sec, tv_usec, - event_data->user_data); + event_data->user_data); break; default: break; @@ -427,12 +427,12 @@ _tdm_drm_display_create_layer_list(tdm_drm_data *drm_data) layer_data->plane_id = drm_data->plane_res->planes[i]; layer_data->capabilities = TDM_LAYER_CAPABILITY_PRIMARY | - TDM_LAYER_CAPABILITY_GRAPHIC; + TDM_LAYER_CAPABILITY_GRAPHIC; output_data->primary_layer = layer_data; 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); + layer_data, layer_data->plane_id, layer_data->output_data->crtc_id, + layer_data->capabilities); LIST_ADDTAIL(&layer_data->link, &output_data->layer_list); @@ -449,9 +449,9 @@ _tdm_drm_display_create_layer_list(tdm_drm_data *drm_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) + unsigned int obj_id, unsigned int obj_type, + const char *name, unsigned int *value, + int *is_immutable) { drmModeObjectPropertiesPtr props = NULL; int i; @@ -462,7 +462,7 @@ _tdm_drm_display_get_property(tdm_drm_data *drm_data, for (i = 0; i < props->count_props; i++) { drmModePropertyPtr prop = drmModeGetProperty(drm_data->drm_fd, - props->props[i]); + props->props[i]); if (!prop) continue; @@ -507,9 +507,9 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) } ret = _tdm_drm_display_get_property(drm_data, - drm_data->plane_res->planes[0], - DRM_MODE_OBJECT_PLANE, "type", &type, - NULL); + drm_data->plane_res->planes[0], + DRM_MODE_OBJECT_PLANE, "type", &type, + NULL); if (ret != TDM_ERROR_NONE) { TDM_ERR("plane doesn't have 'type' property. Call a fallback function"); @@ -547,13 +547,13 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) } ret = _tdm_drm_display_get_property(drm_data, - drm_data->plane_res->planes[i], - DRM_MODE_OBJECT_PLANE, "type", &type, - NULL); + drm_data->plane_res->planes[i], + DRM_MODE_OBJECT_PLANE, "type", &type, + NULL); if (ret != TDM_ERROR_NONE) { drmModeFreePlane(plane); TDM_ERR("plane(%d) doesn't have 'type' info", - drm_data->plane_res->planes[i]); + drm_data->plane_res->planes[i]); goto failed; } @@ -604,15 +604,15 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) if (types[i] == DRM_PLANE_TYPE_CURSOR) { layer_data->capabilities = TDM_LAYER_CAPABILITY_CURSOR | - TDM_LAYER_CAPABILITY_GRAPHIC; + TDM_LAYER_CAPABILITY_GRAPHIC; layer_data->zpos = cpos_next++; } else if (types[i] == DRM_PLANE_TYPE_OVERLAY) { layer_data->capabilities = TDM_LAYER_CAPABILITY_OVERLAY | - TDM_LAYER_CAPABILITY_GRAPHIC; + TDM_LAYER_CAPABILITY_GRAPHIC; layer_data->zpos = opos_next++; } else if (types[i] == DRM_PLANE_TYPE_PRIMARY) { layer_data->capabilities = TDM_LAYER_CAPABILITY_PRIMARY | - TDM_LAYER_CAPABILITY_GRAPHIC; + TDM_LAYER_CAPABILITY_GRAPHIC; layer_data->zpos = 0; output_data->primary_layer = layer_data; } else { @@ -621,8 +621,8 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_data *drm_data) } 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); + 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); } @@ -750,7 +750,7 @@ tdm_drm_display_update_output_status(tdm_drm_data *drm_data) tdm_output_conn_status new_status; connector = drmModeGetConnector(drm_data->drm_fd, - output_data->connector_id); + output_data->connector_id); if (!connector) { TDM_ERR("no connector: %d", output_data->connector_id); continue; @@ -780,12 +780,12 @@ tdm_drm_display_create_output_list(tdm_drm_data *drm_data) int crtc_id = 0, c, j; RETURN_VAL_IF_FAIL(LIST_IS_EMPTY(&drm_data->output_list), - TDM_ERROR_OPERATION_FAILED); + TDM_ERROR_OPERATION_FAILED); /* check if there is a connected output */ for (i = 0; i < drm_data->mode_res->count_connectors; i++) { connector = drmModeGetConnector(drm_data->drm_fd, - drm_data->mode_res->connectors[i]); + drm_data->mode_res->connectors[i]); if (!connector) { TDM_ERR("no connector"); return TDM_ERROR_OPERATION_FAILED; @@ -814,7 +814,7 @@ tdm_drm_display_create_output_list(tdm_drm_data *drm_data) * should be implemented. */ connector = drmModeGetConnector(drm_data->drm_fd, - drm_data->mode_res->connectors[conn_idx]); + drm_data->mode_res->connectors[conn_idx]); if (!connector) { TDM_ERR("no connector"); ret = TDM_ERROR_OPERATION_FAILED; @@ -881,7 +881,7 @@ tdm_drm_display_create_output_list(tdm_drm_data *drm_data) for (j = 0; j < connector->count_props; j++) { drmModePropertyPtr prop = drmModeGetProperty(drm_data->drm_fd, - connector->props[j]); + connector->props[j]); if (!prop) continue; if (!strcmp(prop->name, "DPMS")) { @@ -897,7 +897,7 @@ tdm_drm_display_create_output_list(tdm_drm_data *drm_data) output_data->count_modes = connector->count_modes; output_data->drm_modes = calloc(connector->count_modes, - sizeof(drmModeModeInfo)); + sizeof(drmModeModeInfo)); if (!output_data->drm_modes) { TDM_ERR("alloc failed"); free(output_data); @@ -907,7 +907,7 @@ tdm_drm_display_create_output_list(tdm_drm_data *drm_data) goto failed_create; } output_data->output_modes = calloc(connector->count_modes, - sizeof(tdm_output_mode)); + sizeof(tdm_output_mode)); if (!output_data->output_modes) { TDM_ERR("alloc failed"); free(output_data->drm_modes); @@ -920,16 +920,16 @@ tdm_drm_display_create_output_list(tdm_drm_data *drm_data) for (j = 0; j < connector->count_modes; j++) { output_data->drm_modes[j] = connector->modes[j]; _tdm_drm_display_to_tdm_mode(&output_data->drm_modes[j], - &output_data->output_modes[j]); + &output_data->output_modes[j]); } LIST_ADDTAIL(&output_data->link, &drm_data->output_list); TDM_DBG("output_data(%p) connector_id(%d:%d:%d-%d) encoder_id(%d) crtc_id(%d) pipe(%d) dpms_id(%d)", - output_data, output_data->connector_id, output_data->status, - output_data->connector_type, - output_data->connector_type_id, output_data->encoder_id, output_data->crtc_id, - output_data->pipe, output_data->dpms_prop_id); + output_data, output_data->connector_id, output_data->status, + output_data->connector_type, + output_data->connector_type_id, output_data->encoder_id, output_data->crtc_id, + output_data->pipe, output_data->dpms_prop_id); drmModeFreeEncoder(encoder); drmModeFreeConnector(connector); @@ -1101,7 +1101,7 @@ drm_output_get_capability(tdm_output *output, tdm_caps_output *caps) } props = drmModeObjectGetProperties(drm_data->drm_fd, output_data->crtc_id, - DRM_MODE_OBJECT_CRTC); + DRM_MODE_OBJECT_CRTC); if (!props) { ret = TDM_ERROR_OPERATION_FAILED; TDM_ERR("get crtc properties failed: %m\n"); @@ -1196,8 +1196,8 @@ drm_output_set_property(tdm_output *output, unsigned int id, tdm_value value) drm_data = output_data->drm_data; ret = drmModeObjectSetProperty(drm_data->drm_fd, - output_data->crtc_id, DRM_MODE_OBJECT_CRTC, - id, value.u32); + output_data->crtc_id, DRM_MODE_OBJECT_CRTC, + id, value.u32); if (ret < 0) { TDM_ERR("set property failed: %m"); return TDM_ERROR_OPERATION_FAILED; @@ -1220,7 +1220,7 @@ drm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value) drm_data = output_data->drm_data; props = drmModeObjectGetProperties(drm_data->drm_fd, output_data->crtc_id, - DRM_MODE_OBJECT_CRTC); + DRM_MODE_OBJECT_CRTC); if (props == NULL) { TDM_ERR("get property failed: %m"); return TDM_ERROR_OPERATION_FAILED; @@ -1239,7 +1239,7 @@ drm_output_get_property(tdm_output *output, unsigned int id, tdm_value *value) tdm_error drm_output_wait_vblank(tdm_output *output, int interval, int sync, - void *user_data) + void *user_data) { tdm_drm_output_data *output_data = output; tdm_drm_data *drm_data; @@ -1258,7 +1258,7 @@ drm_output_wait_vblank(tdm_output *output, int interval, int sync, drm_data = output_data->drm_data; ret = _tdm_drm_display_get_cur_msc(drm_data->drm_fd, output_data->pipe, - &target_msc); + &target_msc); if (ret != TDM_ERROR_NONE) goto failed_vblank; @@ -1269,7 +1269,7 @@ drm_output_wait_vblank(tdm_output *output, int interval, int sync, event_data->user_data = user_data; ret = _tdm_drm_display_wait_vblank(drm_data->drm_fd, output_data->pipe, - &target_msc, event_data); + &target_msc, event_data); if (ret != TDM_ERROR_NONE) goto failed_vblank; @@ -1281,7 +1281,7 @@ failed_vblank: tdm_error drm_output_set_vblank_handler(tdm_output *output, - tdm_output_vblank_handler func) + tdm_output_vblank_handler func) { tdm_drm_output_data *output_data = output; @@ -1309,7 +1309,7 @@ drm_output_commit(tdm_output *output, int sync, void *user_data) LIST_FOR_EACH_ENTRY(layer_data, &output_data->layer_list, link) { if (layer_data == output_data->primary_layer) { ret = _tdm_drm_display_commit_primary_layer(layer_data, user_data, - &do_waitvblank); + &do_waitvblank); if (ret != TDM_ERROR_NONE) return ret; } else { @@ -1329,7 +1329,7 @@ drm_output_commit(tdm_output *output, int sync, void *user_data) } ret = _tdm_drm_display_get_cur_msc(drm_data->drm_fd, output_data->pipe, - &target_msc); + &target_msc); if (ret != TDM_ERROR_NONE) { free(event_data); return ret; @@ -1342,7 +1342,7 @@ drm_output_commit(tdm_output *output, int sync, void *user_data) event_data->user_data = user_data; ret = _tdm_drm_display_wait_vblank(drm_data->drm_fd, output_data->pipe, - &target_msc, event_data); + &target_msc, event_data); if (ret != TDM_ERROR_NONE) { free(event_data); return ret; @@ -1354,7 +1354,7 @@ drm_output_commit(tdm_output *output, int sync, void *user_data) tdm_error drm_output_set_commit_handler(tdm_output *output, - tdm_output_commit_handler func) + tdm_output_commit_handler func) { tdm_drm_output_data *output_data = output; @@ -1382,8 +1382,8 @@ drm_output_set_dpms(tdm_output *output, tdm_output_dpms dpms_value) drm_data = output_data->drm_data; ret = drmModeObjectSetProperty(drm_data->drm_fd, - output_data->connector_id, DRM_MODE_OBJECT_CONNECTOR, - output_data->dpms_prop_id, dpms_value); + output_data->connector_id, DRM_MODE_OBJECT_CONNECTOR, + output_data->dpms_prop_id, dpms_value); if (ret < 0) { TDM_ERR("set dpms failed: %m"); return TDM_ERROR_OPERATION_FAILED; @@ -1405,7 +1405,7 @@ drm_output_get_dpms(tdm_output *output, tdm_output_dpms *dpms_value) drm_data = output_data->drm_data; props = drmModeObjectGetProperties(drm_data->drm_fd, output_data->connector_id, - DRM_MODE_OBJECT_CONNECTOR); + DRM_MODE_OBJECT_CONNECTOR); if (props == NULL) { TDM_ERR("get property failed: %m"); return TDM_ERROR_OPERATION_FAILED; @@ -1451,8 +1451,8 @@ drm_output_get_mode(tdm_output *output, const tdm_output_mode **mode) tdm_error drm_output_set_status_handler(tdm_output *output, - tdm_output_status_handler func, - void *user_data) + tdm_output_status_handler func, + void *user_data) { tdm_drm_output_data *output_data = output; @@ -1502,7 +1502,7 @@ drm_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps) for (i = 0; i < caps->format_count; i++) { /* TODO: kernel reports wrong formats */ if (plane->formats[i] != DRM_FORMAT_XRGB8888 && - plane->formats[i] != DRM_FORMAT_ARGB8888) { + plane->formats[i] != DRM_FORMAT_ARGB8888) { TDM_WRN("plane(%d) zpos(%d) %c%c%c%c skipped", layer_data->plane_id, layer_data->zpos, FOURCC_STR(plane->formats[i])); continue; @@ -1514,7 +1514,7 @@ drm_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps) caps->format_count = format_count; props = drmModeObjectGetProperties(drm_data->drm_fd, layer_data->plane_id, - DRM_MODE_OBJECT_PLANE); + DRM_MODE_OBJECT_PLANE); if (!props) { ret = TDM_ERROR_OPERATION_FAILED; TDM_ERR("get plane properties failed: %m\n"); @@ -1568,8 +1568,8 @@ drm_layer_set_property(tdm_layer *layer, unsigned int id, tdm_value value) drm_data = layer_data->drm_data; ret = drmModeObjectSetProperty(drm_data->drm_fd, - layer_data->plane_id, DRM_MODE_OBJECT_PLANE, - id, value.u32); + layer_data->plane_id, DRM_MODE_OBJECT_PLANE, + id, value.u32); if (ret < 0) { TDM_ERR("set property failed: %m"); return TDM_ERROR_OPERATION_FAILED; @@ -1592,7 +1592,7 @@ drm_layer_get_property(tdm_layer *layer, unsigned int id, tdm_value *value) drm_data = layer_data->drm_data; props = drmModeObjectGetProperties(drm_data->drm_fd, layer_data->plane_id, - DRM_MODE_OBJECT_PLANE); + DRM_MODE_OBJECT_PLANE); if (props == NULL) { TDM_ERR("get property failed: %m"); return TDM_ERROR_OPERATION_FAILED; @@ -1660,7 +1660,7 @@ drm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) display_buffer->buffer = buffer; err = tdm_buffer_add_destroy_handler(buffer, _tdm_drm_display_cb_destroy_buffer, - drm_data); + drm_data); if (err != TDM_ERROR_NONE) { TDM_ERR("add destroy handler fail"); free(display_buffer); @@ -1692,13 +1692,13 @@ drm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) tbm_surface_internal_get_plane_data(buffer, i, &size, &offsets[i], &pitches[i]); ret = drmModeAddFB2(drm_data->drm_fd, width, height, format, - handles, pitches, offsets, &display_buffer->fb_id, 0); + handles, pitches, offsets, &display_buffer->fb_id, 0); if (ret < 0) { TDM_ERR("add fb failed: %m"); return TDM_ERROR_OPERATION_FAILED; } TDM_DBG("drm_data->drm_fd : %d, display_buffer->fb_id:%u", drm_data->drm_fd, - display_buffer->fb_id); + display_buffer->fb_id); if (IS_RGB(format)) display_buffer->width = pitches[0] >> 2; diff --git a/src/tdm_drm_format.c b/src/tdm_drm_format.c index eeda432..5ded56e 100644 --- a/src/tdm_drm_format.c +++ b/src/tdm_drm_format.c @@ -9,7 +9,7 @@ typedef struct { tbm_format tbm_format; - uint32_t drm_format; + uint32_t drm_format; } tbm_drm_format_data; static const tbm_drm_format_data formats[] = { diff --git a/src/tdm_drm_pp.c b/src/tdm_drm_pp.c index 97ee9de..2f0baee 100644 --- a/src/tdm_drm_pp.c +++ b/src/tdm_drm_pp.c @@ -58,28 +58,28 @@ _tdm_drm_pp_pixman_get_format(tbm_format tbmfmt) int _tdm_drm_pp_pixman_convert(pixman_op_t op, - unsigned char *srcbuf, unsigned char *dstbuf, - pixman_format_code_t src_format, pixman_format_code_t dst_format, - int sbw, int sbh, int sx, int sy, int sw, int sh, - int dbw, int dbh, int dx, int dy, int dw, int dh, - int rotate, int hflip, int vflip) + unsigned char *srcbuf, unsigned char *dstbuf, + pixman_format_code_t src_format, pixman_format_code_t dst_format, + int sbw, int sbh, int sx, int sy, int sw, int sh, + int dbw, int dbh, int dx, int dy, int dw, int dh, + int rotate, int hflip, int vflip) { - pixman_image_t *src_img; - pixman_image_t *dst_img; + pixman_image_t *src_img; + pixman_image_t *dst_img; struct pixman_f_transform ft; pixman_transform_t transform; - int src_stride, dst_stride; - int src_bpp; - int dst_bpp; - double scale_x, scale_y; - int rotate_step; - int ret = 0; + int src_stride, dst_stride; + int src_bpp; + int dst_bpp; + double scale_x, scale_y; + int rotate_step; + int ret = 0; RETURN_VAL_IF_FAIL(srcbuf != NULL, 0); RETURN_VAL_IF_FAIL(dstbuf != NULL, 0); TDM_DBG("src(%dx%d: %d,%d %dx%d) dst(%dx%d: %d,%d %dx%d) flip(%d,%d), rot(%d)", - sbw, sbh, sx, sy, sw, sh, dbw, dbh, dx, dy, dw, dh, hflip, vflip, rotate); + sbw, sbh, sx, sy, sw, sh, dbw, dbh, dx, dy, dw, dh, hflip, vflip, rotate); src_bpp = PIXMAN_FORMAT_BPP(src_format) / 8; RETURN_VAL_IF_FAIL(src_bpp > 0, 0); @@ -93,9 +93,9 @@ _tdm_drm_pp_pixman_convert(pixman_op_t op, dst_stride = dbw * dst_bpp; src_img = pixman_image_create_bits(src_format, sbw, sbh, (uint32_t *)srcbuf, - src_stride); + src_stride); dst_img = pixman_image_create_bits(dst_format, dbw, dbh, (uint32_t *)dstbuf, - dst_stride); + dst_stride); GOTO_IF_FAIL(src_img != NULL, CANT_CONVERT); GOTO_IF_FAIL(dst_img != NULL, CANT_CONVERT); @@ -208,7 +208,7 @@ _tdm_drm_pp_convert(tdm_drm_pp_buffer *buffer, tdm_info_pp *info) dst_format = PIXMAN_a8b8g8r8; else if (dst_info.format == TBM_FORMAT_YVU420) { TDM_ERR("can't convert %c%c%c%c to %c%c%c%c", - FOURCC_STR(src_info.format), FOURCC_STR(dst_info.format)); + FOURCC_STR(src_info.format), FOURCC_STR(dst_info.format)); goto fail_convert; } } @@ -235,15 +235,15 @@ _tdm_drm_pp_convert(tdm_drm_pp_buffer *buffer, tdm_info_pp *info) } _tdm_drm_pp_pixman_convert(PIXMAN_OP_SRC, - src_info.planes[0].ptr, dst_info.planes[0].ptr, - src_format, dst_format, - sbw, src_info.height, - info->src_config.pos.x, info->src_config.pos.y, - info->src_config.pos.w, info->src_config.pos.h, - dbw, dst_info.height, - info->dst_config.pos.x, info->dst_config.pos.y, - info->dst_config.pos.w, info->dst_config.pos.h, - rotate, hflip, 0); + src_info.planes[0].ptr, dst_info.planes[0].ptr, + src_format, dst_format, + sbw, src_info.height, + info->src_config.pos.x, info->src_config.pos.y, + info->src_config.pos.w, info->src_config.pos.h, + dbw, dst_info.height, + info->dst_config.pos.x, info->dst_config.pos.y, + info->dst_config.pos.w, info->dst_config.pos.h, + rotate, hflip, 0); tbm_surface_unmap(buffer->src); tbm_surface_unmap(buffer->dst); @@ -353,7 +353,7 @@ drm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst) RETURN_VAL_IF_FAIL(dst, TDM_ERROR_INVALID_PARAMETER); if (tbm_surface_internal_get_num_bos(src) > 1 || - tbm_surface_internal_get_num_bos(dst) > 1) { + tbm_surface_internal_get_num_bos(dst) > 1) { TDM_ERR("can't handle multiple tbm bos"); return TDM_ERROR_OPERATION_FAILED; } @@ -387,9 +387,9 @@ drm_pp_commit(tdm_pp *pp) if (pp_data->done_func) pp_data->done_func(pp_data, - b->src, - b->dst, - pp_data->done_user_data); + b->src, + b->dst, + pp_data->done_user_data); free(b); } diff --git a/src/tdm_drm_pp.h b/src/tdm_drm_pp.h index acbb425..2d3c805 100644 --- a/src/tdm_drm_pp.h +++ b/src/tdm_drm_pp.h @@ -3,11 +3,11 @@ #include "tdm_drm.h" -tdm_error tdm_drm_pp_get_capability(tdm_drm_data *drm_data, tdm_caps_pp *caps); -tdm_pp* tdm_drm_pp_create(tdm_drm_data *drm_data, tdm_error *error); -void tdm_drm_pp_handler(unsigned int prop_id, unsigned int *buf_idx, - unsigned int tv_sec, unsigned int tv_usec, void *data); -void tdm_drm_pp_cb(int fd, unsigned int prop_id, unsigned int *buf_idx, - unsigned int tv_sec, unsigned int tv_usec, - void *user_data); +tdm_error tdm_drm_pp_get_capability(tdm_drm_data *drm_data, tdm_caps_pp *caps); +tdm_pp* tdm_drm_pp_create(tdm_drm_data *drm_data, tdm_error *error); +void tdm_drm_pp_handler(unsigned int prop_id, unsigned int *buf_idx, + unsigned int tv_sec, unsigned int tv_usec, void *data); +void tdm_drm_pp_cb(int fd, unsigned int prop_id, unsigned int *buf_idx, + unsigned int tv_sec, unsigned int tv_usec, + void *user_data); #endif /* _TDM_DRM_PP_H_ */ |