Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: drivers/char/msm_kgsl/kgsl.c

Issue 668184: msm_kgsl: Implement the old version of the KGSL_SHAREDMEM_FROM_PMEM ioctl. (Closed)
Patch Set: Respond to review. Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/linux/msm_kgsl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. 1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify 3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and 4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation. 5 * only version 2 as published by the Free Software Foundation.
6 * 6 *
7 * This program is distributed in the hope that it will be useful, 7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details. 10 * GNU General Public License for more details.
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 819
820 error_free_entry: 820 error_free_entry:
821 kfree(entry); 821 kfree(entry);
822 822
823 error: 823 error:
824 return result; 824 return result;
825 } 825 }
826 #endif /*CONFIG_MSM_KGSL_MMU*/ 826 #endif /*CONFIG_MSM_KGSL_MMU*/
827 827
828 static long kgsl_ioctl_sharedmem_from_pmem(struct kgsl_file_private *private, 828 static long kgsl_ioctl_sharedmem_from_pmem(struct kgsl_file_private *private,
829 » » » » » » void __user *arg) 829 » » » » » » void __user *arg,
830 » » » » » » size_t size)
830 { 831 {
831 int result = 0; 832 int result = 0;
832 struct kgsl_sharedmem_from_pmem param; 833 struct kgsl_sharedmem_from_pmem param;
833 struct kgsl_mem_entry *entry = NULL; 834 struct kgsl_mem_entry *entry = NULL;
834 unsigned long start = 0, vstart = 0, len = 0; 835 unsigned long start = 0, vstart = 0, len = 0;
835 struct file *pmem_file = NULL; 836 struct file *pmem_file = NULL;
836 837
837 » if (copy_from_user(&param, arg, sizeof(param))) { 838 » if (!(size == sizeof(struct kgsl_sharedmem_from_pmem_old) ||
839 » size == sizeof(param))) {
840 » » result = -EINVAL;
841 » » goto error;
842 » }
843
844 » memset(&param, 0, sizeof(param));
845 » if (copy_from_user(&param, arg, size)) {
838 result = -EFAULT; 846 result = -EFAULT;
839 goto error; 847 goto error;
840 } 848 }
841 849
842 if (get_pmem_file(param.pmem_fd, &start, &vstart, &len, &pmem_file)) { 850 if (get_pmem_file(param.pmem_fd, &start, &vstart, &len, &pmem_file)) {
843 result = -EINVAL; 851 result = -EINVAL;
844 goto error; 852 goto error;
845 } 853 }
846 854
847 if (!param.len) 855 if (!param.len)
(...skipping 26 matching lines...) Expand all
874 KGSL_MEMFLAGS_ALIGN4K | KGSL_MEMFLAGS_CONPHYS); 882 KGSL_MEMFLAGS_ALIGN4K | KGSL_MEMFLAGS_CONPHYS);
875 if (result) 883 if (result)
876 goto error_free_entry; 884 goto error_free_entry;
877 885
878 /* If the offset is not at 4K boundary then add the correct offset 886 /* If the offset is not at 4K boundary then add the correct offset
879 * value to gpuaddr */ 887 * value to gpuaddr */
880 entry->memdesc.gpuaddr += (param.offset & ~KGSL_PAGEMASK); 888 entry->memdesc.gpuaddr += (param.offset & ~KGSL_PAGEMASK);
881 889
882 param.gpuaddr = entry->memdesc.gpuaddr; 890 param.gpuaddr = entry->memdesc.gpuaddr;
883 891
884 » if (copy_to_user(arg, &param, sizeof(param))) { 892 » if (copy_to_user(arg, &param, size)) {
885 result = -EFAULT; 893 result = -EFAULT;
886 goto error_unmap_entry; 894 goto error_unmap_entry;
887 } 895 }
888 return result; 896 return result;
889 897
890 error_unmap_entry: 898 error_unmap_entry:
891 kgsl_mmu_unmap(entry->memdesc.pagetable, 899 kgsl_mmu_unmap(entry->memdesc.pagetable,
892 entry->memdesc.gpuaddr & KGSL_PAGEMASK, 900 entry->memdesc.gpuaddr & KGSL_PAGEMASK,
893 entry->memdesc.size); 901 entry->memdesc.size);
894 error_free_entry: 902 error_free_entry:
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 case IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE: 1016 case IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE:
1009 if (kgsl_cache_enable) 1017 if (kgsl_cache_enable)
1010 result = 1018 result =
1011 kgsl_ioctl_sharedmem_flush_cache(private, 1019 kgsl_ioctl_sharedmem_flush_cache(private,
1012 (void __user *)arg); 1020 (void __user *)arg);
1013 break; 1021 break;
1014 #endif 1022 #endif
1015 case IOCTL_KGSL_SHAREDMEM_FROM_PMEM: 1023 case IOCTL_KGSL_SHAREDMEM_FROM_PMEM:
1016 kgsl_yamato_runpending(&kgsl_driver.yamato_device); 1024 kgsl_yamato_runpending(&kgsl_driver.yamato_device);
1017 result = kgsl_ioctl_sharedmem_from_pmem(private, 1025 result = kgsl_ioctl_sharedmem_from_pmem(private,
1018 » » » » » » » (void __user *)arg); 1026 » » » » (void __user *)arg,
1027 » » » » sizeof(struct kgsl_sharedmem_from_pmem));
1028 » » break;
1029
1030 » case IOCTL_KGSL_SHAREDMEM_FROM_PMEM_OLD:
1031 » » kgsl_yamato_runpending(&kgsl_driver.yamato_device);
1032 » » result = kgsl_ioctl_sharedmem_from_pmem(private,
1033 » » » » (void __user *)arg,
1034 » » » » sizeof(struct kgsl_sharedmem_from_pmem_old));
1019 break; 1035 break;
1020 1036
1021 case IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET: 1037 case IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET:
1022 if (copy_from_user(&binbase, (void __user *)arg, 1038 if (copy_from_user(&binbase, (void __user *)arg,
1023 sizeof(binbase))) { 1039 sizeof(binbase))) {
1024 result = -EFAULT; 1040 result = -EFAULT;
1025 break; 1041 break;
1026 } 1042 }
1027 1043
1028 if (private->ctxt_id_mask & (1 << binbase.drawctxt_id)) { 1044 if (private->ctxt_id_mask & (1 << binbase.drawctxt_id)) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 module_init(kgsl_mod_init); 1288 module_init(kgsl_mod_init);
1273 #else 1289 #else
1274 late_initcall(kgsl_mod_init); 1290 late_initcall(kgsl_mod_init);
1275 #endif 1291 #endif
1276 module_exit(kgsl_mod_exit); 1292 module_exit(kgsl_mod_exit);
1277 1293
1278 MODULE_DESCRIPTION("3D graphics driver for QSD8x50, MSM7x27, and MSM7x30"); 1294 MODULE_DESCRIPTION("3D graphics driver for QSD8x50, MSM7x27, and MSM7x30");
1279 MODULE_VERSION("1.0"); 1295 MODULE_VERSION("1.0");
1280 MODULE_LICENSE("GPL v2"); 1296 MODULE_LICENSE("GPL v2");
1281 MODULE_ALIAS("platform:kgsl"); 1297 MODULE_ALIAS("platform:kgsl");
OLDNEW
« no previous file with comments | « no previous file | include/linux/msm_kgsl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698