drivers/gpu/drm/openchrome/ttm_gem.c | 12 ++--- drivers/gpu/drm/openchrome/via_crtc.c | 72 +++++++++++++++++----------------- drivers/gpu/drm/openchrome/via_fb.c | 2 drivers/gpu/drm/openchrome/via_fp.c | 3 - 4 files changed, 42 insertions(+), 47 deletions(-)
New commits: commit 27184de6aa6127544193ad1577cf772ce82f6c4c Author: Kevin Brace <kevinbr...@gmx.com> Date: Thu Aug 31 14:10:51 2017 -0700 Error handling improvements to *mode_set_base callbacks Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/via_crtc.c b/drivers/gpu/drm/openchrome/via_crtc.c index 96eb17da3b2f..f167df911f9e 100644 --- a/drivers/gpu/drm/openchrome/via_crtc.c +++ b/drivers/gpu/drm/openchrome/via_crtc.c @@ -1226,9 +1226,9 @@ exit: return ret; } -static int -via_iga1_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, - struct drm_framebuffer *old_fb) +static int via_iga1_crtc_mode_set_base(struct drm_crtc *crtc, + int x, int y, + struct drm_framebuffer *old_fb) { struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; struct ttm_buffer_object *bo; @@ -1238,33 +1238,30 @@ via_iga1_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, struct drm_gem_object *gem_obj = via_fb->gem_obj; int ret = 0; - DRM_DEBUG("Entered via_iga1_crtc_mode_set_base.\n"); + DRM_DEBUG_KMS("Entered %s.\n", __func__); - /* no fb bound */ + /* No FB found. */ if (!new_fb) { - DRM_DEBUG_KMS("No FB bound\n"); - return ret; + ret = -ENOMEM; + DRM_DEBUG_KMS("No FB found.\n"); + goto exit; } - /* No reason to reset the display surface again */ - if (new_fb == old_fb) - return ret; - gem_obj = via_fb->gem_obj; bo = ttm_gem_mapping(gem_obj); ret = via_bo_pin(bo, NULL); if (unlikely(ret)) { - DRM_DEBUG("failed to pin FB\n"); - return ret; + DRM_DEBUG_KMS("Failed to pin FB.\n"); + goto exit; } ret = crtc_funcs->mode_set_base_atomic(crtc, new_fb, x, y, ENTER_ATOMIC_MODE_SET); if (unlikely(ret)) { - DRM_DEBUG("failed to set new framebuffer\n"); + DRM_DEBUG_KMS("Failed to set a new FB.\n"); via_bo_unpin(bo, NULL); - return ret; + goto exit; } /* Free the old framebuffer if it exist */ @@ -1275,11 +1272,14 @@ via_iga1_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, bo = ttm_gem_mapping(gem_obj); ret = via_bo_unpin(bo, NULL); - if (unlikely(ret)) - DRM_ERROR("framebuffer still locked\n"); + if (unlikely(ret)) { + DRM_DEBUG_KMS("FB still locked.\n"); + goto exit; + } } - DRM_DEBUG("Exiting via_iga1_crtc_mode_set_base.\n"); +exit: + DRM_DEBUG_KMS("Exiting %s.\n", __func__); return ret; } @@ -1545,9 +1545,9 @@ exit: return ret; } -static int -via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, - struct drm_framebuffer *old_fb) +static int via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, + int x, int y, + struct drm_framebuffer *old_fb) { struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; struct ttm_buffer_object *bo; @@ -1557,33 +1557,30 @@ via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, struct drm_gem_object *gem_obj = via_fb->gem_obj; int ret = 0; - DRM_DEBUG("Entered via_iga2_crtc_mode_set_base.\n"); + DRM_DEBUG_KMS("Entered %s.\n", __func__); - /* no fb bound */ + /* No FB found. */ if (!new_fb) { - DRM_DEBUG_KMS("No FB bound\n"); - return ret; + ret = -ENOMEM; + DRM_DEBUG_KMS("No FB found.\n"); + goto exit; } - /* No reason to reset the display surface again */ - if (new_fb == old_fb) - return ret; - gem_obj = via_fb->gem_obj; bo = ttm_gem_mapping(gem_obj); ret = via_bo_pin(bo, NULL); if (unlikely(ret)) { - DRM_DEBUG("failed to pin FB\n"); - return ret; + DRM_DEBUG_KMS("Failed to pin FB.\n"); + goto exit; } ret = crtc_funcs->mode_set_base_atomic(crtc, new_fb, x, y, ENTER_ATOMIC_MODE_SET); if (unlikely(ret)) { - DRM_DEBUG("failed to set new framebuffer\n"); + DRM_DEBUG_KMS("Failed to set a new FB.\n"); via_bo_unpin(bo, NULL); - return ret; + goto exit; } /* Free the old framebuffer if it exist */ @@ -1594,11 +1591,14 @@ via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, bo = ttm_gem_mapping(gem_obj); ret = via_bo_unpin(bo, NULL); - if (unlikely(ret)) - DRM_ERROR("framebuffer still locked\n"); + if (unlikely(ret)) { + DRM_DEBUG_KMS("FB still locked.\n"); + goto exit; + } } - DRM_DEBUG("Exiting via_iga2_crtc_mode_set_base.\n"); +exit: + DRM_DEBUG_KMS("Exiting %s.\n", __func__); return ret; } commit 75ae4ecffaddac0f783a1add46370ef601c5996f Author: Kevin Brace <kevinbr...@gmx.com> Date: Thu Aug 31 13:13:34 2017 -0700 Remove unused variables from via_lcd_set_property() Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/via_fp.c b/drivers/gpu/drm/openchrome/via_fp.c index 1b009fbb607f..79686a085634 100644 --- a/drivers/gpu/drm/openchrome/via_fp.c +++ b/drivers/gpu/drm/openchrome/via_fp.c @@ -801,10 +801,7 @@ static int via_lcd_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t value) { - struct via_connector *con = container_of(connector, struct via_connector, base); - struct via_device *dev_priv = connector->dev->dev_private; struct drm_device *dev = connector->dev; - struct drm_property *prop; uint64_t orig; int ret; commit 9b8d7ffe48c9c748ff773f4994c1056c88b4cfa8 Author: Kevin Brace <kevinbr...@gmx.com> Date: Wed Aug 30 20:37:12 2017 -0700 Alter kzalloc input parameter inside via_user_framebuffer_create Might be meaningless, but I prefer it this way. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/via_fb.c b/drivers/gpu/drm/openchrome/via_fb.c index 3b3cec909853..81dff36cde21 100644 --- a/drivers/gpu/drm/openchrome/via_fb.c +++ b/drivers/gpu/drm/openchrome/via_fb.c @@ -967,7 +967,7 @@ via_user_framebuffer_create(struct drm_device *dev, return ERR_PTR(-ENOENT); } - via_fb = kzalloc(sizeof(*via_fb), GFP_KERNEL); + via_fb = kzalloc(sizeof(struct via_framebuffer), GFP_KERNEL); if (!via_fb) { return ERR_PTR(-ENOMEM); } commit 9962fbf646d67e1ec9bed5099f451cbfe13ca671 Author: Kevin Brace <kevinbr...@gmx.com> Date: Wed Aug 30 20:32:13 2017 -0700 Alter kzalloc input parameter inside ttm_gem_create Might be meaningless, but I prefer it this way. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/ttm_gem.c b/drivers/gpu/drm/openchrome/ttm_gem.c index c0320f160b7d..d4179dd16f57 100644 --- a/drivers/gpu/drm/openchrome/ttm_gem.c +++ b/drivers/gpu/drm/openchrome/ttm_gem.c @@ -92,7 +92,7 @@ ttm_gem_create(struct drm_device *dev, struct ttm_gem_object *obj; int ret; - obj = kzalloc(sizeof(*obj), GFP_KERNEL); + obj = kzalloc(sizeof(struct ttm_gem_object), GFP_KERNEL); if (!obj) { return ERR_PTR(-ENOMEM); } commit 5fa7a21c781bc7b678276d51173031f3934cc062 Author: Kevin Brace <kevinbr...@gmx.com> Date: Wed Aug 30 20:30:22 2017 -0700 Allocate GEMified TTM object before TTM heap allocation Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/drivers/gpu/drm/openchrome/ttm_gem.c b/drivers/gpu/drm/openchrome/ttm_gem.c index 971fadc1435e..c0320f160b7d 100644 --- a/drivers/gpu/drm/openchrome/ttm_gem.c +++ b/drivers/gpu/drm/openchrome/ttm_gem.c @@ -92,9 +92,13 @@ ttm_gem_create(struct drm_device *dev, struct ttm_gem_object *obj; int ret; + obj = kzalloc(sizeof(*obj), GFP_KERNEL); + if (!obj) { + return ERR_PTR(-ENOMEM); + } + size = round_up(size, byte_alignment); size = ALIGN(size, page_alignment); - ret = via_bo_create(bdev, &bo, size, type, domains, byte_alignment, page_alignment, interruptible, NULL, NULL); @@ -103,12 +107,6 @@ ttm_gem_create(struct drm_device *dev, return ERR_PTR(ret); } - obj = kzalloc(sizeof(*obj), GFP_KERNEL); - if (!obj) { - ttm_bo_unref(&bo); - return ERR_PTR(-ENOMEM); - } - ret = drm_gem_object_init(dev, &obj->gem, size); if (unlikely(ret)) { ttm_bo_unref(&bo); _______________________________________________ Openchrome-devel mailing list Openchrome-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/openchrome-devel