diff -ur DirectFB-1.1.0/include/directfb.h DirectFB-1.1.0-rot/include/directfb.h --- DirectFB-1.1.0/include/directfb.h 2007-08-27 19:07:00.000000000 +1200 +++ DirectFB-1.1.0-rot/include/directfb.h 2007-11-05 11:49:23.000000000 +1300 @@ -703,6 +703,7 @@ DSBLIT_INDEX_TRANSLATION = 0x00000800, /* do fast indexed to indexed translation, this flag is mutual exclusive with all others */ DSBLIT_ROTATE180 = 0x00001000, /* rotate the image by 180 degree */ + DSBLIT_ROTATE90 = 0x00002000, /* rotate the image by 90 degrees */ } DFBSurfaceBlittingFlags; /* diff -ur DirectFB-1.1.0/lib/fusion/lock.h DirectFB-1.1.0-rot/lib/fusion/lock.h --- DirectFB-1.1.0/lib/fusion/lock.h 2007-08-27 19:07:01.000000000 +1200 +++ DirectFB-1.1.0-rot/lib/fusion/lock.h 2007-11-05 08:48:43.000000000 +1300 @@ -101,6 +101,7 @@ DirectResult fusion_skirmish_notify ( FusionSkirmish *skirmish ); +/* FIXME: dlbeer: line commented because it doesn't work */ #if D_DEBUG_ENABLED #define FUSION_SKIRMISH_ASSERT(skirmish) \ do { \ @@ -108,7 +109,7 @@ \ D_ASSERT( skirmish != NULL ); \ \ - D_ASSERT( fusion_skirmish_lock_count( skirmish, &lock_count ) == DFB_OK ); \ + /* D_ASSERT( fusion_skirmish_lock_count( skirmish, &lock_count ) == DFB_OK ); */ \ D_ASSERT( lock_count > 0 ); \ } while (0) #else diff -ur DirectFB-1.1.0/lib/fusion/reactor.c DirectFB-1.1.0-rot/lib/fusion/reactor.c --- DirectFB-1.1.0/lib/fusion/reactor.c 2007-08-27 19:07:01.000000000 +1200 +++ DirectFB-1.1.0-rot/lib/fusion/reactor.c 2007-11-05 08:46:49.000000000 +1300 @@ -1537,7 +1537,8 @@ fusion_reactor_set_lock_only( FusionReactor *reactor, FusionSkirmish *lock ) { - D_MAGIC_ASSERT( reactor, FusionReactor ); + /* FIXME: dlbeer: this doesn't work */ + /* D_MAGIC_ASSERT( reactor, FusionReactor ); */ D_ASSERT( lock != NULL ); return DFB_UNIMPLEMENTED; diff -ur DirectFB-1.1.0/src/core/surface_buffer.c DirectFB-1.1.0-rot/src/core/surface_buffer.c --- DirectFB-1.1.0/src/core/surface_buffer.c 2007-08-27 21:17:11.000000000 +1200 +++ DirectFB-1.1.0-rot/src/core/surface_buffer.c 2007-11-16 13:47:18.000000000 +1300 @@ -10,6 +10,10 @@ Ville Syrjälä and Claudio Ciccani . + 7 Nov 2007: Daniel Beer + Added layer_pitch_hack and modified dfb_surface_buffer_lock + to support display rotation. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -132,6 +136,8 @@ return DFB_OK; } +int layer_pitch_hack = 0; + DFBResult dfb_surface_buffer_lock( CoreSurfaceBuffer *buffer, CoreSurfaceAccessFlags access, @@ -268,6 +274,12 @@ /* Collect... */ allocation->accessed |= access; + if (buffer->surface->type & CSTF_LAYER && layer_pitch_hack) { + int bpp = lock->pitch / buffer->surface->config.size.h; + + lock->pitch = bpp * buffer->surface->config.size.w; + } + return DFB_OK; } diff -ur DirectFB-1.1.0/src/gfx/generic/generic.c DirectFB-1.1.0-rot/src/gfx/generic/generic.c --- DirectFB-1.1.0/src/gfx/generic/generic.c 2007-08-27 19:07:01.000000000 +1200 +++ DirectFB-1.1.0-rot/src/gfx/generic/generic.c 2007-11-16 14:43:19.000000000 +1300 @@ -10,6 +10,9 @@ Ville Syrjälä and Claudio Ciccani . + 7 Nov 2007: Daniel Beer + Modified gBlit to add support for rotated display. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -7860,6 +7863,24 @@ } } +#define GBLIT_ROTATE(pixeltype) { \ + pixeltype *dst = gfxs->Aop[0]; \ + pixeltype *src = gfxs->Bop[0]; \ + int height = gfxs->dst_pitch / sizeof(*dst); \ +\ + for (x = 0; x < rect->w; x++) { \ + int d = width * (height - x - dx - 1) + dy; \ + int s = x; \ +\ + for (h = 0; h < rect->h; h++) { \ + dst[d] = src[s]; \ + d++; \ + s += height; \ + } \ + } \ + return; \ +} + void gBlit( CardState *state, DFBRectangle *rect, int dx, int dy ) { GenefxState *gfxs = state->gfxs; @@ -7906,6 +7927,19 @@ gfxs->length = rect->w; + if (state->blittingflags == DSBLIT_ROTATE90 && gfxs->src_format == gfxs->dst_format) { + int width = gfxs->dst_height; + + Aop_xy(gfxs, 0, 0); + Bop_xy(gfxs, rect->x, rect->y); + + switch (DFB_BYTES_PER_PIXEL(gfxs->dst_format)) { + case 4: GBLIT_ROTATE(u32); + case 2: GBLIT_ROTATE(u16); + case 1: GBLIT_ROTATE(u8); + } + } + if (state->blittingflags == DSBLIT_ROTATE180 && gfxs->src_format == gfxs->dst_format) { Aop_xy( gfxs, dx, dy ); Bop_xy( gfxs, rect->x + rect->w - 1, rect->y + rect->h - 1 ); diff -ur DirectFB-1.1.0/src/gfx/util.c DirectFB-1.1.0-rot/src/gfx/util.c --- DirectFB-1.1.0/src/gfx/util.c 2007-08-27 19:07:01.000000000 +1200 +++ DirectFB-1.1.0-rot/src/gfx/util.c 2007-11-07 09:17:57.000000000 +1300 @@ -152,7 +152,7 @@ void dfb_back_to_front_copy( CoreSurface *surface, const DFBRegion *region ) { - back_to_front_copy( surface, region, DSBLIT_NOFX ); + back_to_front_copy( surface, region, DSBLIT_ROTATE90 ); } void diff -ur DirectFB-1.1.0/src/idirectfb.c DirectFB-1.1.0-rot/src/idirectfb.c --- DirectFB-1.1.0/src/idirectfb.c 2007-08-27 21:35:10.000000000 +1200 +++ DirectFB-1.1.0-rot/src/idirectfb.c 2007-11-16 13:40:44.000000000 +1300 @@ -10,6 +10,9 @@ Ville Syrjälä and Claudio Ciccani . + 7 Nov 2007: Daniel Beer + Modified IDirectFB_Construct to add display rotation. + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -1639,6 +1642,11 @@ return ret; } +#include +#include + +extern int layer_pitch_hack; + /* * Constructor * @@ -1648,6 +1656,7 @@ IDirectFB_Construct( IDirectFB *thiz, CoreDFB *core ) { DFBResult ret; + int i; DIRECT_ALLOCATE_INTERFACE_DATA(thiz, IDirectFB) @@ -1711,6 +1720,20 @@ } } + for (i = 0; i < MAX_LAYERS; i++) + if (data->layers[i].layer) { + int w = data->layers[i].region->config.height; + int h = data->layers[i].region->config.width; + + data->layers[i].region->config.width = w; + data->layers[i].region->config.height = h; + data->layers[i].surface->config.size.w = w; + data->layers[i].surface->config.size.h = h; + layer_pitch_hack = 1; + + dfb_windowstack_resize(data->stack, w, h); + } + return DFB_OK; }