hardware/menlow/psb
Revision | ed4d28a7d93bcd1a54c99c398833e5ad56c956a1 (tree) |
---|---|
Time | 2010-07-10 16:57:52 |
Author | Owen Kwon <pinebud77@hotm...> |
Commiter | Owen Kwon |
applied new changes from 2.6.32 kernel
@@ -813,6 +813,8 @@ out_unlock: | ||
813 | 813 | return ret; |
814 | 814 | } |
815 | 815 | |
816 | +EXPORT_SYMBOL(drm_bo_vm_fault); | |
817 | + | |
816 | 818 | int drm_bo_vm_nopfn(struct vm_area_struct *vma, |
817 | 819 | struct vm_fault *vmf ) |
818 | 820 | { |
@@ -1073,6 +1075,7 @@ EXPORT_SYMBOL(drm_bo_vm_nopfn); | ||
1073 | 1075 | mutex_unlock(&dev->struct_mutex); |
1074 | 1076 | } |
1075 | 1077 | |
1078 | +EXPORT_SYMBOL(drm_bo_vm_open); | |
1076 | 1079 | /** |
1077 | 1080 | * \c vma close method for buffer objects. |
1078 | 1081 | * |
@@ -1097,6 +1100,7 @@ EXPORT_SYMBOL(drm_bo_vm_nopfn); | ||
1097 | 1100 | return; |
1098 | 1101 | } |
1099 | 1102 | |
1103 | +EXPORT_SYMBOL(drm_bo_vm_close); | |
1100 | 1104 | static struct vm_operations_struct drm_bo_vm_ops = { |
1101 | 1105 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) |
1102 | 1106 | .fault = drm_bo_vm_fault, |
@@ -32,6 +32,8 @@ | ||
32 | 32 | #include <linux/init.h> |
33 | 33 | #include <linux/console.h> |
34 | 34 | |
35 | +#define BUFFER_COUNT 2 | |
36 | + | |
35 | 37 | #include "drmP.h" |
36 | 38 | #include "drm.h" |
37 | 39 | #include "drm_crtc.h" |
@@ -102,8 +104,11 @@ static int psbfb_setcolreg(unsigned regno, unsigned red, unsigned green, | ||
102 | 104 | if (regno > 15) |
103 | 105 | return 1; |
104 | 106 | |
107 | + /* | |
108 | + * //this sets gamma of psb and it ruins color | |
105 | 109 | if (crtc->funcs->gamma_set) |
106 | 110 | crtc->funcs->gamma_set(crtc, red, green, blue, regno); |
111 | + */ | |
107 | 112 | |
108 | 113 | red = CMAP_TOHW(red, info->var.red.length); |
109 | 114 | blue = CMAP_TOHW(blue, info->var.blue.length); |
@@ -146,11 +151,13 @@ static int psbfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | ||
146 | 151 | return -EINVAL; |
147 | 152 | |
148 | 153 | /* don't support virtuals for now */ |
154 | +#if (BUFFER_COUNT == 1) | |
149 | 155 | if (var->xres_virtual > var->xres) |
150 | 156 | return -EINVAL; |
151 | 157 | |
152 | 158 | if (var->yres_virtual > var->yres) |
153 | 159 | return -EINVAL; |
160 | +#endif | |
154 | 161 | |
155 | 162 | switch (bpp) { |
156 | 163 | case 8: |
@@ -324,6 +331,11 @@ static int psbfb_move_fb_bo(struct fb_info *info, struct drm_buffer_object *bo, | ||
324 | 331 | return ret; |
325 | 332 | } |
326 | 333 | |
334 | +static int psbfb_set_par_ex(struct fb_info * info) | |
335 | +{ | |
336 | + /* need to populate */ | |
337 | +} | |
338 | + | |
327 | 339 | /* this will let fbcon do the mode init */ |
328 | 340 | static int psbfb_set_par(struct fb_info *info) |
329 | 341 | { |
@@ -1045,14 +1057,15 @@ static void psbfb_vm_close(struct vm_area_struct *vma) | ||
1045 | 1057 | psbfb_vm_info_deref((struct psbfb_vm_info **)&vma->vm_private_data); |
1046 | 1058 | } |
1047 | 1059 | |
1060 | +extern int drm_bo_vm_fault(struct vm_area_struct *vma, | |
1061 | + struct vm_fault *vmf); | |
1062 | +extern void drm_bo_vm_open(struct vm_area_struct *vma); | |
1063 | +extern void drm_bo_vm_close(struct vm_area_struct *vma); | |
1064 | + | |
1048 | 1065 | static struct vm_operations_struct psbfb_vm_ops = { |
1049 | - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) | |
1050 | - .fault = psbfb_fault, | |
1051 | - #else | |
1052 | - .nopfn = psbfb_nopfn, | |
1053 | - #endif | |
1054 | - .open = psbfb_vm_open, | |
1055 | - .close = psbfb_vm_close, | |
1066 | + .fault = drm_bo_vm_fault, | |
1067 | + .open = drm_bo_vm_open, | |
1068 | + .close = drm_bo_vm_close, | |
1056 | 1069 | }; |
1057 | 1070 | |
1058 | 1071 | static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
@@ -1075,10 +1088,10 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma) | ||
1075 | 1088 | par->vi->f_mapping = vma->vm_file->f_mapping; |
1076 | 1089 | mutex_unlock(&par->vi->vm_mutex); |
1077 | 1090 | |
1078 | - vma->vm_private_data = psbfb_vm_info_ref(par->vi); | |
1079 | - | |
1080 | 1091 | vma->vm_ops = &psbfb_vm_ops; |
1081 | 1092 | vma->vm_flags |= VM_PFNMAP; |
1093 | + vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)) ; | |
1094 | + | |
1082 | 1095 | |
1083 | 1096 | return 0; |
1084 | 1097 | } |
@@ -1095,20 +1108,26 @@ int psbfb_sync(struct fb_info *info) | ||
1095 | 1108 | return 0; |
1096 | 1109 | } |
1097 | 1110 | |
1098 | -int psbfb_pan_display (struct fb_info *info) | |
1111 | +extern void intel_pipe_set_base(struct drm_crtc *crtc, int x,int y); | |
1112 | +int psbfb_pan_display (struct fb_var_screeninfo *var, struct fb_info *info) | |
1099 | 1113 | { |
1114 | + struct psbfb_par *par = info->par; | |
1115 | + | |
1116 | + intel_pipe_set_base (par->crtc, var->xoffset, var->yoffset); | |
1117 | + msleep(1); | |
1118 | + | |
1100 | 1119 | return 0; |
1101 | 1120 | } |
1102 | 1121 | |
1103 | 1122 | static struct fb_ops psbfb_ops = { |
1104 | 1123 | .owner = THIS_MODULE, |
1105 | 1124 | .fb_check_var = psbfb_check_var, |
1106 | - .fb_set_par = psbfb_set_par, | |
1125 | + .fb_set_par = psbfb_set_par_ex, | |
1107 | 1126 | .fb_setcolreg = psbfb_setcolreg, |
1108 | 1127 | .fb_fillrect = psbfb_fillrect, |
1109 | 1128 | .fb_copyarea = psbfb_copyarea, |
1110 | 1129 | .fb_imageblit = psbfb_imageblit, |
1111 | -// .fb_mmap = psbfb_mmap, | |
1130 | + .fb_mmap = psbfb_mmap, | |
1112 | 1131 | .fb_sync = psbfb_sync, |
1113 | 1132 | .fb_blank = psbfb_blank, |
1114 | 1133 | .fb_pan_display = psbfb_pan_display, |
@@ -1126,6 +1145,7 @@ int psbfb_probe(struct drm_device *dev, struct drm_crtc *crtc) | ||
1126 | 1145 | struct drm_buffer_object *fbo = NULL; |
1127 | 1146 | int ret; |
1128 | 1147 | int is_iomem; |
1148 | + int size; | |
1129 | 1149 | |
1130 | 1150 | if (drm_psb_no_fb) { |
1131 | 1151 | /* need to do this as the DRM will disable the output */ |
@@ -1153,9 +1173,11 @@ int psbfb_probe(struct drm_device *dev, struct drm_crtc *crtc) | ||
1153 | 1173 | fb->depth = 16; |
1154 | 1174 | fb->pitch = |
1155 | 1175 | ((fb->width * ((fb->bits_per_pixel + 1) / 8)) + 0x3f) & ~0x3f; |
1176 | + size = fb->pitch * fb->height * BUFFER_COUNT; | |
1177 | + ALIGN(size, PAGE_SIZE); | |
1156 | 1178 | |
1157 | 1179 | ret = drm_buffer_object_create(dev, |
1158 | - fb->pitch * fb->height, | |
1180 | + size, | |
1159 | 1181 | drm_bo_type_kernel, |
1160 | 1182 | DRM_BO_FLAG_READ | |
1161 | 1183 | DRM_BO_FLAG_WRITE | |
@@ -1204,7 +1226,7 @@ int psbfb_probe(struct drm_device *dev, struct drm_crtc *crtc) | ||
1204 | 1226 | info->fix.mmio_len = 0; |
1205 | 1227 | info->fix.line_length = fb->pitch; |
1206 | 1228 | info->fix.smem_start = dev->mode_config.fb_base + fb->offset; |
1207 | - info->fix.smem_len = info->fix.line_length * fb->height; | |
1229 | + info->fix.smem_len = size; | |
1208 | 1230 | |
1209 | 1231 | info->flags = FBINFO_DEFAULT | |
1210 | 1232 | FBINFO_PARTIAL_PAN_OK /*| FBINFO_MISC_ALWAYS_SETPAR */ ; |
@@ -1216,11 +1238,11 @@ int psbfb_probe(struct drm_device *dev, struct drm_crtc *crtc) | ||
1216 | 1238 | } |
1217 | 1239 | |
1218 | 1240 | info->screen_base = drm_bmo_virtual(&fb->kmap, &is_iomem); |
1219 | - memset(info->screen_base, 0x00, fb->pitch*fb->height); | |
1241 | + memset(info->screen_base, 0x00, size); | |
1220 | 1242 | info->screen_size = info->fix.smem_len; /* FIXME */ |
1221 | 1243 | info->pseudo_palette = fb->pseudo_palette; |
1222 | 1244 | info->var.xres_virtual = fb->width; |
1223 | - info->var.yres_virtual = fb->height; | |
1245 | + info->var.yres_virtual = fb->height * BUFFER_COUNT; | |
1224 | 1246 | info->var.bits_per_pixel = fb->bits_per_pixel; |
1225 | 1247 | info->var.xoffset = 0; |
1226 | 1248 | info->var.yoffset = 0; |