drivers/gpu/drm/via/via_fb.c | 49 ++++++++++++++++++++--------------------- drivers/gpu/drm/via/via_hdmi.c | 18 ++++++++------- include/drm/drm_fb_helper.h | 1 3 files changed, 34 insertions(+), 34 deletions(-)
New commits: commit eacf12f070d96fa4307da51d659ad2d0f2553a7c Author: James Simmons <[email protected]> Date: Sat May 25 10:07:58 2013 -0400 Instead of stuffing some pointer into struct drm_fb_helper that we added instead create a special container that holds the ttm_bo_kmap_obj for the fbdev framebuffer. This will make it acceptable for merging upstream. diff --git a/drivers/gpu/drm/via/via_fb.c b/drivers/gpu/drm/via/via_fb.c index 5a9ea9b..abd7b3a 100644 --- a/drivers/gpu/drm/via/via_fb.c +++ b/drivers/gpu/drm/via/via_fb.c @@ -25,6 +25,11 @@ #include "drm_fb_helper.h" #include "drm_crtc_helper.h" +struct ttm_fb_helper { + struct drm_fb_helper base; + struct ttm_bo_kmap_obj kmap; +}; + static int cle266_mem_type(struct drm_via_private *dev_priv, struct pci_dev *bridge) { @@ -990,26 +995,23 @@ static int via_fb_probe(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { + struct ttm_fb_helper *ttmfb = container_of(helper, struct ttm_fb_helper, base); struct drm_via_private *dev_priv = helper->dev->dev_private; + struct ttm_bo_kmap_obj *kmap = &ttmfb->kmap; struct fb_info *info = helper->fbdev; - struct ttm_bo_kmap_obj *kmap = NULL; struct drm_framebuffer *fb = NULL; struct drm_gem_object *obj = NULL; struct drm_mode_fb_cmd2 mode_cmd; struct apertures_struct *ap; int size, ret = 0; - void *ptr; /* Already exist */ if (helper->fb) return ret; - size = sizeof(*fb) + sizeof(*kmap); - ptr = kzalloc(size, GFP_KERNEL); - if (ptr == NULL) + fb = kzalloc(sizeof(*fb), GFP_KERNEL); + if (fb == NULL) return -ENOMEM; - fb = ptr; - kmap = ptr + sizeof(*fb); mode_cmd.height = sizes->surface_height; mode_cmd.width = sizes->surface_width; @@ -1041,11 +1043,9 @@ via_fb_probe(struct drm_fb_helper *helper, obj->driver_private = kmap->bo; fb->helper_private = obj; + ttmfb->base.fb = fb; drm_helper_mode_fill_fb_struct(fb, &mode_cmd); - helper->helper_private = kmap; - helper->fb = fb; - info->fix.smem_start = kmap->bo->mem.bus.base + kmap->bo->mem.bus.offset; info->fix.smem_len = info->screen_size = size; @@ -1069,14 +1069,13 @@ out_err: if (kmap->bo) { ttm_bo_unpin(kmap->bo, kmap); ttm_bo_unref(&kmap->bo); - helper->helper_private = NULL; } if (obj) { drm_gem_object_unreference_unlocked(obj); helper->fb->helper_private = NULL; } - kfree(ptr); + kfree(fb); } return ret; } @@ -1175,7 +1174,7 @@ static struct fb_ops viafb_ops = { int via_framebuffer_init(struct drm_device *dev, struct drm_fb_helper **ptr) { - struct drm_fb_helper *helper; + struct ttm_fb_helper *helper; struct fb_info *info; int ret = -ENOMEM; @@ -1188,8 +1187,8 @@ via_framebuffer_init(struct drm_device *dev, struct drm_fb_helper **ptr) } helper = info->par; - helper->fbdev = info; - helper->funcs = &via_fb_helper_funcs; + helper->base.fbdev = info; + helper->base.funcs = &via_fb_helper_funcs; strcpy(info->fix.id, dev->driver->name); strcat(info->fix.id, "drmfb"); @@ -1207,18 +1206,18 @@ via_framebuffer_init(struct drm_device *dev, struct drm_fb_helper **ptr) if (ret) goto out_err; - ret = drm_fb_helper_init(dev, helper, dev->num_crtcs, + ret = drm_fb_helper_init(dev, &helper->base, dev->num_crtcs, dev->mode_config.num_connector); if (ret) { fb_dealloc_cmap(&info->cmap); goto out_err; } - drm_fb_helper_single_add_all_connectors(helper); + drm_fb_helper_single_add_all_connectors(&helper->base); drm_helper_disable_unused_functions(dev); - drm_fb_helper_initial_config(helper, 32); + drm_fb_helper_initial_config(&helper->base, 32); drm_kms_helper_poll_init(dev); - *ptr = helper; + *ptr = (struct drm_fb_helper *) helper; out_err: if (ret) framebuffer_release(info); @@ -1230,13 +1229,14 @@ via_framebuffer_fini(struct drm_device *dev) { struct drm_via_private *dev_priv = dev->dev_private; struct drm_fb_helper *helper = dev_priv->helper; - struct ttm_bo_kmap_obj *kmap; + struct ttm_fb_helper *ttmfb; struct drm_gem_object *obj; struct fb_info *info; if (!helper) return; + ttmfb = container_of(helper, struct ttm_fb_helper, base); info = helper->fbdev; if (info) { unregister_framebuffer(info); @@ -1249,11 +1249,10 @@ via_framebuffer_fini(struct drm_device *dev) helper->fbdev = NULL; } - kmap = helper->helper_private; - if (kmap) { - ttm_bo_unpin(kmap->bo, kmap); - ttm_bo_unref(&kmap->bo); - helper->helper_private = NULL; + ttmfb = container_of(helper, struct ttm_fb_helper, base); + if (ttmfb->kmap.bo) { + ttm_bo_unpin(ttmfb->kmap.bo, &ttmfb->kmap); + ttm_bo_unref(&ttmfb->kmap.bo); } obj = helper->fb->helper_private; diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index 9187e8b..471f276 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h @@ -91,7 +91,6 @@ struct drm_fb_helper { struct fb_info *fbdev; u32 pseudo_palette[17]; struct list_head kernel_fb_list; - void *helper_private; /* we got a hotplug but fbdev wasn't running the console delay until next set_par */ commit 484c66c400daa76bd6840f195e8effa9d39dfb3c Author: James Simmons <[email protected]> Date: Sat May 25 09:28:13 2013 -0400 Fixed proper detection of the presence of a HDMI monitor. Register 0xC0B4 expects the absolute offset in the edid not the relative offset in respect of each section. Fixed a one off for reallocating the EDID buffer if the number of extenstions obtain is different then reported in the last byte of the first block of EDID data. diff --git a/drivers/gpu/drm/via/via_hdmi.c b/drivers/gpu/drm/via/via_hdmi.c index 8caaf9f..b37405a 100644 --- a/drivers/gpu/drm/via/via_hdmi.c +++ b/drivers/gpu/drm/via/via_hdmi.c @@ -408,7 +408,8 @@ via_check_hdmi_i2c_status(struct drm_via_private *dev_priv, } unsigned int -via_ddc_read_bytes_by_hdmi(struct drm_via_private *dev_priv, unsigned char *block) +via_ddc_read_bytes_by_hdmi(struct drm_via_private *dev_priv, unsigned int offset, + unsigned char *block) { unsigned int status = true, temp = 0, i; @@ -432,8 +433,8 @@ via_ddc_read_bytes_by_hdmi(struct drm_via_private *dev_priv, unsigned char *bloc if (status) status = via_check_hdmi_i2c_status(dev_priv, 0x0008, true); - /* Offset - always read at start of buffer */ - temp = 0; + /* Offset */ + temp = offset; temp <<= 16; temp |= VIA_READ(0xC0B4) & 0xFF00FFFF; VIA_WRITE(0xC0B4, temp); @@ -496,7 +497,7 @@ via_hdmi_get_edid(struct drm_connector *connector) /* base block fetch */ for (i = 0; i < 4; i++) { - if (!via_ddc_read_bytes_by_hdmi(dev_priv, block)) + if (!via_ddc_read_bytes_by_hdmi(dev_priv, 0, block)) goto out; if (drm_edid_block_valid(block, 0, print_bad_edid)) @@ -513,7 +514,7 @@ via_hdmi_get_edid(struct drm_connector *connector) /* parse the extensions if present */ if (block[0x7e]) { u8 *new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL); - int valid_extensions = 0; + int valid_extensions = 0, offset = 0; if (!new) goto out; @@ -521,9 +522,10 @@ via_hdmi_get_edid(struct drm_connector *connector) for (j = 1; j <= block[0x7e]; j++) { for (i = 0; i < 4; i++) { - new = block + (valid_extensions + 1) * EDID_LENGTH; + offset = (valid_extensions + 1) * EDID_LENGTH; + new = block + offset; - if (!via_ddc_read_bytes_by_hdmi(dev_priv, new)) + if (!via_ddc_read_bytes_by_hdmi(dev_priv, offset, new)) goto out; if (drm_edid_block_valid(new, j, print_bad_edid)) { @@ -545,7 +547,7 @@ via_hdmi_get_edid(struct drm_connector *connector) block[EDID_LENGTH - 1] += block[0x7e] - valid_extensions; block[0x7e] = valid_extensions; - new = krealloc(block, valid_extensions * EDID_LENGTH, GFP_KERNEL); + new = krealloc(block, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL); if (!new) goto out; block = new; _______________________________________________ Openchrome-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/openchrome-devel
