Skip to content

Commit

Permalink
Added support for the GCW0 IPU Scaler
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ban authored and JohnnyonFlame committed Mar 24, 2015
1 parent 258ccdb commit 34f1254
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile.gcw0
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ifeq ($(WITH_NETWORK), true)
SDL_LDLIBS += -lSDL_net
endif

ALL_CFLAGS += -std=c99 -I./src -DTARGET_$(PLATFORM) $(EXTRA_CFLAGS) $(SDL_CFLAGS) $(CFLAGS)
ALL_CFLAGS += -std=c99 -I./src -DTARGET_$(PLATFORM) $(EXTRA_CFLAGS) $(SDL_CFLAGS) $(CFLAGS) -DTARGET_GCW0
ALL_LDFLAGS += $(LDFLAGS)
LDLIBS += $(EXTRA_LDLIBS) $(SDL_LDLIBS)

Expand Down
17 changes: 16 additions & 1 deletion src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,22 @@ bool init_scaler( unsigned int new_scaler, bool fullscreen )
scaler_function = NULL;
break;
}


#ifdef TARGET_GCW0
FILE* aspect_ratio_file = fopen("/sys/devices/platform/jz-lcd.0/keep_aspect_ratio", "w");
if (aspect_ratio_file)
{
if ((scaler_function == shw_8)
|| (scaler_function == shw_16)
|| (scaler_function == shw_32))
fwrite("0", 1, 1, aspect_ratio_file);
else
fwrite("1", 1, 1, aspect_ratio_file);

fclose(aspect_ratio_file);
}
#endif

if (scaler_function == NULL)
{
assert(false);
Expand Down
23 changes: 23 additions & 0 deletions src/video_scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static void scale2x_16( SDL_Surface *src_surface, SDL_Surface *dst_surface );
static void scale3x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface );
static void scale3x_16( SDL_Surface *src_surface, SDL_Surface *dst_surface );
#else

static void s1dot2_16( SDL_Surface *src_surface, SDL_Surface *dst_surface );
static void s1dot2_32( SDL_Surface *src_surface, SDL_Surface *dst_surface );

Expand All @@ -54,6 +55,9 @@ const struct Scalers scalers[] =
{
#if defined(TARGET_GP2X) || defined(TARGET_DINGUX)
{ 320, 240, no_scale, nn_16, nn_32, "None" },
#if defined(TARGET_GCW0)
{ 320, 200, shw_8, shw_16, shw_32, "Scale HW"},
#endif
{ 320, 240, NULL, s1dot2_16, s1dot2_32, "Scale1.2x" },
{ 320, 240, NULL, hqs1dot2_16,hqs1dot2_32,"hq1.2x" },
#else
Expand Down Expand Up @@ -88,6 +92,8 @@ void set_scaler_by_name( const char *name )

void no_scale( SDL_Surface *src_surface, SDL_Surface *dst_surface )
{
//TODO:: Investigate- doesn't seem quite right

Uint8 *src = src_surface->pixels,
*dst = dst_surface->pixels;

Expand Down Expand Up @@ -606,3 +612,20 @@ static void hqs1dot2_32( SDL_Surface *src_surface, SDL_Surface *dst_surface )
}

#endif

#if defined (TARGET_GCW0)
void shw_8( SDL_Surface *src_surface, SDL_Surface *dst_surface )
{
no_scale(src_surface, dst_surface);
}

void shw_16( SDL_Surface *src_surface, SDL_Surface *dst_surface )
{
nn_16(src_surface, dst_surface);
}

void shw_32( SDL_Surface *src_surface, SDL_Surface *dst_surface )
{
nn_32(src_surface, dst_surface);
}
#endif
6 changes: 6 additions & 0 deletions src/video_scale.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ extern const uint scalers_count;

void set_scaler_by_name( const char *name );

#if defined(TARGET_GCW0)
void shw_8( SDL_Surface *src_surface, SDL_Surface *dst_surface );
void shw_16( SDL_Surface *src_surface, SDL_Surface *dst_surface );
void shw_32( SDL_Surface *src_surface, SDL_Surface *dst_surface );
#endif

#endif /* VIDEO_SCALE_H */

1 comment on commit 34f1254

@JohnnyonFlame
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi-ban's patch as proposed in #1, with small changes.

Please # to comment.