summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUjwal Patel <ujwalp@nvidia.com>2017-08-03 18:40:56 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-08-11 07:32:07 -0400
commit9fed5c1e8af160d8ea8e3e45a5f12ed84becf4bd (patch)
treeff9e082a439074e85eac50136ed56ee0ef2fdcb7
parent85810fad44c03b9c755543095cd06ccfe565b391 (diff)
video: dc: remove old FLIP ioctl support
TEGRA_DC_EXT_FLIP4 ioctl supports all functionalities that older FLIP ioctls support and more. All clients have move to using FLIP4 ioctl so remove support for old FLIP ioctls to reduce maintenance overhead and improve code coverage. TDS-2099 Change-Id: Ib327f60b5ca0d4f9550363cf7f6a8b09b0a1b27e Signed-off-by: Ujwal Patel <ujwalp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1532584 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/ext/dev.c202
-rw-r--r--include/video/tegra_dc_ext.h40
2 files changed, 3 insertions, 239 deletions
diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c
index 0edf51e6b..176eb7242 100644
--- a/drivers/video/tegra/dc/ext/dev.c
+++ b/drivers/video/tegra/dc/ext/dev.c
@@ -83,9 +83,6 @@ struct tegra_dc_ext_flip_2_32 {
83 __u16 dirty_rect[4]; /* x,y,w,h for partial screen update. 0 ignores */ 83 __u16 dirty_rect[4]; /* x,y,w,h for partial screen update. 0 ignores */
84}; 84};
85 85
86#define TEGRA_DC_EXT_FLIP2_32 \
87 _IOWR('D', 0x0E, struct tegra_dc_ext_flip_2_32)
88
89#define TEGRA_DC_EXT_SET_PROPOSED_BW32 \ 86#define TEGRA_DC_EXT_SET_PROPOSED_BW32 \
90 _IOR('D', 0x13, struct tegra_dc_ext_flip_2_32) 87 _IOR('D', 0x13, struct tegra_dc_ext_flip_2_32)
91 88
@@ -2441,22 +2438,6 @@ static int dev_cpy_from_usr_compat(
2441 } 2438 }
2442 return 0; 2439 return 0;
2443} 2440}
2444
2445static int dev_cpy_to_usr_compat(void *outptr, u32 usr_win_size,
2446 struct tegra_dc_ext_flip_windowattr_v2 *inptr, u32 win_num)
2447{
2448 int i = 0;
2449 u8 *dstptr;
2450
2451 for (i = 0; i < win_num; i++) {
2452 dstptr = (u8 *)outptr + (usr_win_size * i);
2453
2454 if (copy_to_user(compat_ptr((uintptr_t)dstptr),
2455 &inptr[i], usr_win_size))
2456 return -EFAULT;
2457 }
2458 return 0;
2459}
2460#endif 2441#endif
2461 2442
2462static int dev_cpy_from_usr(struct tegra_dc_ext_flip_windowattr_v2 *outptr, 2443static int dev_cpy_from_usr(struct tegra_dc_ext_flip_windowattr_v2 *outptr,
@@ -2703,189 +2684,6 @@ static long tegra_dc_ioctl(struct file *filp, unsigned int cmd,
2703 case TEGRA_DC_EXT_SET_WINMASK: 2684 case TEGRA_DC_EXT_SET_WINMASK:
2704 return tegra_dc_ext_set_winmask(user, arg); 2685 return tegra_dc_ext_set_winmask(user, arg);
2705 2686
2706 case TEGRA_DC_EXT_FLIP:
2707 {
2708 int ret;
2709 int win_num, i;
2710 struct tegra_dc_ext_flip args;
2711 struct tegra_dc_ext_flip_windowattr_v2 *win;
2712 /* Keeping window attribute size as version1 for old
2713 * legacy applications
2714 */
2715 u32 usr_win_size = sizeof(struct tegra_dc_ext_flip_windowattr);
2716
2717 if (copy_from_user(&args, user_arg, sizeof(args)))
2718 return -EFAULT;
2719
2720 win_num = TEGRA_DC_EXT_FLIP_N_WINDOWS;
2721 win = kzalloc(sizeof(*win) * win_num, GFP_KERNEL);
2722 if (!win)
2723 return -EFAULT;
2724
2725 for (i = 0; i < win_num; i++)
2726 memcpy(&win[i], &args.win[i], usr_win_size);
2727
2728 ret = tegra_dc_ext_flip(user, win,
2729 TEGRA_DC_EXT_FLIP_N_WINDOWS,
2730 &args.post_syncpt_id, &args.post_syncpt_val, NULL,
2731 NULL, 0, NULL, 0, NULL);
2732
2733 for (i = 0; i < win_num; i++)
2734 memcpy(&args.win[i], &win[i], usr_win_size);
2735
2736 if (copy_to_user(user_arg, &args, sizeof(args))) {
2737 kfree(win);
2738 return -EFAULT;
2739 }
2740
2741 kfree(win);
2742 return ret;
2743 }
2744
2745#ifdef CONFIG_COMPAT
2746 case TEGRA_DC_EXT_FLIP2_32:
2747 {
2748 int ret;
2749 int win_num;
2750 struct tegra_dc_ext_flip_2_32 args;
2751 struct tegra_dc_ext_flip_windowattr_v2 *win;
2752
2753 /* Keeping window attribute size as version1 for old
2754 * legacy applications
2755 */
2756 u32 usr_win_size = sizeof(struct tegra_dc_ext_flip_windowattr);
2757
2758 if (copy_from_user(&args, user_arg, sizeof(args)))
2759 return -EFAULT;
2760
2761 win_num = args.win_num;
2762 win = kzalloc(sizeof(*win) * win_num, GFP_KERNEL);
2763
2764 if (dev_cpy_from_usr_compat(win, (void *)(uintptr_t)args.win,
2765 usr_win_size, win_num)) {
2766 kfree(win);
2767 return -EFAULT;
2768 }
2769
2770 ret = tegra_dc_ext_flip(user, win, win_num,
2771 &args.post_syncpt_id, &args.post_syncpt_val, NULL,
2772 args.dirty_rect, 0, NULL, 0, NULL);
2773
2774 if (dev_cpy_to_usr_compat((void *)(uintptr_t)args.win,
2775 usr_win_size, win, win_num)) {
2776 kfree(win);
2777 return -EFAULT;
2778 }
2779
2780 if (copy_to_user(user_arg, &args, sizeof(args))) {
2781 kfree(win);
2782 return -EFAULT;
2783 }
2784
2785 kfree(win);
2786 return ret;
2787 }
2788
2789#endif
2790 case TEGRA_DC_EXT_FLIP2:
2791 {
2792 int ret;
2793 int win_num;
2794 struct tegra_dc_ext_flip_2 args;
2795 struct tegra_dc_ext_flip_windowattr_v2 *win;
2796
2797 /* Keeping window attribute size as version1 for old
2798 * legacy applications
2799 */
2800 u32 usr_win_size = sizeof(struct tegra_dc_ext_flip_windowattr);
2801
2802 if (copy_from_user(&args, user_arg, sizeof(args)))
2803 return -EFAULT;
2804
2805 win_num = args.win_num;
2806 win = kzalloc(sizeof(*win) * win_num, GFP_KERNEL);
2807
2808 if (dev_cpy_from_usr(win, (void *)args.win,
2809 usr_win_size, win_num)) {
2810 kfree(win);
2811 return -EFAULT;
2812 }
2813
2814 ret = tegra_dc_ext_flip(user, win, win_num,
2815 &args.post_syncpt_id, &args.post_syncpt_val, NULL,
2816 args.dirty_rect, 0, NULL, 0, NULL);
2817
2818 if (dev_cpy_to_usr((void *)args.win, usr_win_size,
2819 win, win_num)) {
2820 kfree(win);
2821 return -EFAULT;
2822 }
2823
2824 if (copy_to_user(user_arg, &args, sizeof(args))) {
2825 kfree(win);
2826 return -EFAULT;
2827 }
2828
2829 kfree(win);
2830 return ret;
2831 }
2832
2833 case TEGRA_DC_EXT_FLIP3:
2834 {
2835 int ret;
2836 int win_num;
2837 struct tegra_dc_ext_flip_3 args;
2838 struct tegra_dc_ext_flip_windowattr_v2 *win;
2839 bool bypass;
2840
2841 u32 usr_win_size = sizeof(struct tegra_dc_ext_flip_windowattr);
2842
2843 if (copy_from_user(&args, user_arg, sizeof(args)))
2844 return -EFAULT;
2845
2846 bypass = !!(args.flags & TEGRA_DC_EXT_FLIP_HEAD_FLAG_YUVBYPASS);
2847
2848#ifndef CONFIG_TEGRA_NVDISPLAY
2849 if (!!(user->ext->dc->mode.vmode & FB_VMODE_YUV_MASK) !=
2850 bypass)
2851 return -EINVAL;
2852#endif
2853
2854 if (bypass != user->ext->dc->yuv_bypass)
2855 user->ext->dc->yuv_bypass_dirty = true;
2856 user->ext->dc->yuv_bypass = bypass;
2857 win_num = args.win_num;
2858 win = kzalloc(sizeof(*win) * win_num, GFP_KERNEL);
2859
2860 if (args.flags &
2861 TEGRA_DC_EXT_FLIP_HEAD_FLAG_V2_ATTR)
2862 usr_win_size =
2863 sizeof(struct tegra_dc_ext_flip_windowattr_v2);
2864
2865 if (dev_cpy_from_usr(win, (void *)args.win,
2866 usr_win_size, win_num)) {
2867 kfree(win);
2868 return -EFAULT;
2869 }
2870
2871 ret = tegra_dc_ext_flip(user, win, win_num,
2872 NULL, NULL, &args.post_syncpt_fd, args.dirty_rect,
2873 args.flags, NULL, 0, NULL);
2874
2875 if (dev_cpy_to_usr((void *)args.win, usr_win_size,
2876 win, win_num)) {
2877 kfree(win);
2878 return -EFAULT;
2879 }
2880
2881 if (copy_to_user(user_arg, &args, sizeof(args))) {
2882 kfree(win);
2883 return -EFAULT;
2884 }
2885
2886 kfree(win);
2887 return ret;
2888 }
2889 case TEGRA_DC_EXT_FLIP4: 2687 case TEGRA_DC_EXT_FLIP4:
2890 { 2688 {
2891 int ret; 2689 int ret;
diff --git a/include/video/tegra_dc_ext.h b/include/video/tegra_dc_ext.h
index 5aa5d9d7e..c68515cd7 100644
--- a/include/video/tegra_dc_ext.h
+++ b/include/video/tegra_dc_ext.h
@@ -373,14 +373,6 @@ struct tegra_dc_ext_flip_windowattr_v2 {
373 }; 373 };
374}; 374};
375 375
376#define TEGRA_DC_EXT_FLIP_N_WINDOWS 3
377
378struct tegra_dc_ext_flip {
379 struct tegra_dc_ext_flip_windowattr win[TEGRA_DC_EXT_FLIP_N_WINDOWS];
380 __u32 post_syncpt_id;
381 __u32 post_syncpt_val;
382};
383
384/* 376/*
385 * Variable win is the pointer to struct tegra_dc_ext_flip_windowattr. 377 * Variable win is the pointer to struct tegra_dc_ext_flip_windowattr.
386 * Using the modified struct to avoid code conflict in user mode, 378 * Using the modified struct to avoid code conflict in user mode,
@@ -389,7 +381,6 @@ struct tegra_dc_ext_flip {
389 * for flip2 use case. 381 * for flip2 use case.
390 * 382 *
391 */ 383 */
392
393struct tegra_dc_ext_flip_2 { 384struct tegra_dc_ext_flip_2 {
394 struct tegra_dc_ext_flip_windowattr __user *win; 385 struct tegra_dc_ext_flip_windowattr __user *win;
395 __u8 win_num; 386 __u8 win_num;
@@ -400,22 +391,6 @@ struct tegra_dc_ext_flip_2 {
400 __u16 dirty_rect[4]; /* x,y,w,h for partial screen update. 0 ignores */ 391 __u16 dirty_rect[4]; /* x,y,w,h for partial screen update. 0 ignores */
401}; 392};
402 393
403/*
404 * Variable win is the pointer to struct tegra_dc_ext_flip_windowattr_v2.
405 * Flags has set to use TEGRA_DC_EXT_FLIP_HEAD_FLAG_V2_ATTR,
406 * then use struct tegra_dc_ext_flip_windowattr_v2. If flag is not set
407 * to use V2_ATTR, then code will use old struct tegra_dc_ext_flip_windowattr
408 *
409*/
410struct tegra_dc_ext_flip_3 {
411 __u64 __user win;
412 __u8 win_num;
413 __u8 flags;
414 __u16 reserved2; /* unused - must be 0 */
415 __s32 post_syncpt_fd;
416 __u16 dirty_rect[4]; /* x,y,w,h for partial screen update. 0 ignores */
417};
418
419enum tegra_dc_ext_flip_data_type { 394enum tegra_dc_ext_flip_data_type {
420 TEGRA_DC_EXT_FLIP_USER_DATA_NONE, /* dummy value - do not use */ 395 TEGRA_DC_EXT_FLIP_USER_DATA_NONE, /* dummy value - do not use */
421 TEGRA_DC_EXT_FLIP_USER_DATA_HDR_DATA, 396 TEGRA_DC_EXT_FLIP_USER_DATA_HDR_DATA,
@@ -649,9 +624,9 @@ struct tegra_dc_ext_flip_user_data {
649} __attribute__((__packed__)); 624} __attribute__((__packed__));
650 625
651/* 626/*
652 *tegra_dc_flip_4 : Incorporates a new pointer to an array of 32 bytes of data 627 * tegra_dc_flip_4 : Incorporates a new pointer to an array of 32 bytes of data
653 *to pass head specific info. The new nr_elements carries the number of such 628 * to pass head specific info. The new nr_elements carries the number of such
654 *elements. Everything else remains the same as in tegra_dc_ext_flip_3 629 * elements.
655 */ 630 */
656struct tegra_dc_ext_flip_4 { 631struct tegra_dc_ext_flip_4 {
657 __u64 __user win; 632 __u64 __user win;
@@ -1153,9 +1128,6 @@ struct tegra_dc_ext_scanline_info {
1153#define TEGRA_DC_EXT_PUT_WINDOW \ 1128#define TEGRA_DC_EXT_PUT_WINDOW \
1154 _IOW('D', 0x02, __u32) 1129 _IOW('D', 0x02, __u32)
1155 1130
1156#define TEGRA_DC_EXT_FLIP \
1157 _IOWR('D', 0x03, struct tegra_dc_ext_flip)
1158
1159#define TEGRA_DC_EXT_GET_CURSOR \ 1131#define TEGRA_DC_EXT_GET_CURSOR \
1160 _IO('D', 0x04) 1132 _IO('D', 0x04)
1161#define TEGRA_DC_EXT_PUT_CURSOR \ 1133#define TEGRA_DC_EXT_PUT_CURSOR \
@@ -1187,9 +1159,6 @@ struct tegra_dc_ext_scanline_info {
1187#define TEGRA_DC_EXT_SET_CMU \ 1159#define TEGRA_DC_EXT_SET_CMU \
1188 _IOW('D', 0x0D, struct tegra_dc_ext_cmu) 1160 _IOW('D', 0x0D, struct tegra_dc_ext_cmu)
1189 1161
1190#define TEGRA_DC_EXT_FLIP2 \
1191 _IOWR('D', 0x0E, struct tegra_dc_ext_flip_2)
1192
1193#define TEGRA_DC_EXT_GET_CMU \ 1162#define TEGRA_DC_EXT_GET_CMU \
1194 _IOR('D', 0x0F, struct tegra_dc_ext_cmu) 1163 _IOR('D', 0x0F, struct tegra_dc_ext_cmu)
1195 1164
@@ -1199,9 +1168,6 @@ struct tegra_dc_ext_scanline_info {
1199#define TEGRA_DC_EXT_SET_PROPOSED_BW \ 1168#define TEGRA_DC_EXT_SET_PROPOSED_BW \
1200 _IOR('D', 0x13, struct tegra_dc_ext_flip_2) 1169 _IOR('D', 0x13, struct tegra_dc_ext_flip_2)
1201 1170
1202#define TEGRA_DC_EXT_FLIP3 \
1203 _IOWR('D', 0x14, struct tegra_dc_ext_flip_3)
1204
1205#define TEGRA_DC_EXT_SET_VBLANK \ 1171#define TEGRA_DC_EXT_SET_VBLANK \
1206 _IOW('D', 0x15, struct tegra_dc_ext_set_vblank) 1172 _IOW('D', 0x15, struct tegra_dc_ext_set_vblank)
1207 1173