diff mbox series

[3/4] sm501: Ignore no-op blits

Message ID b62681e58108651b2ca0d2fdbde8281e87185dbb.1591471056.git.balaton@eik.bme.hu
State New
Headers show
Series More sm501 fixes and optimisations | expand

Commit Message

BALATON Zoltan June 6, 2020, 7:17 p.m. UTC
Some guests seem to try source copy blits with same source and dest
which are no-op so avoid calling pixman for these.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/display/sm501.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Peter Maydell June 15, 2020, 2:56 p.m. UTC | #1
On Sat, 6 Jun 2020 at 20:22, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>
> Some guests seem to try source copy blits with same source and dest
> which are no-op so avoid calling pixman for these.

Are they doing actual source copy blits, or one of the other
currently-unimplemented op types which we currently fall
back to doing as source-copy ?

> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
BALATON Zoltan June 15, 2020, 3:14 p.m. UTC | #2
On Mon, 15 Jun 2020, Peter Maydell wrote:
> On Sat, 6 Jun 2020 at 20:22, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>>
>> Some guests seem to try source copy blits with same source and dest
>> which are no-op so avoid calling pixman for these.
>
> Are they doing actual source copy blits, or one of the other
> currently-unimplemented op types which we currently fall
> back to doing as source-copy ?

I thought the same but in the cases I've seen the rop was 0xcc which is 
copy source so it looks like an actual source copy blit (this seems to be 
an issue in the guest driver, I've notified appropriate people but not 
sure it's still maintained). Even if it was fallback we wouldn't need to 
do the copy in this case as it changes nothing so we can optimise this 
out. When we implement the missing op that would come before this case so 
this is only for source copy case.

>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thank you,
BALATON Zoltan
diff mbox series

Patch

diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 85d54b598f..3397ca9fbf 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -788,6 +788,11 @@  static void sm501_2d_operation(SM501State *s)
                               (rop2_source_is_pattern ?
                                   " with pattern source" : ""));
             }
+            /* Ignore no-op blits, some guests seem to do this */
+            if (src_base == dst_base && src_pitch == dst_pitch &&
+                src_x == dst_x && src_y == dst_y) {
+                break;
+            }
             /* Check for overlaps, this could be made more exact */
             uint32_t sb, se, db, de;
             sb = src_base + src_x + src_y * (width + src_pitch);