Revision 9312805d

b/hw/framebuffer.c
78 78
    dest = ds_get_data(ds);
79 79
    if (dest_col_pitch < 0)
80 80
        dest -= dest_col_pitch * (cols - 1);
81
    if (dest_row_pitch < 0) {
82
        dest -= dest_row_pitch * (rows - 1);
83
    }
81 84
    first = -1;
82 85
    addr = pd;
83 86

  
b/hw/pxa2xx_lcd.c
665 665
    }
666 666
}
667 667

  
668
static void pxa2xx_lcdc_dma0_redraw_horiz(PXA2xxLCDState *s,
668
static void pxa2xx_lcdc_dma0_redraw_rot0(PXA2xxLCDState *s,
669 669
                target_phys_addr_t addr, int *miny, int *maxy)
670 670
{
671 671
    int src_width, dest_width;
......
692 692
                               fn, s->dma_ch[0].palette, miny, maxy);
693 693
}
694 694

  
695
static void pxa2xx_lcdc_dma0_redraw_vert(PXA2xxLCDState *s,
695
static void pxa2xx_lcdc_dma0_redraw_rot90(PXA2xxLCDState *s,
696 696
               target_phys_addr_t addr, int *miny, int *maxy)
697 697
{
698 698
    int src_width, dest_width;
......
720 720
                               miny, maxy);
721 721
}
722 722

  
723
static void pxa2xx_lcdc_dma0_redraw_rot180(PXA2xxLCDState *s,
724
                target_phys_addr_t addr, int *miny, int *maxy)
725
{
726
    int src_width, dest_width;
727
    drawfn fn = NULL;
728
    if (s->dest_width) {
729
        fn = s->line_fn[s->transp][s->bpp];
730
    }
731
    if (!fn) {
732
        return;
733
    }
734

  
735
    src_width = (s->xres + 3) & ~3;     /* Pad to a 4 pixels multiple */
736
    if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp) {
737
        src_width *= 3;
738
    } else if (s->bpp > pxa_lcdc_16bpp) {
739
        src_width *= 4;
740
    } else if (s->bpp > pxa_lcdc_8bpp) {
741
        src_width *= 2;
742
    }
743

  
744
    dest_width = s->xres * s->dest_width;
745
    *miny = 0;
746
    framebuffer_update_display(s->ds,
747
                               addr, s->xres, s->yres,
748
                               src_width, -dest_width, -s->dest_width,
749
                               s->invalidated,
750
                               fn, s->dma_ch[0].palette, miny, maxy);
751
}
752

  
753
static void pxa2xx_lcdc_dma0_redraw_rot270(PXA2xxLCDState *s,
754
               target_phys_addr_t addr, int *miny, int *maxy)
755
{
756
    int src_width, dest_width;
757
    drawfn fn = NULL;
758
    if (s->dest_width) {
759
        fn = s->line_fn[s->transp][s->bpp];
760
    }
761
    if (!fn) {
762
        return;
763
    }
764

  
765
    src_width = (s->xres + 3) & ~3;     /* Pad to a 4 pixels multiple */
766
    if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp) {
767
        src_width *= 3;
768
    } else if (s->bpp > pxa_lcdc_16bpp) {
769
        src_width *= 4;
770
    } else if (s->bpp > pxa_lcdc_8bpp) {
771
        src_width *= 2;
772
    }
773

  
774
    dest_width = s->yres * s->dest_width;
775
    *miny = 0;
776
    framebuffer_update_display(s->ds,
777
                               addr, s->xres, s->yres,
778
                               src_width, -s->dest_width, dest_width,
779
                               s->invalidated,
780
                               fn, s->dma_ch[0].palette,
781
                               miny, maxy);
