drivers/gpu/drm/openchrome/Makefile | 1 drivers/gpu/drm/openchrome/openchrome_crtc.c | 9 -- drivers/gpu/drm/openchrome/openchrome_drv.c | 15 --- drivers/gpu/drm/openchrome/openchrome_drv.h | 11 -- drivers/gpu/drm/openchrome/openchrome_fb.c | 98 +++++++++++++++++++-- drivers/gpu/drm/openchrome/openchrome_fbdev.c | 112 ------------------------- drivers/gpu/drm/openchrome/openchrome_object.c | 1 7 files changed, 96 insertions(+), 151 deletions(-)
New commits: commit ce6d16aee96a0f1cf2f537cd66c53ff0a27d7191 Author: Kevin Brace <kevinbr...@gmx.com> Date: Mon Sep 14 14:42:27 2020 -0700 drm/openchrome: Version bumped to 3.3.4 Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h index 83cfa0cd4861..2d2262e8a3b7 100644 --- a/drivers/gpu/drm/openchrome/openchrome_drv.h +++ b/drivers/gpu/drm/openchrome/openchrome_drv.h @@ -61,10 +61,10 @@ #define DRIVER_MAJOR 3 #define DRIVER_MINOR 3 -#define DRIVER_PATCHLEVEL 3 +#define DRIVER_PATCHLEVEL 4 #define DRIVER_NAME "openchrome" #define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP" -#define DRIVER_DATE "20200910" +#define DRIVER_DATE "20200914" #define DRIVER_AUTHOR "OpenChrome Project" commit b285accb9249d5a323219849f6e3e81b76c53466 Author: Kevin Brace <kevinbr...@gmx.com> Date: Mon Sep 14 14:41:09 2020 -0700 drm/openchrome: Adjust FB pointer inside openchrome_crtc_mode_set_base() Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c b/drivers/gpu/drm/openchrome/openchrome_crtc.c index d234ca8d61ec..ab467aadcda1 100644 --- a/drivers/gpu/drm/openchrome/openchrome_crtc.c +++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c @@ -1680,10 +1680,9 @@ static int openchrome_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *old_fb) { - struct via_framebuffer *via_fb = container_of( - crtc->primary->fb, + struct drm_framebuffer *fb = crtc->primary->fb; + struct via_framebuffer *via_fb = container_of(fb, struct via_framebuffer, fb); - struct drm_framebuffer *new_fb = &via_fb->fb; struct openchrome_bo *bo; struct drm_gem_object *gem; int ret = 0; @@ -1692,7 +1691,7 @@ static int openchrome_crtc_mode_set_base(struct drm_crtc *crtc, DRM_DEBUG_KMS("Entered %s.\n", __func__); /* No FB found. */ - if (!new_fb) { + if (!fb) { ret = -ENOMEM; DRM_DEBUG_KMS("No FB found.\n"); goto exit; @@ -1715,7 +1714,7 @@ static int openchrome_crtc_mode_set_base(struct drm_crtc *crtc, } ret = crtc->helper_private->mode_set_base_atomic(crtc, - new_fb, x, y, + fb, x, y, ENTER_ATOMIC_MODE_SET); if (unlikely(ret)) { DRM_DEBUG_KMS("Failed to set a new FB.\n"); commit 9d5f5116f667cdf62ad9dc4245793a282d81ba2d Author: Kevin Brace <kevinbr...@gmx.com> Date: Mon Sep 14 14:37:32 2020 -0700 drm/openchrome: Stop the use of gem_free_object_unlocked() callback Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c index 278a0481292d..a415d629d915 100644 --- a/drivers/gpu/drm/openchrome/openchrome_drv.c +++ b/drivers/gpu/drm/openchrome/openchrome_drv.c @@ -47,19 +47,6 @@ static struct pci_device_id via_pci_table[] = { MODULE_DEVICE_TABLE(pci, via_pci_table); -void openchrome_drm_driver_gem_free_object_unlocked ( - struct drm_gem_object *obj) -{ - struct openchrome_bo *bo = container_of(obj, - struct openchrome_bo, gem); - - DRM_DEBUG_KMS("Entered %s.\n", __func__); - - ttm_bo_put(&bo->ttm_bo); - - DRM_DEBUG_KMS("Exiting %s.\n", __func__); -} - static int openchrome_drm_driver_dumb_create( struct drm_file *file_priv, struct drm_device *dev, @@ -250,8 +237,6 @@ static struct drm_driver via_driver = { .load = openchrome_driver_load, .unload = openchrome_driver_unload, .lastclose = openchrome_driver_lastclose, - .gem_free_object_unlocked = - openchrome_drm_driver_gem_free_object_unlocked, .dumb_create = openchrome_drm_driver_dumb_create, .dumb_map_offset = openchrome_drm_driver_dumb_map_offset, diff --git a/drivers/gpu/drm/openchrome/openchrome_object.c b/drivers/gpu/drm/openchrome/openchrome_object.c index a2b1e8c093b7..3289bf7ce3f0 100644 --- a/drivers/gpu/drm/openchrome/openchrome_object.c +++ b/drivers/gpu/drm/openchrome/openchrome_object.c @@ -90,6 +90,7 @@ void openchrome_ttm_bo_destroy(struct ttm_buffer_object *tbo) DRM_DEBUG_KMS("Entered %s.\n", __func__); drm_gem_object_release(&bo->gem); + ttm_bo_put(&bo->ttm_bo); kfree(bo); DRM_DEBUG_KMS("Exiting %s.\n", __func__); commit 21a245cfb01e0d1e92c0b894f7be9296fda0bd6c Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri Sep 11 12:21:57 2020 -0700 drm/openchrome: Migrate src/openchrome_fbdev.c code contents Migrate them to src/openchrome_fb.c. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/Makefile b/drivers/gpu/drm/openchrome/Makefile index e26022adb6fc..57cafce15d2d 100644 --- a/drivers/gpu/drm/openchrome/Makefile +++ b/drivers/gpu/drm/openchrome/Makefile @@ -12,7 +12,6 @@ openchrome-y := openchrome_analog.o \ openchrome_drv.o \ openchrome_encoder.o \ openchrome_fb.o \ - openchrome_fbdev.o \ openchrome_fp.o \ openchrome_hdmi.o \ openchrome_i2c.o \ diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h index b34c6916e7ba..83cfa0cd4861 100644 --- a/drivers/gpu/drm/openchrome/openchrome_drv.h +++ b/drivers/gpu/drm/openchrome/openchrome_drv.h @@ -396,9 +396,6 @@ void openchrome_device_fini(struct openchrome_drm_private *dev_private); int openchrome_dev_pm_ops_suspend(struct device *dev); int openchrome_dev_pm_ops_resume(struct device *dev); -void openchrome_mode_config_init( - struct openchrome_drm_private *dev_private); - void openchrome_ttm_domain_to_placement(struct openchrome_bo *bo, uint32_t ttm_domain); void openchrome_ttm_bo_destroy(struct ttm_buffer_object *tbo); @@ -432,8 +429,6 @@ extern const struct drm_plane_funcs openchrome_cursor_drm_plane_funcs; extern const uint32_t openchrome_cursor_formats[]; extern const unsigned int openchrome_cursor_formats_size; -extern struct drm_fb_helper_funcs via_drm_fb_helper_funcs; - /* display */ extern int via_modeset_init(struct drm_device *dev); extern void via_modeset_fini(struct drm_device *dev); @@ -454,6 +449,8 @@ extern u32 via_get_clk_value(struct drm_device *dev, u32 clk); extern void via_set_vclock(struct drm_crtc *crtc, u32 clk); /* framebuffers */ +void openchrome_mode_config_init( + struct openchrome_drm_private *dev_private); extern int via_fbdev_init(struct drm_device *dev); extern void via_fbdev_fini(struct drm_device *dev); diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c index 915fea15c8e7..068f39f2d132 100644 --- a/drivers/gpu/drm/openchrome/openchrome_fb.c +++ b/drivers/gpu/drm/openchrome/openchrome_fb.c @@ -21,13 +21,17 @@ * DEALINGS IN THE SOFTWARE. */ +#include <linux/fb.h> + +#include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> #include <drm/drm_fourcc.h> -#include <drm/drm_crtc_helper.h> +#include <drm/drm_gem.h> #include "openchrome_drv.h" + static int via_user_framebuffer_create_handle(struct drm_framebuffer *fb, struct drm_file *file_priv, @@ -252,6 +256,86 @@ exit: return ret; } -struct drm_fb_helper_funcs via_drm_fb_helper_funcs = { +static struct drm_fb_helper_funcs via_drm_fb_helper_funcs = { .fb_probe = via_fb_probe, }; + +int via_fbdev_init(struct drm_device *dev) +{ + struct openchrome_drm_private *dev_private = dev->dev_private; + struct via_framebuffer_device *via_fbdev; + int bpp_sel = 32; + int ret = 0; + + DRM_DEBUG_KMS("Entered %s.\n", __func__); + + via_fbdev = kzalloc(sizeof(struct via_framebuffer_device), + GFP_KERNEL); + if (!via_fbdev) { + ret = -ENOMEM; + goto exit; + } + + dev_private->via_fbdev = via_fbdev; + + drm_fb_helper_prepare(dev, &via_fbdev->helper, + &via_drm_fb_helper_funcs); + + ret = drm_fb_helper_init(dev, &via_fbdev->helper); + if (ret) { + goto free_fbdev; + } + + drm_helper_disable_unused_functions(dev); + ret = drm_fb_helper_initial_config(&via_fbdev->helper, bpp_sel); + if (ret) { + goto free_fb_helper; + } + + goto exit; +free_fb_helper: + drm_fb_helper_fini(&via_fbdev->helper); +free_fbdev: + kfree(via_fbdev); +exit: + DRM_DEBUG_KMS("Exiting %s.\n", __func__); + return ret; +} + +void via_fbdev_fini(struct drm_device *dev) +{ + struct openchrome_drm_private *dev_private = dev->dev_private; + struct drm_fb_helper *fb_helper = &dev_private-> + via_fbdev->helper; + struct via_framebuffer *via_fb = &dev_private-> + via_fbdev->via_fb; + struct fb_info *info; + + DRM_DEBUG_KMS("Entered %s.\n", __func__); + + if (!fb_helper) { + goto exit; + } + + info = fb_helper->fbdev; + if (info) { + unregister_framebuffer(info); + kfree(info->apertures); + framebuffer_release(info); + fb_helper->fbdev = NULL; + } + + if (via_fb->gem) { + drm_gem_object_put(via_fb->gem); + via_fb->gem = NULL; + } + + drm_fb_helper_fini(&dev_private->via_fbdev->helper); + drm_framebuffer_cleanup(&dev_private->via_fbdev->via_fb.fb); + if (dev_private->via_fbdev) { + kfree(dev_private->via_fbdev); + dev_private->via_fbdev = NULL; + } +exit: + DRM_DEBUG_KMS("Exiting %s.\n", __func__); +} diff --git a/drivers/gpu/drm/openchrome/openchrome_fbdev.c b/drivers/gpu/drm/openchrome/openchrome_fbdev.c deleted file mode 100644 index 464eb8407e5c..000000000000 --- a/drivers/gpu/drm/openchrome/openchrome_fbdev.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2012 James Simmons <jsimm...@infradead.org>. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sub license, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <linux/fb.h> - -#include <drm/drm_crtc_helper.h> -#include <drm/drm_drv.h> -#include <drm/drm_fb_helper.h> -#include <drm/drm_gem.h> - -#include "openchrome_drv.h" - - -int via_fbdev_init(struct drm_device *dev) -{ - struct openchrome_drm_private *dev_private = dev->dev_private; - struct via_framebuffer_device *via_fbdev; - int bpp_sel = 32; - int ret = 0; - - DRM_DEBUG_KMS("Entered %s.\n", __func__); - - via_fbdev = kzalloc(sizeof(struct via_framebuffer_device), - GFP_KERNEL); - if (!via_fbdev) { - ret = -ENOMEM; - goto exit; - } - - dev_private->via_fbdev = via_fbdev; - - drm_fb_helper_prepare(dev, &via_fbdev->helper, - &via_drm_fb_helper_funcs); - - ret = drm_fb_helper_init(dev, &via_fbdev->helper); - if (ret) { - goto free_fbdev; - } - - drm_helper_disable_unused_functions(dev); - ret = drm_fb_helper_initial_config(&via_fbdev->helper, bpp_sel); - if (ret) { - goto free_fb_helper; - } - - goto exit; -free_fb_helper: - drm_fb_helper_fini(&via_fbdev->helper); -free_fbdev: - kfree(via_fbdev); -exit: - DRM_DEBUG_KMS("Exiting %s.\n", __func__); - return ret; -} - -void via_fbdev_fini(struct drm_device *dev) -{ - struct openchrome_drm_private *dev_private = dev->dev_private; - struct drm_fb_helper *fb_helper = &dev_private-> - via_fbdev->helper; - struct via_framebuffer *via_fb = &dev_private-> - via_fbdev->via_fb; - struct fb_info *info; - - DRM_DEBUG_KMS("Entered %s.\n", __func__); - - if (!fb_helper) { - goto exit; - } - - info = fb_helper->fbdev; - if (info) { - unregister_framebuffer(info); - kfree(info->apertures); - framebuffer_release(info); - fb_helper->fbdev = NULL; - } - - if (via_fb->gem) { - drm_gem_object_put(via_fb->gem); - via_fb->gem = NULL; - } - - drm_fb_helper_fini(&dev_private->via_fbdev->helper); - drm_framebuffer_cleanup(&dev_private->via_fbdev->via_fb.fb); - if (dev_private->via_fbdev) { - kfree(dev_private->via_fbdev); - dev_private->via_fbdev = NULL; - } -exit: - DRM_DEBUG_KMS("Exiting %s.\n", __func__); -} commit 77ea1d5f8cc9424a4c7dcf2d434bc9e3e15a8417 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri Sep 11 11:56:19 2020 -0700 drm/openchrome: Use drm_fb_helper_output_poll_changed() helper Rather than doing our own for output_poll_changed() callback of drm_mode_config_funcs struct. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c index 5a8ef6d83837..915fea15c8e7 100644 --- a/drivers/gpu/drm/openchrome/openchrome_fb.c +++ b/drivers/gpu/drm/openchrome/openchrome_fb.c @@ -69,14 +69,6 @@ static const struct drm_framebuffer_funcs via_fb_funcs = { .destroy = via_user_framebuffer_destroy, }; -static void -via_output_poll_changed(struct drm_device *dev) -{ - struct openchrome_drm_private *dev_private = dev->dev_private; - - drm_fb_helper_hotplug_event(&dev_private->via_fbdev->helper); -} - static struct drm_framebuffer * via_user_framebuffer_create(struct drm_device *dev, struct drm_file *file_priv, @@ -114,7 +106,7 @@ via_user_framebuffer_create(struct drm_device *dev, static const struct drm_mode_config_funcs via_mode_funcs = { .fb_create = via_user_framebuffer_create, - .output_poll_changed = via_output_poll_changed + .output_poll_changed = drm_fb_helper_output_poll_changed }; void openchrome_mode_config_init( _______________________________________________ openchrome-devel mailing list openchrome-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/openchrome-devel