drm/vmwgfx: Fix src/dst_pitch confusion
Subsystems (3)
PATCH 1/1 drm/vmwgfx: Fix src/dst_pitch confusion
From: Zack Rusin <[email protected]>
The src/dst_pitch got mixed up during the rework of the function, make sure the offset's refer to the correct one.
Spotted by clang:
Clang warns (or errors with CONFIG_WERROR):
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:509:29: error: variable 'dst_pitch' is uninitialized when used here [-Werror,-Wuninitialized]
src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp;
^~~~~~~~~
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:492:26: note: initialize the variable 'dst_pitch' to silence this warning
s32 src_pitch, dst_pitch;
^
= 01 error generated.
--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +2 -2
@@ -506,11 +506,11 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty)/* Assume we are blitting from Guest (bo) to Host (display_srf) */ src_pitch = stdu->display_srf->metadata.base_size.width * stdu->cpp; src_bo = &stdu->display_srf->res.guest_memory_bo->tbo; - src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; + src_offset = ddirty->top * src_pitch + ddirty->left * stdu->cpp; dst_pitch = ddirty->pitch; dst_bo = &ddirty->buf->tbo; - dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; + dst_offset = ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, src_bo, src_offset, src_pitch,
Signature · 1 line
2.38.1
Quoted 15 lines · Zack Rusin
From: Zack Rusin <[email protected]>
The src/dst_pitch got mixed up during the rework of the function, make sure the offset's refer to the correct one.
Spotted by clang:
Clang warns (or errors withCONFIG_WERROR):
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:509:29: error: variable 'dst_pitch' is uninitialized when used here [-Werror,-Wuninitialized]src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; ^~~~~~~~~ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:492:26: note: initialize the variable 'dst_pitch' to silence this warning s32 src_pitch, dst_pitch; ^ = 0
Quoted 7 lines
1 error generated.
Signed-off-by Zack Rusin <[email protected]>Reported-by Nathan Chancellor <[email protected]>Reported-by Dave Airlie <[email protected]>Fixes 39985eea5a6d ("drm/vmwgfx: Abstract placement selection")
Thanks for the quick response and patch!
Quoted 25 lines
--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +2
-2@@ -506,11 +506,11 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty)/* Assume we are blitting from Guest (bo) to Host (display_srf) */ src_pitch = stdu->display_srf->metadata.base_size.width * stdu->cpp; src_bo = &stdu->display_srf->res.guest_memory_bo->tbo; - src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; + src_offset = ddirty->top * src_pitch + ddirty->left * stdu->cpp; dst_pitch = ddirty->pitch; dst_bo = &ddirty->buf->tbo; - dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; + dst_offset = ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, src_bo, src_offset, src_pitch,Signature · 1 line
2.38.1
From: Martin Krastev <[email protected]>
We reviewers botched that one.
Regards,
Martin
Quoted 44 lines · Zack Rusin
From: Zack Rusin <[email protected]>
The src/dst_pitch got mixed up during the rework of the function, make sure the offset's refer to the correct one.
Spotted by clang:
Clang warns (or errors withCONFIG_WERROR):drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:509:29: error: variable 'dst_pitch' is uninitialized when used here [-Werror,-Wuninitialized] src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; ^~~~~~~~~ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:492:26: note: initialize the variable 'dst_pitch' to silence this warning s32 src_pitch, dst_pitch; ^ = 0 1 error generated.Signed-off-by Zack Rusin <[email protected]>Reported-by Nathan Chancellor <[email protected]>Reported-by Dave Airlie <[email protected]>Fixes 39985eea5a6d ("drm/vmwgfx: Abstract placement selection")--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +2
-2@@ -506,11 +506,11 @@ static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty)/* Assume we are blitting from Guest (bo) to Host (display_srf) */ src_pitch = stdu->display_srf->metadata.base_size.width * stdu->cpp; src_bo = &stdu->display_srf->res.guest_memory_bo->tbo; - src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp; + src_offset = ddirty->top * src_pitch + ddirty->left * stdu->cpp; dst_pitch = ddirty->pitch; dst_bo = &ddirty->buf->tbo; - dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * stdu->cpp; + dst_offset = ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch, src_bo, src_offset, src_pitch,
Dave Airlie
maintainerQuoted 6 lines · Martin Krastev (VMware)
From: Martin Krastev <[email protected]>
We reviewers botched that one.
Reviewed-by Martin Krastev <[email protected]>
Can someone land this into drm-misc-next please so I can start building with clang again?
Dave.
Quoted 5 lines · Dave Airlie
!! External Email
Quoted 1 line · Martin Krastev (VMware)
Quoted 8 lines
Quoted 5 lines
From: Martin Krastev <[email protected]>
We reviewers botched that one.
Reviewed-by Martin Krastev <[email protected]>Can someone land this into drm-misc-next please so I can start building with clang again?
It landed there 5 days ago:
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=328839ff93709a517e89ba1de1132c5d138e5dcb
z
Dave Airlie
maintainerQuoted 11 lines · Zack Rusin
Quoted 9 lines · Dave Airlie
!! External Email
Quoted 5 lines · Martin Krastev (VMware)
From: Martin Krastev <[email protected]>
We reviewers botched that one.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Reviewed-by Martin Krastev <[email protected]>Can someone land this into drm-misc-next please so I can start building with clang again?
It landed there 5 days ago:
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=328839ff93709a517e89ba1de1132c5d138e5dcb
Oops, I just pulled a tree without it so made bad assumption, sorry for noise!
Dave.