Subversion Repositories Kolibri OS

Rev

Rev 4104 | Rev 4246 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4104 Rev 4126
Line 59... Line 59...
59
int x86_clflush_size;
59
int x86_clflush_size;
60
unsigned int tsc_khz;
60
unsigned int tsc_khz;
Line 61... Line 61...
61
 
61
 
Line -... Line 62...
-
 
62
int i915_modeset = 1;
-
 
63
 
-
 
64
typedef union __attribute__((packed))
-
 
65
{
-
 
66
    uint32_t val;
-
 
67
    struct
-
 
68
    {
-
 
69
        uint8_t   state;
-
 
70
        uint8_t   code;
-
 
71
        uint16_t  ctrl_key;
-
 
72
    };
-
 
73
}oskey_t;
-
 
74
 
-
 
75
static inline oskey_t get_key(void)
-
 
76
{
-
 
77
    oskey_t val;
-
 
78
    asm volatile("int $0x40":"=a"(val):"a"(2));
-
 
79
    return val;
-
 
80
};
-
 
81
 
-
 
82
void i915_dpms(struct drm_device *dev, int mode);
-
 
83
 
-
 
84
void i915_driver_thread()
-
 
85
{
-
 
86
    struct drm_i915_private *dev_priv = main_device->dev_private;
-
 
87
    struct workqueue_struct *cwq = dev_priv->wq;
-
 
88
    static int dpms = 1;
-
 
89
    static int dpms_lock = 0;
-
 
90
    oskey_t   key;
-
 
91
    unsigned long irqflags;
-
 
92
    int tmp;
-
 
93
 
-
 
94
    printf("%s\n",__FUNCTION__);
-
 
95
 
-
 
96
    asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(1),"c"(1));
-
 
97
    asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(4),"c"(0x46),"d"(0x330));
-
 
98
    asm volatile("int $0x40":"=a"(tmp):"a"(66),"b"(4),"c"(0xC6),"d"(0x330));
-
 
99
 
-
 
100
    while(driver_wq_state != 0)
-
 
101
    {
-
 
102
        key = get_key();
-
 
103
 
-
 
104
        if( (key.val != 1) && (key.state == 0x02))
-
 
105
        {
-
 
106
            if(key.code == 0x46 && dpms_lock == 0)
-
 
107
            {
-
 
108
                dpms_lock = 1;
-
 
109
                if(dpms == 1)
-
 
110
                {
-
 
111
                    i915_dpms(main_device, DRM_MODE_DPMS_OFF);
-
 
112
                    printf("dpms off\n");
-
 
113
                }
-
 
114
                else
-
 
115
                {
-
 
116
                    i915_dpms(main_device, DRM_MODE_DPMS_ON);
-
 
117
                    printf("dpms on\n");
-
 
118
                };
-
 
119
                dpms ^= 1;
-
 
120
                }
-
 
121
            else if(key.code == 0xC6)
-
 
122
                dpms_lock = 0;
-
 
123
        };
-
 
124
 
-
 
125
        spin_lock_irqsave(&cwq->lock, irqflags);
-
 
126
 
-
 
127
        while (!list_empty(&cwq->worklist))
-
 
128
        {
-
 
129
            struct work_struct *work = list_entry(cwq->worklist.next,
-
 
130
                                        struct work_struct, entry);
-
 
131
            work_func_t f = work->func;
-
 
132
            list_del_init(cwq->worklist.next);
-
 
133
 
-
 
134
            spin_unlock_irqrestore(&cwq->lock, irqflags);
-
 
135
            f(work);
-
 
136
            spin_lock_irqsave(&cwq->lock, irqflags);
-
 
137
        }
-
 
138
 
-
 
139
        spin_unlock_irqrestore(&cwq->lock, irqflags);
-
 
140
 
-
 
141
        delay(1);
-
 
142
    };
-
 
143
 
-
 
144
    asm volatile ("int $0x40"::"a"(-1));
62
int i915_modeset = 1;
145
}
63
 
146
 
64
u32_t  __attribute__((externally_visible)) drvEntry(int action, char *cmdline)
147
u32_t  __attribute__((externally_visible)) drvEntry(int action, char *cmdline)
Line 65... Line 148...
65
{
148
{
Line 77... Line 160...
77
    if( cmdline && *cmdline )
160
    if( cmdline && *cmdline )
78
        parse_cmdline(cmdline, log);
161
        parse_cmdline(cmdline, log);
Line 79... Line 162...
79
 
162
 
80
    if(!dbg_open(log))
163
    if(!dbg_open(log))
81
    {
164
    {
82
//        strcpy(log, "/tmp1/1/i915.log");
-
 
83
//        strcpy(log, "/RD/1/DRIVERS/i915.log");
-
 
Line 84... Line 165...
84
        strcpy(log, "/BD1/4/i915.log");
165
        strcpy(log, "/tmp1/1/i915.log");
85
 
166
 
86
        if(!dbg_open(log))
167
        if(!dbg_open(log))
87
        {
168
        {
Line 107... Line 188...
107
    err = RegService("DISPLAY", display_handler);
188
    err = RegService("DISPLAY", display_handler);
Line 108... Line 189...
108
 
189
 
109
    if( err != 0)
190
    if( err != 0)
Line 110... Line -...
110
        dbgprintf("Set DISPLAY handler\n");
-
 
111
 
-
 
112
    struct drm_i915_private *dev_priv = main_device->dev_private;
191
        dbgprintf("Set DISPLAY handler\n");
Line 113... Line 192...
113
 
192
 
Line 114... Line 193...
114
    driver_wq_state = 1;
193
    driver_wq_state = 1;
115
 
194