View Single Post
Old 03-22-2013, 10:55 PM   #257
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,552
Karma: 6021146
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Had another dig round in my x build.

sys/x11/xlib.c apprears to be where the dithering action is.

I shoved a bunch of code in and played around but am a bit tired now.


Commented a bunch of stuff out - this is a mess really but you can see what I was trying to achieve at least. probably.
Spoiler:

PHP Code:
/*
 * xlib.c
 *
 *  Created on: 29 Nov 2012
 *      Author: twobobble mangling stuff
 */
/*
 * xlib.c
 *
 * Xlib interface.
 * dist under gnu gpl
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#if defined(HAVE_LIBXEXT) && defined(HAVE_X11_EXTENSIONS_XSHM_H) && defined(HAVE_SYS_IPC_H) && defined(HAVE_SYS_SHM_H)
#define USE_XSHM
#endif
#else
#define USE_XSHM  /* assume we have shm if no config.h - is this ok? */
#endif

#ifdef USE_XSHM
/* make sure ipc.h and shm.h will work! */
#define _SVID_SOURCE
#define _XOPEN_SOURCE
#endif

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>

#ifdef USE_XSHM
#include <X11/extensions/XShm.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#endif

#include <linux/fb.h>

// just to make the compiler happy
#include <asm/types.h>
typedef __u8 u8;

#include <einkfb.h>

#include "fb.h"
#include "input.h"
#include "rc.h"


int fd = -1;
int xoffs =0;
int yoffs =0;
uint8_t *fbdata NULL;
uint8_t *fbtemp NULL;
struct fb_fix_screeninfo finfo;
struct fb_var_screeninfo vinfo
uint32_t c;

uint8_t odither_e[] = { 0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F0x0F,
0x0F0x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x00 };
uint8_t odither_o[] = { 0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF0xFF,
0xFF0xFF0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF00xF0,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x000x00,
0x000x000x000x000x000x000x000x000x000x000x000x00 };




struct fb fb;

static 
int vmode[3] = { 00};
static 
int x_shmsync 1;

rcvar_t vid_exports[] =
{
    
RCV_VECTOR("vmode", &vmode3),
    
RCV_BOOL("x_shmsync", &x_shmsync),
    
RCV_END
};


static 
int initok;

/* Loads of bogus Xlib crap...bleh */

static char *x_displayname;

static 
Display *x_display;
static 
int x_screen;

