diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_crtc.c | 19 | ||||
-rw-r--r-- | linux-core/drm_crtc.h | 4 | ||||
-rw-r--r-- | linux-core/drm_crtc_helper.c | 1 | ||||
-rw-r--r-- | linux-core/intel_display.c | 32 |
4 files changed, 36 insertions, 20 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index d49834b9..e1b371cc 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -2055,25 +2055,10 @@ int drm_mode_replacefb(struct drm_device *dev, goto out; } - fb->width = r->width; - fb->height = r->height; - fb->pitch = r->pitch; - fb->bits_per_pixel = r->bpp; - fb->depth = r->depth; - fb->mm_handle = r->handle; - if (dev->mode_config.funcs->resize_fb) - dev->mode_config.funcs->resize_fb(dev, fb); + ret = dev->mode_config.funcs->resize_fb(dev, file_priv, fb, r); else - ret = -EINVAL; -#if 0 - /* find all crtcs connected to this fb */ - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - if (crtc->fb->base.id == r->buffer_id) { - crtc->funcs->mode_set_base(crtc, crtc->x, crtc->y); - } - } -#endif + ret = -EINVAL; out: mutex_unlock(&dev->mode_config.mutex); return ret; diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h index 043b4a57..5f5f195a 100644 --- a/linux-core/drm_crtc.h +++ b/linux-core/drm_crtc.h @@ -522,9 +522,9 @@ struct drm_mode_set { * the CRTC<->connector mappings as needed and update its view of the screen. */ struct drm_mode_config_funcs { - bool (*resize_fb)(struct drm_device *dev, struct drm_framebuffer *fb); + int (*resize_fb)(struct drm_device *dev, struct drm_file *file_priv, struct drm_framebuffer *fb, struct drm_mode_fb_cmd *mode_cmd); struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); - void (*fb_changed)(struct drm_device *dev); + int (*fb_changed)(struct drm_device *dev); }; struct drm_mode_group { diff --git a/linux-core/drm_crtc_helper.c b/linux-core/drm_crtc_helper.c index 777820d7..bfddab99 100644 --- a/linux-core/drm_crtc_helper.c +++ b/linux-core/drm_crtc_helper.c @@ -758,3 +758,4 @@ out_err: return ret; } EXPORT_SYMBOL(drm_get_buffer_object); + diff --git a/linux-core/intel_display.c b/linux-core/intel_display.c index 0081b5be..0a2854a2 100644 --- a/linux-core/intel_display.c +++ b/linux-core/intel_display.c @@ -1517,8 +1517,38 @@ struct drm_framebuffer *intel_user_framebuffer_create(struct drm_device *dev, return &intel_fb->base; } +static int intel_insert_new_fb(struct drm_device *dev, struct drm_file *file_priv, + struct drm_framebuffer *fb, struct drm_mode_fb_cmd *mode_cmd) +{ + struct intel_framebuffer *intel_fb; + struct drm_buffer_object *bo; + struct drm_crtc *crtc; + + intel_fb = to_intel_framebuffer(fb); + + mutex_lock(&dev->struct_mutex); + bo = drm_lookup_buffer_object(file_priv, mode_cmd->handle, 0); + mutex_unlock(&dev->struct_mutex); + + if (!bo) + return -EINVAL; + drm_helper_mode_fill_fb_struct(fb, mode_cmd); + + drm_bo_usage_deref_unlocked(&intel_fb->bo); + + intel_fb->bo = bo; + + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { + if (crtc->fb == fb) { + struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; + crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y); + } + } + return 0; +} + static const struct drm_mode_config_funcs intel_mode_funcs = { - .resize_fb = NULL, + .resize_fb = intel_insert_new_fb, .fb_create = intel_user_framebuffer_create, .fb_changed = intelfb_probe, }; |