Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Update fbdev fb_fix_screeninfo

If you change the color depth via fbset or some other framebuffer aware
userland application struct fb_fix_screeninfo is not updated to this new
information. This patch fixes this issue. Also the function is changed to
just pass in struct drm_framebuffer so in the future we could use more
fields. I'm hoping some day fix->smem* could be set here :-)

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

James Simmons and committed by
Dave Airlie
dfe63bb0 f598aa75

+21 -27
+21 -20
drivers/gpu/drm/drm_fb_helper.c
··· 607 607 } 608 608 EXPORT_SYMBOL(drm_fb_helper_fini); 609 609 610 + void drm_fb_helper_fill_fix(struct fb_info *info, struct drm_framebuffer *fb) 611 + { 612 + info->fix.type = FB_TYPE_PACKED_PIXELS; 613 + info->fix.visual = fb->depth == 8 ? FB_VISUAL_PSEUDOCOLOR : 614 + FB_VISUAL_TRUECOLOR; 615 + info->fix.mmio_start = 0; 616 + info->fix.mmio_len = 0; 617 + info->fix.type_aux = 0; 618 + info->fix.xpanstep = 1; /* doing it in hw */ 619 + info->fix.ypanstep = 1; /* doing it in hw */ 620 + info->fix.ywrapstep = 0; 621 + info->fix.accel = FB_ACCEL_NONE; 622 + info->fix.type_aux = 0; 623 + 624 + info->fix.line_length = fb->pitch; 625 + return; 626 + } 627 + EXPORT_SYMBOL(drm_fb_helper_fill_fix); 628 + 610 629 static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green, 611 630 u16 blue, u16 regno, struct fb_info *info) 612 631 { ··· 835 816 mutex_unlock(&dev->mode_config.mutex); 836 817 return ret; 837 818 } 819 + drm_fb_helper_fill_fix(info, fb_helper->fb); 838 820 } 839 821 mutex_unlock(&dev->mode_config.mutex); 840 822 ··· 973 953 974 954 if (new_fb) { 975 955 info->var.pixclock = 0; 956 + drm_fb_helper_fill_fix(info, fb_helper->fb); 976 957 if (register_framebuffer(info) < 0) { 977 958 return -EINVAL; 978 959 } ··· 999 978 return 0; 1000 979 } 1001 980 EXPORT_SYMBOL(drm_fb_helper_single_fb_probe); 1002 - 1003 - void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 1004 - uint32_t depth) 1005 - { 1006 - info->fix.type = FB_TYPE_PACKED_PIXELS; 1007 - info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR : 1008 - FB_VISUAL_TRUECOLOR; 1009 - info->fix.mmio_start = 0; 1010 - info->fix.mmio_len = 0; 1011 - info->fix.type_aux = 0; 1012 - info->fix.xpanstep = 1; /* doing it in hw */ 1013 - info->fix.ypanstep = 1; /* doing it in hw */ 1014 - info->fix.ywrapstep = 0; 1015 - info->fix.accel = FB_ACCEL_NONE; 1016 - info->fix.type_aux = 0; 1017 - 1018 - info->fix.line_length = pitch; 1019 - return; 1020 - } 1021 - EXPORT_SYMBOL(drm_fb_helper_fill_fix); 1022 981 1023 982 void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 1024 983 uint32_t fb_width, uint32_t fb_height)
-1
drivers/gpu/drm/i915/intel_fb.c
··· 150 150 151 151 // memset(info->screen_base, 0, size); 152 152 153 - drm_fb_helper_fill_fix(info, fb->pitch, fb->depth); 154 153 drm_fb_helper_fill_var(info, &ifbdev->helper, sizes->fb_width, sizes->fb_height); 155 154 156 155 info->pixmap.size = 64*1024;
-1
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 359 359 info->screen_base = nvbo_kmap_obj_iovirtual(nouveau_fb->nvbo); 360 360 info->screen_size = size; 361 361 362 - drm_fb_helper_fill_fix(info, fb->pitch, fb->depth); 363 362 drm_fb_helper_fill_var(info, &nfbdev->helper, sizes->fb_width, sizes->fb_height); 364 363 365 364 /* Set aperture base/size for vesafb takeover */
-2
drivers/gpu/drm/radeon/radeon_fb.c
··· 225 225 226 226 strcpy(info->fix.id, "radeondrmfb"); 227 227 228 - drm_fb_helper_fill_fix(info, fb->pitch, fb->depth); 229 - 230 228 info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; 231 229 info->fbops = &radeonfb_ops; 232 230
-3
include/drm/drm_fb_helper.h
··· 121 121 void drm_fb_helper_restore(void); 122 122 void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 123 123 uint32_t fb_width, uint32_t fb_height); 124 - void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 125 - uint32_t depth); 126 - 127 124 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 128 125 129 126 bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);