Hi Andi,

It seems commits b368aac6b87cf760264d66cf5c0286cd1dbeb02d and
bc6c8a327919655986e02e9ec2e436d33f41538a (gfxcard: support clipping for
vertical and horizontal flips) (on branches master and directfb-1.4)
broke vertical and horizontal flipping when doing blits that need to be
clipped, i.e. they look very different than stretch blits and also very
different than software-only blits.

I wrote a little test app (attached) to highlight this (it needs a
background.png in the same directory, mine is 1280x960). Run it in 576p,
720p and 1080p, press return twice, and you'll see the issues. With the
above patch more or less reversed hardware accelerated blits look
identical to dfb:no-software. So I don't think it's a bug in my driver
or test app.

What use case did your change fix? As I am tempted to revert the patch.


Cheers,
Andre'

#include <stdio.h>
#include <string.h>
#include <directfb.h>


int main (int argc, char **argv)
{
    IDirectFB          *dfb = NULL;
    IDirectFBSurface   *primary;
    IDirectFBDisplayLayer *layer;

    DFBSurfaceDescription dsc;
    DFBDisplayLayerConfig layer_config;



    DirectFBInit(&argc, &argv);
    DirectFBCreate(&dfb);
    dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
    dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
    layer->GetConfiguration(layer, &layer_config);

    dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
    dsc.caps = DSCAPS_PRIMARY;
    dsc.width = layer_config.width;
    dsc.height = layer_config.height;
    dsc.pixelformat = DSPF_RGB24;
    dfb->CreateSurface(dfb, &dsc, &primary);

    primary->Clear(primary,0,0,0,0);

    IDirectFBImageProvider *provider;
    //------------------------------------------------------
    int im_w,im_h;
    //------------------------------------------------------
    IDirectFBSurface *background = NULL;
    if (dfb->CreateImageProvider(dfb, "background.png", &provider) != DFB_OK) {
        fprintf(stderr, "background.png not found\n");
        goto out;
    }
    provider->GetSurfaceDescription(provider, &dsc);

    dsc.flags |= DSDESC_PIXELFORMAT;
    dsc.pixelformat = DSPF_RGB24;
    if (argc > 1)
      {
        if (*argv[1] == 'y')
          dsc.pixelformat = DSPF_YUV444P;
        else if (*argv[1] == 'i')
          dsc.pixelformat = DSPF_I420;
        else if (*argv[1] == 'r')
          dsc.pixelformat = DSPF_RGB24;
        else
          {
            fprintf (stderr,
                     "%s: unknown option, known:\n"
                     "\ty  YUV444P\n"
                     "\ti  I420\n"
                     "\tr  RGB24\n", argv[0]);
            goto out;
          }
      }

    dfb->CreateSurface(dfb, &dsc, &background);
    provider->RenderTo(provider, background, NULL);
    provider->Release(provider);

    //------------------------------------------------------
    DFBRectangle        rect_src;
    DFBRectangle        rect_dst;
    int loop;
    //------------------------------------------------------
    background->GetSize(background,&im_w,&im_h);

    rect_src.x = 0;
    rect_src.y = 0;
    rect_src.w = im_w;
    rect_src.h = im_h;

    rect_dst.x = 100;
    rect_dst.y = 100;
    rect_dst.w = 600;
    rect_dst.h = 600;

    rect_dst.y = 0;

    primary->Blit(primary, background, NULL, 10, 10);

//#define VERTICAL
#ifdef VERTICAL
    primary->SetBlittingFlags(primary, DSBLIT_FLIP_VERTICAL);
printf("blit flag set to vert flip\n");
#else
    primary->SetBlittingFlags(primary, DSBLIT_FLIP_HORIZONTAL);
printf("blit flag set to hor flip\n");
#endif

int _diff = im_w - im_h;
    for(loop = im_h - 1; loop < 2100; loop++)
    {
        DFBRectangle tmp_d = rect_dst;
        DFBRectangle tmp_s = rect_src;

        tmp_d.w = loop + _diff;
        tmp_d.h = loop;

        printf("src/dst: %d,%d-%dx%d   %d,%d-%dx%d\n",
               tmp_s.x, tmp_s.y, tmp_s.w, tmp_s.h,
               tmp_d.x, tmp_d.y, tmp_d.w, tmp_d.h);

        primary->StretchBlit(primary, background, &tmp_s, &tmp_d);
//        primary->Blit(primary, background, &tmp_s, tmp_d.x, tmp_d.y);

        getchar();
    }

    printf("press ENTER\n");

    background->Release(background);

out:
    layer->Release(layer);
    primary->Release(primary);
    dfb->Release(dfb);

    return 0;
}


_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to