From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Tue, 31 Jan 2023 10:22:15 +0000 (+0100) Subject: Merge v6.2-rc6 into drm-next X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=aebd8f0c6f8280ba35bc989f4a9ea47469d3589a;p=linux.git Merge v6.2-rc6 into drm-next Due to holidays we started -next with more -fixes in-flight than usual, and people have been asking where they are. Backmerge to get things better in sync. Conflicts: - Tiny conflict in drm_fbdev_generic.c between variable rename and missing error handling that got added. - Conflict in drm_fb_helper.c between the added call to vgaswitcheroo in drm_fb_helper_single_fb_probe and a refactor patch that extracted lots of helpers and incidentally removed the dev local variable. Readd it to make things compile. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> --- aebd8f0c6f8280ba35bc989f4a9ea47469d3589a diff --cc drivers/gpu/drm/drm_fb_helper.c index 97b34f377fe8a,0d0c26ebab906..28c428e9c5308 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@@ -1915,52 -1888,17 +1917,53 @@@ static int __drm_fb_helper_find_sizes(s return -EAGAIN; } + return 0; +} + +static int drm_fb_helper_find_sizes(struct drm_fb_helper *fb_helper, + struct drm_fb_helper_surface_size *sizes) +{ + struct drm_client_dev *client = &fb_helper->client; + struct drm_device *dev = fb_helper->dev; + struct drm_mode_config *config = &dev->mode_config; + int ret; + + mutex_lock(&client->modeset_mutex); + ret = __drm_fb_helper_find_sizes(fb_helper, sizes); + mutex_unlock(&client->modeset_mutex); + + if (ret) + return ret; + /* Handle our overallocation */ - sizes.surface_height *= drm_fbdev_overalloc; - sizes.surface_height /= 100; - if (sizes.surface_height > config->max_height) { + sizes->surface_height *= drm_fbdev_overalloc; + sizes->surface_height /= 100; + if (sizes->surface_height > config->max_height) { drm_dbg_kms(dev, "Fbdev over-allocation too large; clamping height to %d\n", config->max_height); - sizes.surface_height = config->max_height; + sizes->surface_height = config->max_height; + } + + return 0; +} + +/* + * Allocates the backing storage and sets up the fbdev info structure through + * the ->fb_probe callback. + */ +static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper) +{ + struct drm_client_dev *client = &fb_helper->client; ++ struct drm_device *dev = fb_helper->dev; + struct drm_fb_helper_surface_size sizes; + int ret; + + ret = drm_fb_helper_find_sizes(fb_helper, &sizes); + if (ret) { + /* First time: disable all crtc's.. */ + if (!fb_helper->deferred_setup) + drm_client_modeset_commit(client); + return ret; } #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) diff --cc drivers/gpu/drm/drm_fbdev_generic.c index 43f94aa9e0152,593aa3283792b..365f80717fa13 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@@ -189,25 -200,31 +184,31 @@@ static int drm_fbdev_fb_probe(struct dr fb_helper->fb = buffer->fb; fb = buffer->fb; - fbi = drm_fb_helper_alloc_info(fb_helper); - if (IS_ERR(fbi)) - return PTR_ERR(fbi); + info = drm_fb_helper_alloc_info(fb_helper); + if (IS_ERR(info)) + return PTR_ERR(info); - fbi->fbops = &drm_fbdev_fb_ops; - fbi->screen_size = sizes->surface_height * fb->pitches[0]; - fbi->fix.smem_len = fbi->screen_size; - fbi->flags = FBINFO_DEFAULT; + info->fbops = &drm_fbdev_fb_ops; + info->screen_size = sizes->surface_height * fb->pitches[0]; + info->fix.smem_len = info->screen_size; + info->flags = FBINFO_DEFAULT; - drm_fb_helper_fill_info(fbi, fb_helper, sizes); + drm_fb_helper_fill_info(info, fb_helper, sizes); if (drm_fbdev_use_shadow_fb(fb_helper)) { - fbi->screen_buffer = vzalloc(fbi->screen_size); - if (!fbi->screen_buffer) + info->screen_buffer = vzalloc(info->screen_size); + if (!info->screen_buffer) return -ENOMEM; - fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; + info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; - info->fbdefio = &drm_fbdev_defio; - fb_deferred_io_init(info); + /* Set a default deferred I/O handler */ + fb_helper->fbdefio.delay = HZ / 20; + fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io; + - fbi->fbdefio = &fb_helper->fbdefio; - ret = fb_deferred_io_init(fbi); ++ info->fbdefio = &fb_helper->fbdefio; ++ ret = fb_deferred_io_init(info); + if (ret) + return ret; } else { /* buffer is mapped for HW framebuffer */ ret = drm_client_buffer_vmap(fb_helper->buffer, &map); diff --cc drivers/gpu/drm/tests/Makefile index aaf357e29c656,f896ef85c2f2b..bca726a8f4832 --- a/drivers/gpu/drm/tests/Makefile +++ b/drivers/gpu/drm/tests/Makefile @@@ -12,9 -8,9 +12,11 @@@ obj-$(CONFIG_DRM_KUNIT_TEST) += drm_format_helper_test.o \ drm_format_test.o \ drm_framebuffer_test.o \ - drm_kunit_helpers.o \ + drm_managed_test.o \ drm_mm_test.o \ + drm_modes_test.o \ drm_plane_helper_test.o \ + drm_probe_helper_test.o \ drm_rect_test.o + + CFLAGS_drm_mm_test.o := $(DISABLE_STRUCTLEAK_PLUGIN) diff --cc drivers/gpu/drm/vmwgfx/ttm_object.h index 95a9679f9d396,8098a3846bae3..e6b77ee33e559 --- a/drivers/gpu/drm/vmwgfx/ttm_object.h +++ b/drivers/gpu/drm/vmwgfx/ttm_object.h @@@ -309,27 -307,4 +309,12 @@@ extern int ttm_prime_handle_to_fd(struc #define ttm_prime_object_kfree(__obj, __prime) \ kfree_rcu(__obj, __prime.base.rhead) - struct ttm_base_object * - ttm_base_object_noref_lookup(struct ttm_object_file *tfile, uint64_t key); - - /** - * ttm_base_object_noref_release - release a base object pointer looked up - * without reference - * - * Releases a base object pointer looked up with ttm_base_object_noref_lookup(). - */ - static inline void ttm_base_object_noref_release(void) - { - __acquire(RCU); - rcu_read_unlock(); - } - +static inline int ttm_bo_wait(struct ttm_buffer_object *bo, bool intr, + bool no_wait) +{ + struct ttm_operation_ctx ctx = { intr, no_wait }; + + return ttm_bo_wait_ctx(bo, &ctx); +} + #endif