782
}
783

  
723 784
static void pxa2xx_lcdc_resize(PXA2xxLCDState *s)
724 785
{
725 786
    int width, height;
......
730 791
    height = LCCR2_LPP(s->control[2]) + 1;
731 792

  
732 793
    if (width != s->xres || height != s->yres) {
733
        if (s->orientation)
794
        if (s->orientation == 90 || s->orientation == 270) {
734 795
            qemu_console_resize(s->ds, height, width);
735
        else
796
        } else {
736 797
            qemu_console_resize(s->ds, width, height);
798
        }
737 799
        s->invalidated = 1;
738 800
        s->xres = width;
739 801
        s->yres = height;
......
797 859
    }
798 860

  
799 861
    if (miny >= 0) {
800
        if (s->orientation)
801
            dpy_update(s->ds, miny, 0, maxy - miny, s->xres);
802
        else
803
            dpy_update(s->ds, 0, miny, s->xres, maxy - miny);
862
        switch (s->orientation) {
863
        case 0:
864
            dpy_update(s->ds, 0, miny, s->xres, maxy - miny + 1);
865
            break;
866
        case 90:
867
            dpy_update(s->ds, miny, 0, maxy - miny + 1, s->xres);
868
            break;
869
        case 180:
870
            maxy = s->yres - maxy - 1;
871
            miny = s->yres - miny - 1;
872
            dpy_update(s->ds, 0, maxy, s->xres, miny - maxy + 1);
873
            break;
874
        case 270:
875
            maxy = s->yres - maxy - 1;
876
            miny = s->yres - miny - 1;
877
            dpy_update(s->ds, maxy, 0, miny - maxy + 1, s->xres);
878
            break;
879
        }
804 880
    }
805 881
    pxa2xx_lcdc_int_update(s);
806 882

  
......
822 898
{
823 899
    PXA2xxLCDState *s = (PXA2xxLCDState *) opaque;
824 900

  
825
    if (angle) {
826
        s->dma_ch[0].redraw = pxa2xx_lcdc_dma0_redraw_vert;
827
    } else {
828
        s->dma_ch[0].redraw = pxa2xx_lcdc_dma0_redraw_horiz;
901
    switch (angle) {
902
    case 0:
903
        s->dma_ch[0].redraw = pxa2xx_lcdc_dma0_redraw_rot0;
904
        break;
905
    case 90:
906
        s->dma_ch[0].redraw = pxa2xx_lcdc_dma0_redraw_rot90;
907
        break;
908
    case 180:
909
        s->dma_ch[0].redraw = pxa2xx_lcdc_dma0_redraw_rot180;
910
        break;
911
    case 270:
912
        s->dma_ch[0].redraw = pxa2xx_lcdc_dma0_redraw_rot270;
913
        break;
829 914
    }
830 915

  
831 916
    s->orientation = angle;
b/input.c
148 148
    QEMUPutMouseEntry *entry;
149 149
    QEMUPutMouseEvent *mouse_event;
150 150
    void *mouse_event_opaque;
151
    int width;
151
    int width, height;
152 152

  
153 153
    if (QTAILQ_EMPTY(&mouse_handlers)) {
154 154
        return;
......
160 160
    mouse_event_opaque = entry->qemu_put_mouse_event_opaque;
161 161

  
162 162
    if (mouse_event) {
163
        if (graphic_rotate) {
164
            if (entry->qemu_put_mouse_event_absolute) {
165
                width = 0x7fff;
166
            } else {
167
                width = graphic_width - 1;
168
            }
169
            mouse_event(mouse_event_opaque, width - dy, dx, dz, buttons_state);
163
        if (entry->qemu_put_mouse_event_absolute) {
164
            width = 0x7fff;
165
            height = 0x7fff;
170 166
        } else {
171
            mouse_event(mouse_event_opaque, dx, dy, dz, buttons_state);
167
            width = graphic_width - 1;
168
            height = graphic_height - 1;
169
        }
170

  
171
        switch (graphic_rotate) {
172
        case 0:
173
            mouse_event(mouse_event_opaque,
174
                        dx, dy, dz, buttons_state);
175
            break;
176
        case 90:
177
            mouse_event(mouse_event_opaque,
178
                        width - dy, dx, dz, buttons_state);
179
            break;
180
        case 180:
181
            mouse_event(mouse_event_opaque,
182
                        width - dx, height - dy, dz, buttons_state);
183
            break;
184
        case 270:
185
            mouse_event(mouse_event_opaque,
186
                        dy, height - dx, dz, buttons_state);
187
            break;
172 188
        }
173 189
    }
174 190
}
b/qemu-options.hx
787 787
Rotate graphical output 90 deg left (only PXA LCD).
788 788
ETEXI
789 789

  
790
DEF("rotate", HAS_ARG, QEMU_OPTION_rotate,
791
    "-rotate <deg>   rotate graphical output some deg left (only PXA LCD)\n",
792
    QEMU_ARCH_ALL)
793
STEXI
794
@item -rotate
795
@findex -rotate
796
Rotate graphical output some deg left (only PXA LCD).
797
ETEXI
798

  
790 799
DEF("vga", HAS_ARG, QEMU_OPTION_vga,
791 800
    "-vga [std|cirrus|vmware|qxl|xenfb|none]\n"
792 801
    "                select video card type\n", QEMU_ARCH_ALL)
b/vl.c
2300 2300
#endif
2301 2301
                break;
2302 2302
            case QEMU_OPTION_portrait:
2303
                graphic_rotate = 1;
2303
                graphic_rotate = 90;
2304
                break;
2305
            case QEMU_OPTION_rotate:
2306
                graphic_rotate = strtol(optarg, (char **) &optarg, 10);
2307
                if (graphic_rotate != 0 && graphic_rotate != 90 &&
2308
                    graphic_rotate != 180 && graphic_rotate != 270) {
2309
                    fprintf(stderr,
2310
                        "qemu: only 90, 180, 270 deg rotation is available\n");
2311
                    exit(1);
2312
                }
2304 2313
                break;
2305 2314
            case QEMU_OPTION_kernel:
2306 2315
                kernel_filename = optarg;

Also available in: Unified diff