OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mw/] [src/] [drivers/] [fb.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
/*
2
 * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
3
 *
4
 * Screen Driver Utilities
5
 *
6
 * Microwindows framebuffer selection routines
7
 * Including this file will drag in all fblinX framebuffer subdrivers
8
 * When a new framebuffer subdriver is written, it should be referenced
9
 * here in select_fb_driver.
10
 */
11
#include <assert.h>
12
#include <stdio.h>
13
#include <stdlib.h>
14
#include "device.h"
15
#include "genmem.h"
16
#include "fb.h"
17
 
18
/* select a framebuffer subdriver based on planes and bpp*/
19
/* modify this procedure to add a new framebuffer subdriver*/
20
PSUBDRIVER
21
select_fb_subdriver(PSD psd)
22
{
23
        PSUBDRIVER  driver = NULL;
24
        extern SUBDRIVER fblinear1;
25
        extern SUBDRIVER fblinear2;
26
        extern SUBDRIVER fblinear4;
27
        extern SUBDRIVER fblinear8;
28
        extern SUBDRIVER fblinear16;
29
        extern SUBDRIVER fblinear24;
30
        extern SUBDRIVER fblinear32;
31
#if FBVGA
32
        extern SUBDRIVER vgaplan4;
33
        extern SUBDRIVER memplan4;
34
 
35
        /* FB_TYPE_VGA_PLANES*/
36
        if(psd->planes == 4 && psd->bpp == 4) {
37
                if(psd->flags & PSF_MEMORY)
38
                        driver = &memplan4;
39
                else driver = &vgaplan4;
40
        }
41
#endif
42
 
43
        /* FB_TYPE_PACKED_PIXELS*/
44
        /* device and memory drivers are the same for packed pixels*/
45
        if(psd->planes == 1) {
46
                switch(psd->bpp) {
47
                case 1:
48
                        driver = &fblinear1;
49
                        break;
50
                case 2:
51
                        driver = &fblinear2;
52
                        break;
53
                case 4:
54
                        driver = &fblinear4;
55
                        break;
56
                case 8:
57
                        driver = &fblinear8;
58
                        break;
59
                case 16:
60
                        driver = &fblinear16;
61
                        break;
62
                case 24:
63
                        driver = &fblinear24;
64
                        break;
65
                case 32:
66
                        driver = &fblinear32;
67
                        break;
68
                }
69
        }
70
 
71
        /* return driver selected*/
72
        return driver;
73
}
74
 
75
/*
76
 * Initialize memory device with passed parms,
77
 * select suitable framebuffer subdriver,
78
 * and set subdriver in memory device.
79
 */
80
MWBOOL
81
fb_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,int linelen,
82
        int size,void *addr)
83
{
84
        PSUBDRIVER subdriver;
85
 
86
        /* initialize mem screen driver*/
87
        initmemgc(mempsd, w, h, planes, bpp, linelen, size, addr);
88
 
89
/* FIXME kluge for current portrait mode subdriver in scr_fbportrait.c*/
90
//if(mempsd->portrait != MWPORTRAIT_NONE) return 1;
91
 
92
        /* select a framebuffer subdriver based on planes and bpp*/
93
        subdriver = select_fb_subdriver(mempsd);
94
        if(!subdriver)
95
                return 0;
96
 
97
        /* set and initialize subdriver into mem screen driver*/
98
        if(!set_subdriver(mempsd, subdriver, TRUE))
99
                return 0;
100
 
101
        return 1;
102
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.