static 
struct
{
    
int bits;
    
int vc;
    
int bytes;
x_vissup[] =
{
    { 
8PseudoColor},
    { 
15TrueColor},
    { 
16TrueColor},
    { 
32TrueColor},
    { 
24TrueColor},
    { 
00}
};

static 
int x_bitsx_bytes;
static 
Visual *x_vis;
static 
XVisualInfo x_visinfo;
static 
int x_pseudo;
static 
Colormap x_cmap;
static 
XColor x_ctable[256];

static 
int x_wattrmask;
static 
XSetWindowAttributes x_wattr;
static 
int x_gcvalmask;
static 
XGCValues x_gcval;

static 
Window x_win;
static 
int x_win_xx_win_y;
static 
int x_widthx_height;
static 
GC x_gc;

static 
XSizeHints x_size;
static 
XWMHints x_wmhints;
/*static XClassHint x_class;*/

#ifdef USE_XSHM
static XShmSegmentInfo x_shm;
#endif

static int x_useshm;
static 
int x_shmevent;
static 
int x_shmdone;
static 
XImage *x_image;
static 
int x_byteswap;

static 
XEvent x_ev;




static 
void freescreen()
{
    if (!
initok || !x_image) return;
    if ((
char *)fb.ptr != (char *)x_image->data)
        
free(fb.ptr);
#ifdef USE_XSHM
    
if (x_useshm)
    {
        
/* FIXME - is this the right way to free shared mem? */
        
XSync(x_displayFalse);
        if (!
XShmDetach(x_display, &x_shm))
            die (
"XShmDetach failed\n");
        
XSync(x_displayFalse);
        
shmdt(x_shm.shmaddr);
        
shmctl(x_shm.shmidIPC_RMID0);
        
x_image->data NULL;
    }
#endif
    
free(x_image);
    
x_image NULL;
    
fb.ptr NULL;
}

static 
void allocscreen()
{
    if (
initokfreescreen();
#ifdef USE_XSHM
    
if (x_useshm)
    {
        
x_image XShmCreateImage(
            
x_displayx_visx_bitsZPixmap0,
            &
x_shmx_widthx_height);
        if (
x_image)
        {
            
x_shm.shmid shmget(
                
IPC_PRIVATE,
                
x_image->bytes_per_line x_image->height,
                
IPC_CREAT 0777);
            if (
x_shm.shmid 0)
                die(
"shmget failed\n");
            
x_image->data x_shm.shmaddr =
                
shmat(x_shm.shmid00);
            if (!
x_image->data)
                die(
"shmat failed\n");
            if (!
XShmAttach(x_display, &x_shm))
                die(
"XShmAttach failed\n");
            
XSync(x_displayFalse);
            
x_shmdone 1;
            
fb.pitch x_image->bytes_per_line;
        }
        else
        {
            
x_useshm 0;
        }
    }
#endif
    
if (!x_useshm)
    {
        
x_image XCreateImage(
            
x_displayx_visx_bitsZPixmap0,
            
malloc(x_width*x_height*x_bytes),
            
x_widthx_heightx_bitsx_width*x_bytes);
        if (!
x_image)
            die(
"XCreateImage failed\n");
    }
    
x_byteswap x_image->byte_order ==
#ifdef IS_LITTLE_ENDIAN
        
MSBFirst
#else
        
LSBFirst
#endif
        
;
    if (
x_byteswap && x_bytes 1)
        
fb.ptr malloc(x_image->bytes_per_line x_image->height);
    else
        
fb.ptr = (byte *)x_image->data;
}



void vid_resize()
{
    
freescreen();
    
x_width fb.w;
    
x_height fb.h;
    
XResizeWindow(x_displayx_winx_widthx_height);
    
x_size.flags PSize PMinSize PMaxSize;
    
x_size.min_width x_size.max_width x_size.base_width x_width;
    
x_size.min_height x_size.max_height x_size.base_height x_height;
    
XSetWMNormalHints(x_displayx_win, &x_size);
    
XSync(x_displayFalse);
    
allocscreen();
}


static 
void colorshifts()
{
    
int i;
    
int mask[3];
    
int lc;

    
mask[0] = x_vis->red_mask;
    
mask[1] = x_vis->green_mask;
    
mask[2] = x_vis->blue_mask;

    for (
03i++)
    {
        for (
032 && !((1<<l) & mask[i]); l++);
        for (
0l+32 && ((1<<(l+c)) & mask[i]); c++);
        
fb.cc[i].l;
        
fb.cc[i].8-c;
    }
}


void vid_preinit()
{
    
/* do nothing; only needed on systems where we must drop perms */
}

void vid_init()
{
    
int i;


/* me */
fbtemp = (uint8_t*) malloc(144*160);
    if (!
fbtemp) {
        
fprintf(stderr"Error: can't claim shadow fb mem\n");
        exit(
1);
    }

/* open framebuffer */
    
fd open("/dev/fb0"O_RDWR);
    if (
fd == -1) {
        
perror("framebuffer");
        exit(
1);
    }

    
/* initialize data structures */
    
memset(&finfo0sizeof(finfo));
    
memset(&vinfo0sizeof(vinfo));

    
/* Get fixed screen information */
    
if (ioctl(fdFBIOGET_FSCREENINFO, &finfo)) {
        
perror("Error: get screen info");
        exit(
1);
    }

    if (
finfo.type != FB_TYPE_PACKED_PIXELS) {
        
fprintf(stderr"Error: video type not supported\n");
        exit(
1);
    }

    if (
ioctl(fdFBIOGET_VSCREENINFO, &vinfo)) {
        
perror("Error: get variable screen info");
        exit(
1);
    }

    if (!
vinfo.grayscale) {
        
fprintf(stderr"Error: only grayscale is supported\n");
        exit(
1);
    }

    if (
vinfo.bits_per_pixel != && vinfo.bits_per_pixel != 8) {
        
fprintf(stderr"Error: only 4/8BPP is supported for now\n");
        exit(
1);
    }

    
fprintf(stderr"%d bpp\n"vinfo.bits_per_pixel);
    
    if (
vinfo.xres <= || vinfo.yres <= 0) {
        
fprintf(stderr"Error: checking resolution, cannot use %dx%d.\n"vinfo.xresvinfo.yres);
        exit(
1);
    }

    
fprintf(stderr"resolution, is %dx%d.\n"vinfo.xresvinfo.yres);

    
/* mmap the framebuffer */
    
fbdata mmap(0finfo.smem_lenPROT_READ PROT_WRITEMAP_SHAREDfd0);
    if(
fbdata == MAP_FAILED) {
        
perror("mmap framebuffer");
    }
    
memset(fbdata0x00finfo.line_length*vinfo.yres);



/* end me */

    
if (initok) return;

    
x_displayname getenv("DISPLAY");
    if (!
x_displayname)
        die(
"DISPLAY environment variable not set\n");
    
x_display XOpenDisplay(NULL);
    if (!
x_display)
        die(
"failed to connect to X display\n");
    
x_screen DefaultScreen(x_display);

    for (
0x_vissup[i].bitsi++)
    {
        if (
XMatchVisualInfo(
            
x_displayx_screen,
            
x_vissup[i].bitsx_vissup[i].vc, &x_visinfo))
        {
            if (
x_vissup[i].vc == PseudoColor)
                
x_pseudo 1;
            else
                
x_pseudo 0;
            
x_bits x_vissup[i].bits;
            
x_bytes x_vissup[i].bytes;
            break;
        }
    }
    if (!
x_bits) die("no suitable X visuals\n");
    
x_vis x_visinfo.visual;
    if (!
x_vis) die("X visual is NULL");

    if (
x_pseudo)
    {
        
x_cmap XCreateColormap(
            
x_displayRootWindow(x_displayx_screen),
            
x_visAllocAll);
        for (
0256i++)
        {
            
x_ctable[i].pixel i;
            
x_ctable[i].flags DoRed|DoGreen|DoBlue;
        }
    }

    
x_wattrmask CWEventMask CWBorderPixel CWColormap;
    
x_wattr.event_mask KeyPressMask KeyReleaseMask ExposureMask
        
FocusChangeMask;
    
x_wattr.border_pixel 0;
    
x_wattr.colormap x_cmap;

    
x_gcvalmask GCGraphicsExposures;
    
x_gcval.graphics_exposures False;

    if (!
vmode[0] || !vmode[1])
    {
        
int scale rc_getint("scale");
        if (
scale 1scale 1;
        
vmode[0] = 160 scale;
        
vmode[1] = 144 scale;
    }

    
fb.vmode[0];
    
fb.vmode[1];
    
fb.pelsize x_bytes == x_bytes;
    
fb.pitch fb.fb.pelsize;
    
fb.indexed x_pseudo;
    
fb.enabled 1;
    
fb.dirty 0;

    
x_win_x x_win_y 0;
    
x_width fb.w;
    
x_height fb.h;
    
x_win XCreateWindow(
        
x_displayRootWindow(x_displayx_screen),
        
x_win_xx_win_yx_widthx_height0x_bits,
        
InputOutputx_visx_wattrmask, &x_wattr);
    if (!
x_win) die("could not create X window\n");

    
x_gc XCreateGC(x_displayx_winx_gcvalmask, &x_gcval);

    
x_size.flags PSize PMinSize PMaxSize;
    
x_size.min_width x_size.max_width x_size.base_width x_width;
    
x_size.min_height x_size.max_height x_size.base_height x_height;
    
XSetWMNormalHints(x_displayx_win, &x_size);

    
x_wmhints.initial_state NormalState;
    
x_wmhints.input True;
    
x_wmhints.flags StateHint InputHint;
    
XSetWMHints(x_displayx_win, &x_wmhints);

    
/* FIXME - set X class info stuff (with XSetClassHint)... */

    
XMapWindow(x_displayx_win);

    for(;;)
    {
        
XNextEvent(x_display, &x_ev);
        if (
x_ev.type == Expose && !x_ev.xexpose.count)
            break;
    }

    
XSetInputFocus(x_displayx_winRevertToPointerRootCurrentTime);

#ifdef USE_XSHM
    
if (XShmQueryExtension(x_display) && x_displayname[0] == ':')
    {
        
x_useshm 1;
        
x_shmevent XShmGetEventBase(x_display) + ShmCompletion;
    }
#endif

    
colorshifts();
    
allocscreen();

    
joy_init();

    
initok 1;


    
xoffs = (vinfo.xres vmode[0]) / 2;
    
yoffs = (vinfo.yres vmode[1]) / 2;
    
fprintf(stderr"x_image->bytes_per_line %d \n",x_image->bytes_per_line);
    
fprintf(stderr"x_image->height %d \n",x_image->height);
    
fprintf(stderr"finfo.line_length %d \n",finfo.line_length);
    
fprintf(stderr"vmode[0] %d \n",vmode[0]);
    
fprintf(stderr"vmode[1] %d \n",vmode[1]);
    
fprintf(stderr"vinfo.xres  %d \n",vinfo.xres );
    
fprintf(stderr"vinfo.yres  %d \n",vinfo.yres );
    
fprintf(stderr"xoffs  %d \n",xoffs );
    
fprintf(stderr"yoffs  %d \n",yoffs );
    
fprintf(stderr"x_byteswap && x_bytes >1  %d \n",x_byteswap && x_bytes );
    
fprintf(stderr"x_bytes %d \n",x_bytes );



}

void vid_close()
{
    
joy_close();
    if (!
initok) return;
    
freescreen();
    
XFreeGC(x_displayx_gc);
    
XDestroyWindow(x_displayx_win);
    
XCloseDisplay(x_display);
    
initok 0;
}



/* keymap - mappings of the form { keysym, localcode } - from x11/keymap.c */
extern int keymap[][2];

static 
int mapxkeycode(int xkeycode)
{
    
int i;
    
int sym;
    
int code;

    
sym XKeycodeToKeysym(x_displayxkeycode0);
    for (
0keymap[i][0]; i++)
        if (
keymap[i][0] == sym)
            return 
keymap[i][1];
    if (
sym XK_space || sym XK_asciitilde)
        return 
0;
    
code sym XK_space ' ';
    if (
code >= 'A' && code <= 'Z')
        
code tolower(code);;
    return 
code;
}


void vid_end();

static 
int nextevent(int sync)
{
    
event_t ev;

    if (!
sync && !XPending(x_display))
        return 
0;

    
XNextEvent(x_display, &x_ev);
    switch(
x_ev.type)
    {
    case 
KeyPress:
        
ev.type EV_PRESS;
        
ev.code mapxkeycode(x_ev.xkey.keycode);
        break;
    case 
KeyRelease:
        
ev.type EV_RELEASE;
        
ev.code mapxkeycode(x_ev.xkey.keycode);
        break;
    case 
Expose:
        
vid_end();
        return 
1;
        break;
    default:
        if (
x_ev.type == x_shmeventx_shmdone 1;
        return 
1;
        break;
    }
    return 
ev_postevent(&ev);  /* returns 0 if queue is full */
}



void ev_poll()
{
    while (
nextevent(0));
    
joy_poll();
}



void vid_settitle(char *title)
{
    
//XStoreName(x_display, x_win, title);
    
XStoreName(x_displayx_win"L:A_N:application_ID:xgnuboy_PC:N");
    
XSetIconName(x_displayx_wintitle);
}


void vid_setpal(int iint rint gint b)
{
    if (!
initok) return;

    if (
x_pseudo == 1)
    {
        
x_ctable[i].red << 8;
        
x_ctable[i].green << 8;
        
x_ctable[i].blue << 8;
        
XStoreColors(x_displayx_cmapx_ctable256);
    }
}

void vid_begin()
{
    if (!
x_useshm) return;

    
/* XSync(x_display, False); */
    
while (!x_shmdone && x_shmsync)
        
nextevent(1);
}

static 
void endianswap()
{

return;
    
int cnt;
    
un16 t16;
    
un32 t32;
    
un16 *src16 = (void *)fb.ptr;
    
un16 *dst16 = (void *)x_image->data;
    
un32 *src32 = (void *)fb.ptr;
    
un32 *dst32 = (void *)x_image->data;

    switch (
x_bytes)
    {
    case 
2:
        
cnt = (x_image->bytes_per_line x_image->height)>>1;
        while (
cnt--)
        {
            
t16 = *(src16++);
            *(
dst16++) = (t16 << 8) | (t16 >> 8);
        }
        break;
    case 
4:
        
cnt = (x_image->bytes_per_line x_image->height)>>2;
        while (
cnt--)
        {
            
t32 = *(src32++);
            *(
dst32++) = (t32 << 24) | ((t32 << 8) & 0x00FF0000) |
                ((
t32 >> 8) & 0x0000FF00) | (t32 >> 24);
        }
        break;
    }
}


void vid_end()
{

    
int xy;

    
uint8_t *dst_o;

int skip x_image->bytes_per_line//*2 - x_image->width * (vinfo.bits_per_pixel >> 2); // 480 * 2 - 480 * 1

    
if (!initok) return;

    if (
x_byteswapendianswap();

    
int cnt;
 
    
uint8_t  t8;

    
fb.ptr = (uint8_t*)x_image->data;
    
uint8_t *src = (void *)fb.ptr;

    
uint8_t *dst_e = (void *)x_image->data// + 0 + 0 * x_image->bytes_per_line;
    //dst_o = dst_e + finfo.line_length;

    
dst_o dst_e x_image->bytes_per_line 2;

    
//if(0 == c++ % 100) { /*frameskip*/
if(== 1) { /*frameskip*/

for(0<  x_image->heighty++) {
                for(
0<  x_image->widthx++) {
                    *
dst_e odither_e[*src] & 0xF0;
    
        
//    fprintf(stderr, "*src  %u \n",*src );
                    
*dst_e = *dst_e | (*dst_e >> 4);

        
//    fprintf(stderr, "dst_e  %u \n",dst_e );    
                    
dst_e++;
                    *
dst_e odither_e[*src] & 0x0F;

        
//    fprintf(stderr, "*src  %u \n",*src );
                    
*dst_e = *dst_e | (*dst_e << 4);

        
//    fprintf(stderr, "dst_e  %u \n",dst_e );    
                    
dst_e++;
                    *
dst_o odither_o[*src] & 0xF0;

        
//    fprintf(stderr, "*src  %u \n",*src );
                    
*dst_o = *dst_o | (*dst_o >> 4);

        
//    fprintf(stderr, "dst_o  %u \n",dst_o );    
                    
dst_o++;
                    *
dst_e odither_o[*src] & 0x0F;

        
//    fprintf(stderr, "*src  %u \n",*src );
                    
*dst_e = *dst_o | (*dst_o << 4);
    
    
//    fprintf(stderr, "dst_o  %u \n",dst_o );    
                    
dst_o++;
                    
src++;
//fprintf(stderr, "*src  %d \n",*src );
                
}
                
dst_e += skip;
                
dst_o += skip;


//        fprintf(stderr, "skip  %i \n",skip );

        
}

}
/*
    
        cnt = ((x_image->bytes_per_line*2) * x_image->height)>>2;
        while (cnt--)
        {
            t8 = *(src8++);
            *dst8 = odither_e[*src8] & 0xF0;
            *(dst8++) = (t8 << 4) | (t8 >> 4);

        }

*/


    
if (x_useshm)
    {
        if (!
x_shmdone) return;
#ifdef USE_XSHM
        
if (!XShmPutImage(
            
x_displayx_winx_gcx_image,
            
0000x_widthx_heightTrue))
            die(
"XShmPutImage failed\n");
#endif
        
x_shmdone 0;
fprintf(stderr"SHM Loop: x_height %i x_height %i \n",x_width,x_height);
    }
    else
    {
        
XPutImage(x_displayx_winx_gcx_image,
              
0000x_widthx_height); 
//fprintf(stderr, "Loop: count %i x_height %i x_height %i \n",c,x_width,x_height);
    
}

//    int skip = finfo.line_length*2 - 160 * (vinfo.bits_per_pixel >> 2);


//    if(0 == c++ % 2) { /*frameskip*/
    /*    src = fbtemp;
         // 8bpp
            dst_e = fbdata + xoffs + yoffs * finfo.line_length;
            dst_o = dst_e + finfo.line_length;

            for(y = 0; y <  x_image->height; y++) {
                for(x = 0; x <  x_image->width; x++) {
                    *dst_e = odither_e[*src] & 0xF0;
                    *dst_e = *dst_e | (*dst_e >> 4);
                    dst_e++;
                    *dst_e = odither_e[*src] & 0x0F;
                    *dst_e = *dst_e | (*dst_e << 4);
                    dst_e++;
                    *dst_o = odither_o[*src] & 0xF0;
                    *dst_o = *dst_o | (*dst_o >> 4);
                    dst_o++;
                    *dst_e = odither_o[*src] & 0x0F;
                    *dst_e = *dst_o | (*dst_o << 4);
                    dst_o++;
                    src++;
                }
                dst_e += skip;
                dst_o += skip;
            
        }
    
*/
    //    update_area_t myarea;
    //    myarea.x1 = xoffs;
    //    myarea.x2 = 320 + xoffs;
    //    myarea.y1 = yoffs;
    //    myarea.y2 = 288 + yoffs;
    //    myarea.buffer = NULL;
    //    myarea.which_fx = fx_update_partial;
    /*    ioctl(fd, FBIO_EINK_UPDATE_DISPLAY_AREA, &myarea);  */





Maybe I will just focus on trying to patch Xepyhr via builroot tomorrow instead.
twobob is offline   Reply With Quote