All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops
@ 2017-01-23 14:54 Wolfgang Bumiller
  2017-01-23 15:06 ` no-reply
  2017-01-24 14:52 ` Wolfgang Bumiller
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfgang Bumiller @ 2017-01-23 14:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The rops used by cirrus_bitblt_common_patterncopy only use
the destination pitch, so the source pitch shoul allowed to
be zero.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
Resent as requested as non-inline reply; was originally a reply to
thread: [PATCH] display: cirrus: check vga bits per pixel(bpp) value
 hw/display/cirrus_vga.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 379910d..c2fce8c 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -272,9 +272,6 @@ static void cirrus_update_memory_access(CirrusVGAState *s);
 static bool blit_region_is_unsafe(struct CirrusVGAState *s,
                                   int32_t pitch, int32_t addr)
 {
-    if (!pitch) {
-        return true;
-    }
     if (pitch < 0) {
         int64_t min = addr
             + ((int64_t)s->cirrus_blt_height-1) * pitch;
@@ -294,7 +291,7 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
     return false;
 }
 
-static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only, bool zero_src_pitch_ok)
 {
     /* should be the case, see cirrus_bitblt_start */
     assert(s->cirrus_blt_width > 0);
@@ -304,6 +301,10 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
         return true;
     }
 
+    if (!s->cirrus_blt_dstpitch) {
+        return true;
+    }
+
     if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
                               s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
         return true;
@@ -311,6 +312,11 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
     if (dst_only) {
         return false;
     }
+
+    if (!zero_src_pitch_ok && !s->cirrus_blt_srcpitch) {
+        return true;
+    }
+
     if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
                               s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
         return true;
@@ -676,8 +682,9 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
 
     dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
 
-    if (blit_is_unsafe(s, false))
+    if (blit_is_unsafe(s, false, true)) {
         return 0;
+    }
 
     (*s->cirrus_rop) (s, dst, src,
                       s->cirrus_blt_dstpitch, 0,
@@ -694,7 +701,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
 {
     cirrus_fill_t rop_func;
 
-    if (blit_is_unsafe(s, true)) {
+    if (blit_is_unsafe(s, true, true)) {
         return 0;
     }
     rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
@@ -798,7 +805,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
 
 static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
 {
-    if (blit_is_unsafe(s, false))
+    if (blit_is_unsafe(s, false, false))
         return 0;
 
     return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops
  2017-01-23 14:54 [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops Wolfgang Bumiller
@ 2017-01-23 15:06 ` no-reply
  2017-01-24 14:52 ` Wolfgang Bumiller
  1 sibling, 0 replies; 3+ messages in thread
From: no-reply @ 2017-01-23 15:06 UTC (permalink / raw)
  To: w.bumiller; +Cc: famz, qemu-devel, kraxel

Hi,

Your series seems to have some coding style problems. See output below for
more information:

Type: series
Subject: [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops
Message-id: 1485183295-10242-1-git-send-email-w.bumiller@proxmox.com

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
0391025 cirrus: allow zero source pitch in pattern fill rops

=== OUTPUT BEGIN ===
Checking PATCH 1/1: cirrus: allow zero source pitch in pattern fill rops...
ERROR: line over 90 characters
#32: FILE: hw/display/cirrus_vga.c:294:
+static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only, bool zero_src_pitch_ok)

total: 1 errors, 0 warnings, 64 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops
  2017-01-23 14:54 [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops Wolfgang Bumiller
  2017-01-23 15:06 ` no-reply
@ 2017-01-24 14:52 ` Wolfgang Bumiller
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Bumiller @ 2017-01-24 14:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Actually this is wrong, sorry, I'll need to send a v2.

On Mon, Jan 23, 2017 at 03:54:55PM +0100, Wolfgang Bumiller wrote:
> The rops used by cirrus_bitblt_common_patterncopy only use
> the destination pitch, so the source pitch shoul allowed to
> be zero.
> 
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> Resent as requested as non-inline reply; was originally a reply to
> thread: [PATCH] display: cirrus: check vga bits per pixel(bpp) value
>  hw/display/cirrus_vga.c | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
> index 379910d..c2fce8c 100644
> --- a/hw/display/cirrus_vga.c
> +++ b/hw/display/cirrus_vga.c
> @@ -272,9 +272,6 @@ static void cirrus_update_memory_access(CirrusVGAState *s);
>  static bool blit_region_is_unsafe(struct CirrusVGAState *s,
>                                    int32_t pitch, int32_t addr)
>  {
> -    if (!pitch) {
> -        return true;
> -    }
>      if (pitch < 0) {
>          int64_t min = addr
>              + ((int64_t)s->cirrus_blt_height-1) * pitch;
> @@ -294,7 +291,7 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
>      return false;
>  }
>  
> -static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
> +static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only, bool zero_src_pitch_ok)
>  {
>      /* should be the case, see cirrus_bitblt_start */
>      assert(s->cirrus_blt_width > 0);
> @@ -304,6 +301,10 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
>          return true;
>      }
>  
> +    if (!s->cirrus_blt_dstpitch) {
> +        return true;
> +    }
> +
>      if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
>                                s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
>          return true;
> @@ -311,6 +312,11 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
>      if (dst_only) {
>          return false;
>      }
> +
> +    if (!zero_src_pitch_ok && !s->cirrus_blt_srcpitch) {
> +        return true;
> +    }
> +
>      if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
>                                s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
>          return true;
> @@ -676,8 +682,9 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
>  
>      dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
>  
> -    if (blit_is_unsafe(s, false))
> +    if (blit_is_unsafe(s, false, true)) {
>          return 0;
> +    }
>  
>      (*s->cirrus_rop) (s, dst, src,
>                        s->cirrus_blt_dstpitch, 0,
> @@ -694,7 +701,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
>  {
>      cirrus_fill_t rop_func;
>  
> -    if (blit_is_unsafe(s, true)) {
> +    if (blit_is_unsafe(s, true, true)) {
>          return 0;
>      }
>      rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
> @@ -798,7 +805,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
>  
>  static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s)
>  {
> -    if (blit_is_unsafe(s, false))
> +    if (blit_is_unsafe(s, false, false))
>          return 0;
>  
>      return cirrus_do_copy(s, s->cirrus_blt_dstaddr - s->vga.start_addr,
> -- 
> 2.1.4
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 14:54 [Qemu-devel] [PATCH] cirrus: allow zero source pitch in pattern fill rops Wolfgang Bumiller
2017-01-23 15:06 ` no-reply
2017-01-24 14:52 ` Wolfgang Bumiller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.