On 05/24/12 12:27, Sorin Otescu wrote: > Hi all, > > Does anybody know/remember why serial support was disabled ? Was the > performance gain too small ? Are there plans to re-enable it ? > > I'm asking because I have recently gained the capability to implement it for > our DFB driver, but then I noticed that nobody's using this anymore...
Nice coincidence. Yesterday I revived the serial support! http://git.directfb.org/?p=core/DirectFB.git;a=commit;h=6a37bbd87715434e46c3b3c1bb49ec542eae3a4c There's also a test program dfbtest_waitserial. Here's the expected out when WaitSerial is working: Testing on virtual2d driver (implements GetSerial/WaitSerial): Lock took 125 us, WaitIdle took additional 110462 us Lock took 254 us, WaitIdle took additional 98246 us Lock took 114 us, WaitIdle took additional 113675 us So you see in this test case the serial support avoids waiting for 110ms (first line) instead waiting for much less time to get the first surface locked. This was tested with the virtual2D driver (historically called vmware) that has a virtual queue of graphics operations now. So it is usable for testing the new code or as a reference for driver writers on how to implement the support: http://git.directfb.org/?p=core/DirectFB.git;a=commit;h=b5a595bd1d0edfe15f366d416087e4df4df4373c -- Best regards, Denis Oliver Kropp .------------------------------------------. | DirectFB - Hardware accelerated graphics | | http://www.directfb.org/ | "------------------------------------------"
/* (c) Copyright 2008 Denis Oliver Kropp All rights reserved. This file is subject to the terms and conditions of the MIT License: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <config.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <direct/messages.h> #include <directfb.h> #include <directfb_strings.h> #include <directfb_util.h> static const DirectFBPixelFormatNames( format_names ); /**********************************************************************************************************************/ static DFBBoolean parse_format( const char *arg, DFBSurfacePixelFormat *_f ) { int i = 0; while (format_names[i].format != DSPF_UNKNOWN) { if (!strcasecmp( arg, format_names[i].name )) { *_f = format_names[i].format; return DFB_TRUE; } ++i; } fprintf (stderr, "\nInvalid format specified!\n\n" ); return DFB_FALSE; } static int print_usage( const char *prg ) { int i = 0; fprintf (stderr, "\n"); fprintf (stderr, "== DirectFB Blitting Test (version %s) ==\n", DIRECTFB_VERSION); fprintf (stderr, "\n"); fprintf (stderr, "Known pixel formats:\n"); while (format_names[i].format != DSPF_UNKNOWN) { DFBSurfacePixelFormat format = format_names[i].format; fprintf (stderr, " %-10s %2d bits, %d bytes", format_names[i].name, DFB_BITS_PER_PIXEL(format), DFB_BYTES_PER_PIXEL(format)); if (DFB_PIXELFORMAT_HAS_ALPHA(format)) fprintf (stderr, " ALPHA"); if (DFB_PIXELFORMAT_IS_INDEXED(format)) fprintf (stderr, " INDEXED"); if (DFB_PLANAR_PIXELFORMAT(format)) { int planes = DFB_PLANE_MULTIPLY(format, 1000); fprintf (stderr, " PLANAR (x%d.%03d)", planes / 1000, planes % 1000); } fprintf (stderr, "\n"); ++i; } fprintf (stderr, "\n"); fprintf (stderr, "\n"); fprintf (stderr, "Usage: %s [options]\n", prg); fprintf (stderr, "\n"); fprintf (stderr, "Options:\n"); fprintf (stderr, " -h, --help Show this help message\n"); fprintf (stderr, " -v, --version Print version information\n"); fprintf (stderr, " -d, --dest <pixelformat> Destination pixel format\n"); return -1; } /**********************************************************************************************************************/ int main( int argc, char *argv[] ) { int i; DFBResult ret; DFBSurfaceDescription desc; IDirectFB *dfb; IDirectFBSurface *dest1 = NULL; IDirectFBSurface *dest2 = NULL; DFBSurfacePixelFormat dest_format = DSPF_UNKNOWN; /* Initialize DirectFB. */ ret = DirectFBInit( &argc, &argv ); if (ret) { D_DERROR( ret, "DFBTest/Blit: DirectFBInit() failed!\n" ); return ret; } /* Parse arguments. */ for (i=1; i<argc; i++) { const char *arg = argv[i]; if (strcmp( arg, "-h" ) == 0 || strcmp (arg, "--help") == 0) return print_usage( argv[0] ); else if (strcmp (arg, "-v") == 0 || strcmp (arg, "--version") == 0) { fprintf (stderr, "dfbtest_blit version %s\n", DIRECTFB_VERSION); return false; } else if (strcmp (arg, "-d") == 0 || strcmp (arg, "--dest") == 0) { if (++i == argc) { print_usage (argv[0]); return false; } if (!parse_format( argv[i], &dest_format )) return false; } else return print_usage( argv[0] ); } /* Create super interface. */ ret = DirectFBCreate( &dfb ); if (ret) { D_DERROR( ret, "DFBTest/Blit: DirectFBCreate() failed!\n" ); return ret; } /* Fill description for destination surface. */ desc.flags = DSDESC_WIDTH | DSDESC_HEIGHT; desc.width = 512; desc.height = 512; if (dest_format != DSPF_UNKNOWN) { desc.flags |= DSDESC_PIXELFORMAT; desc.pixelformat = dest_format; } /* Create first surface. */ ret = dfb->CreateSurface( dfb, &desc, &dest1 ); if (ret) { D_DERROR( ret, "DFBTest/Blit: IDirectFB::CreateSurface() failed!\n" ); goto out; } /* Create second surface. */ ret = dfb->CreateSurface( dfb, &desc, &dest2 ); if (ret) { D_DERROR( ret, "DFBTest/Blit: IDirectFB::CreateSurface() failed!\n" ); goto out; } dest1->GetSize( dest1, &desc.width, &desc.height ); dest1->GetPixelFormat( dest1, &desc.pixelformat ); D_INFO( "DFBTest/Blit: Destination is %dx%d using %s\n", desc.width, desc.height, dfb_pixelformat_name(desc.pixelformat) ); direct_log_printf( NULL, "\nLock should take less than WaitIdle. WaitIdle should not take minimal amount of time.\n\n" ); for (i=0; i<100; i++) { int j, n = rand()%1000 + 100; void *ptr; int pitch; for (j=0; j<10; j++) dest1->FillRectangle( dest1, 0, 0, desc.width, desc.height ); for (j=0; j<n; j++) dest2->FillRectangle( dest2, 0, 0, desc.width, desc.height ); long long t1 = direct_clock_get_abs_micros(); dest1->Lock( dest1, DSLF_READ, &ptr, &pitch ); dest1->Unlock( dest1 ); long long t2 = direct_clock_get_abs_micros(); dfb->WaitIdle( dfb ); long long t3 = direct_clock_get_abs_micros(); direct_log_printf( NULL, "Lock took %lld us, WaitIdle took additional %lld us\n", t2 - t1, t3 - t2 ); } out: if (dest2) dest2->Release( dest2 ); if (dest1) dest1->Release( dest1 ); /* Shutdown DirectFB. */ dfb->Release( dfb ); return ret; }
_______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev