Changeset 90f5d64 in mainline for fb/fb.c


Ignore:
Timestamp:
2006-06-03T14:54:51Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dc5a0fe1
Parents:
0861786
Message:

AS_AREA_CACHEABLE not needed anymore for sharing.
Added icons to console.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fb/fb.c

    r0861786 r90f5d64  
    4747#include "main.h"
    4848#include "../console/screenbuffer.h"
     49#include "ppm.h"
    4950
    5051#define DEFAULT_BGCOLOR                0x000080
     
    475476}
    476477
     478static int shm_handle(ipc_callid_t callid, ipc_call_t *call, int vp)
     479{
     480        static keyfield_t *interbuffer = NULL;
     481        static size_t intersize = 0;
     482
     483        static char *pixmap = NULL;
     484        static ipcarg_t pixmap_id = 0;
     485        static size_t pixmap_size;
     486
     487        int handled = 1;
     488        int retval = 0;
     489        viewport_t *vport = &viewports[vp];
     490        unsigned int x,y;
     491
     492        switch (IPC_GET_METHOD(*call)) {
     493        case IPC_M_AS_AREA_SEND:
     494                /* We accept one area for data interchange */
     495                if (IPC_GET_ARG1(*call) == pixmap_id) {
     496                        void *dest = as_get_mappable_page(IPC_GET_ARG2(*call));
     497                        pixmap_size = IPC_GET_ARG2(*call);
     498                        if (!ipc_answer_fast(callid, 0, (sysarg_t)dest, 0))
     499                                pixmap = dest;
     500                        else
     501                                pixmap_id = 0;
     502                        if (pixmap[0] != 'P')
     503                                while (1)
     504                                        ;
     505                        return 1;
     506                } else {
     507                        intersize = IPC_GET_ARG2(*call);
     508                        receive_comm_area(callid,call,(void **)&interbuffer);
     509                }
     510                return 1;
     511        case FB_PREPARE_SHM:
     512                if (pixmap_id)
     513                        retval = EBUSY;
     514                else
     515                        pixmap_id = IPC_GET_ARG1(*call);
     516                break;
     517               
     518        case FB_DROP_SHM:
     519                if (pixmap) {
     520                        as_area_destroy(pixmap);
     521                        pixmap = NULL;
     522                }
     523                pixmap_id = 0;
     524                break;
     525               
     526        case FB_DRAW_PPM:
     527                if (!pixmap) {
     528                        retval = EINVAL;
     529                        break;
     530                }
     531                x = IPC_GET_ARG1(*call);
     532                y = IPC_GET_ARG2(*call);
     533                if (x > vport->width || y > vport->height) {
     534                        retval = EINVAL;
     535                        break;
     536                }
     537               
     538                draw_ppm(pixmap, pixmap_size, IPC_GET_ARG1(*call), IPC_GET_ARG2(*call),
     539                         vport->width - x, vport->height - y, putpixel, vp);
     540                break;
     541        case FB_DRAW_TEXT_DATA:
     542                if (!interbuffer) {
     543                        retval = EINVAL;
     544                        break;
     545                }
     546                if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) {
     547                        retval = EINVAL;
     548                        break;
     549                }
     550                draw_text_data(vp, interbuffer);
     551                break;
     552        default:
     553                handled = 0;
     554        }
     555       
     556        if (handled)
     557                ipc_answer_fast(callid, retval, 0, 0);
     558        return handled;
     559}
    477560
    478561/** Function for handling connections to FB
     
    487570        unsigned int row,col;
    488571        char c;
    489         keyfield_t *interbuffer = NULL;
    490         size_t intersize = 0;
    491572
    492573        int vp = 0;
     
    506587                        continue;
    507588                }
     589                if (shm_handle(callid, &call, vp))
     590                        continue;
     591
    508592                switch (IPC_GET_METHOD(call)) {
    509593                case IPC_M_PHONE_HUNGUP:
     
    514598                        ipc_answer_fast(callid,0,0,0);
    515599                        return; /* Exit thread */
    516                 case IPC_M_AS_AREA_SEND:
    517                         /* We accept one area for data interchange */
    518                         intersize = IPC_GET_ARG2(call);
    519                         receive_comm_area(callid,&call,(void **)&interbuffer,
    520                                           sizeof(*interbuffer)*viewports[0].cols*viewports[0].rows);
    521                         continue;
    522 
    523                 case FB_DRAW_TEXT_DATA:
    524                         if (!interbuffer) {
    525                                 retval = EINVAL;
    526                                 break;
    527                         }
    528                         if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) {
    529                                 retval = EINVAL;
    530                                 break;
    531                         }
    532                         draw_text_data(vp, interbuffer);
    533                         retval = 0;
    534                         break;
     600
    535601                case FB_PUTCHAR:
    536602                        c = IPC_GET_ARG1(call);
Note: See TracChangeset for help on using the changeset viewer.