ast fix patches
Subsystems (3)
cover ast fix patches
Hi,
here is another clearance sale, a patchset containing fixes for ast driver, dug from openSUSE / SUSE kernels. All fixes came from Egbert.
thanks,
Takashi
===
Egbert Eich (5):
drm/ast: Simplify function ast_bo_unpin()
drm/ast: Free container instead of member in
ast_user_framebuffer_destroy()
drm/ast: Fix memleak in error path in ast_bo_create() drm/ast: Add an crtc_disable callback to the crtc helper funcs drm/ast: Actually load DP501 firmware when required
drivers/gpu/drm/ast/ast_dp501.c | 25 ++++++++++++++++--------- drivers/gpu/drm/ast/ast_drv.h | 3 +-- drivers/gpu/drm/ast/ast_main.c | 3 ++- drivers/gpu/drm/ast/ast_mode.c | 16 ++++++++++++++++ drivers/gpu/drm/ast/ast_ttm.c | 19 ++++++++----------- 5 files changed, 43 insertions(+), 23 deletions(-)
Signature · 6 lines
2.13.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 drm/ast: Simplify function ast_bo_unpin()
From: Egbert Eich <[email protected]>
Just a code refactoring, no functional change.
--- drivers/gpu/drm/ast/ast_ttm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/ast/ast_ttm.c +2 -6
@@ -376,7 +376,7 @@ int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr)int ast_bo_unpin (struct ast_bo *bo) { -int i, ret; +int i;if (!bo->pin_count) {DRM_ERROR ("unpin bad %p\n" , bo);return 0 ;
@@ -387,11 +387,7 @@ int ast_bo_unpin(struct ast_bo *bo)for (i =0 ; i < bo->placement.num_placement ; i++) bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT ; - ret =ttm_bo_validate (&bo->bo, &bo->placement, false, false); -if (ret) -return ret; - -return 0 ; +return ttm_bo_validate (&bo->bo, &bo->placement, false, false); }int ast_bo_push_sysram (struct ast_bo *bo)
Signature · 6 lines
2.13.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm/ast: Free container instead of member in ast_user_framebuffer_destroy()
In reply to Takashi IwaiFrom: Egbert Eich <[email protected]>
Technically freeing ast_fb->base is the same as freeing ast_fb as 'base' the first member of the data structure.
Still this makes it cleaner.
--- drivers/gpu/drm/ast/ast_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_main.c +1 -1
@@ -389,7 +389,7 @@ static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb)drm_gem_object_unreference_unlocked (ast_fb->obj);drm_framebuffer_cleanup (fb); -kfree (fb); +kfree (ast_fb); }static const struct drm_framebuffer_funcs ast_fb_funcs = {
Signature · 6 lines
2.13.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 drm/ast: Fix memleak in error path in ast_bo_create()
In reply to Takashi IwaiFrom: Egbert Eich <[email protected]>
The allocated struct ast_bo was not freed in all error paths. This patch consolidates error handling and fixes this.
--- drivers/gpu/drm/ast/ast_ttm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/ast/ast_ttm.c +6 -5
@@ -323,10 +323,8 @@ int ast_bo_create(struct drm_device *dev, int size, int align,return -ENOMEM ; ret =drm_gem_object_init (dev, &astbo->gem, size); -if (ret) { -kfree (astbo); -return ret; - } +if (ret) + goto error; astbo->bo.bdev = &ast->ttm.bdev;
@@ -340,10 +338,13 @@ int ast_bo_create(struct drm_device *dev, int size, int align, align >>PAGE_SHIFT , false,NULL , acc_size, NULL, NULL, ast_bo_ttm_destroy);if (ret) -return ret; + goto error; *pastbo = astbo;return 0 ; +error: +kfree (astbo); +return ret; }static inline u64 ast_bo_gpu_offset (struct ast_bo *bo)
Signature · 6 lines
2.13.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/ast: Add an crtc_disable callback to the crtc helper funcs
In reply to Takashi IwaiFrom: Egbert Eich <[email protected]>
Implement the proper CRTC disablement, just like done in mgag200 driver.
--- drivers/gpu/drm/ast/ast_mode.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +16 -0
@@ -613,7 +613,23 @@ static int ast_crtc_mode_set(struct drm_crtc *crtc,static void ast_crtc_disable (struct drm_crtc *crtc) { +int ret; + +DRM_DEBUG_KMS ("\n" ); +ast_crtc_dpms (crtc,DRM_MODE_DPMS_OFF ); +if (crtc->primary->fb) { +struct ast_framebuffer *ast_fb =to_ast_framebuffer (crtc->primary->fb); +struct drm_gem_object *obj = ast_fb->obj; +struct ast_bo *bo =gem_to_ast_bo (obj); + + ret =ast_bo_reserve (bo, false); +if (ret) +return ; +ast_bo_push_sysram (bo); +ast_bo_unreserve (bo); + } + crtc->primary->fb =NULL ; }static void ast_crtc_prepare (struct drm_crtc *crtc)
Signature · 6 lines
2.13.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/ast: Actually load DP501 firmware when required
In reply to Takashi IwaiFrom: Egbert Eich <[email protected]>
The ast driver has a code to load the DP501 firmware, but it's never used. This patch implements its actual usage by requesting the firmware on demand, and release the firmware at exit as well.
Also the path contains a few cleanups and makes relevant functions static.
--- drivers/gpu/drm/ast/ast_dp501.c | 25 ++++++++++++++++--------- drivers/gpu/drm/ast/ast_drv.h | 3 +-- drivers/gpu/drm/ast/ast_main.c | 1 + 3 files changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/ast/ast_dp501.c +16 -9
@@ -4,16 +4,11 @@#include "ast_drv.h" MODULE_FIRMWARE ("ast_dp501_fw.bin" ); -int ast_load_dp501_microcode (struct drm_device *dev) +static int ast_load_dp501_microcode (struct drm_device *dev) {struct ast_private *ast = dev->dev_private; -static char *fw_name ="ast_dp501_fw.bin" ; -int err; - err =request_firmware (&ast->dp501_fw, fw_name, dev->dev); -if (err) -return err; -return 0 ; +return request_firmware (&ast->dp501_fw,"ast_dp501_fw.bin" , dev->dev); }static void send_ack (struct ast_private *ast)
@@ -187,7 +182,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)return false; } -bool ast_launch_m68k (struct drm_device *dev) +static bool ast_launch_m68k (struct drm_device *dev) {struct ast_private *ast = dev->dev_private;u32 i, data, len =0 ;
@@ -201,7 +196,11 @@ bool ast_launch_m68k(struct drm_device *dev)if (ast->dp501_fw_addr) { fw_addr = ast->dp501_fw_addr; len =32 *1024 ; - }else if (ast->dp501_fw) { + }else { +if (!ast->dp501_fw && +ast_load_dp501_microcode (dev) <0 ) +return false; + fw_addr = (u8 *)ast->dp501_fw->data; len = ast->dp501_fw->size; }
@@ -432,3 +431,11 @@ void ast_init_3rdtx(struct drm_device *dev) } } } + +void ast_release_firmware (struct drm_device *dev) +{ +struct ast_private *ast = dev->dev_private; + +release_firmware (ast->dp501_fw); + ast->dp501_fw =NULL ; +}
drivers/gpu/drm/ast/ast_drv.h +1 -2
@@ -401,11 +401,10 @@ void ast_post_gpu(struct drm_device *dev);u32 ast_mindwm (struct ast_private *ast,u32 r);void ast_moutdwm (struct ast_private *ast,u32 r,u32 v);/* ast dp501 */ -int ast_load_dp501_microcode (struct drm_device *dev);void ast_set_dp501_video_output (struct drm_device *dev,u8 mode); -bool ast_launch_m68k (struct drm_device *dev);bool ast_backup_fw (struct drm_device *dev,u8 *addr,u32 size);bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata);u8 ast_get_dp501_max_clk (struct drm_device *dev);void ast_init_3rdtx (struct drm_device *dev); +void ast_release_firmware (struct drm_device *dev);#endif
drivers/gpu/drm/ast/ast_main.c +1 -0
@@ -576,6 +576,7 @@ void ast_driver_unload(struct drm_device *dev) {struct ast_private *ast = dev->dev_private; +ast_release_firmware (dev);kfree (ast->dp501_fw_addr);ast_mode_fini (dev);ast_fbdev_fini (dev);
Signature · 6 lines
2.13.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie
maintainerQuoted 5 lines · Takashi Iwai
Hi,
here is another clearance sale, a patchset containing fixes for ast driver, dug from openSUSE / SUSE kernels. All fixes came from Egbert.
I've merged this set as is.
Thanks,
Dave.
Quoted 23 lines
thanks,
Takashi
===
Egbert Eich (5):
drm/ast: Simplify functionast_bo_unpin()
drm/ast: Free container instead of member in
ast_user_framebuffer_destroy()
drm/ast: Fix memleak in error path inast_bo_create()drm/ast: Add ancrtc_disablecallback to the crtc helper funcs drm/ast: Actually load DP501 firmware when requireddrivers/gpu/drm/ast/ast_dp501.c | 25 ++++++++++++++++--------- drivers/gpu/drm/ast/ast_drv.h | 3 +-- drivers/gpu/drm/ast/ast_main.c | 3 ++- drivers/gpu/drm/ast/ast_mode.c | 16 ++++++++++++++++ drivers/gpu/drm/ast/ast_ttm.c | 19 ++++++++----------- 5 files changed, 43 insertions(+), 23 deletions(-)
Quoted 7 lines
--
2.13.2_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel