Rev 1230 | Rev 1239 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1230 | Rev 1233 | ||
---|---|---|---|
Line 62... | Line 62... | ||
62 | void (__stdcall *restore_cursor)(int x, int y); |
62 | void (__stdcall *restore_cursor)(int x, int y); |
63 | 63 | ||
Line 64... | Line 64... | ||
64 | }; |
64 | }; |
Line -... | Line 65... | ||
- | 65 | ||
Line 65... | Line 66... | ||
65 | 66 | int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled); |
|
Line 66... | Line 67... | ||
66 | 67 | ||
Line 145... | Line 146... | ||
145 | ~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK)); |
146 | ~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK)); |
146 | } |
147 | } |
147 | } |
148 | } |
148 | 149 | ||
Line 149... | Line -... | ||
149 | int pre_init_display(struct radeon_device *rdev) |
- | |
150 | { |
- | |
151 | cursor_t *cursor; |
- | |
152 | - | ||
153 | ENTER(); |
- | |
154 | - | ||
155 | rdisplay = GetDisplay(); |
- | |
156 | - | ||
157 | rdisplay->ddev = rdev->ddev; |
- | |
158 | - | ||
159 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
- | |
160 | { |
- | |
161 | init_cursor(cursor); |
- | |
162 | }; |
- | |
163 | - | ||
164 | LEAVE(); |
- | |
165 | - | ||
166 | return 1; |
- | |
167 | }; |
- | |
168 | - | ||
169 | int post_init_display(struct radeon_device *rdev) |
- | |
170 | { |
- | |
171 | cursor_t *cursor; |
- | |
172 | - | ||
173 | ENTER(); |
- | |
174 | - | ||
175 | select_cursor(rdisplay->cursor); |
- | |
176 | - | ||
177 | radeon_show_cursor(rdisplay->crtc); |
- | |
178 | - | ||
179 | rdisplay->init_cursor = init_cursor; |
- | |
180 | rdisplay->select_cursor = select_cursor; |
- | |
181 | rdisplay->show_cursor = NULL; |
- | |
182 | rdisplay->move_cursor = move_cursor; |
- | |
183 | rdisplay->restore_cursor = restore_cursor; |
- | |
184 | - | ||
185 | LEAVE(); |
- | |
186 | - | ||
187 | return 1; |
- | |
188 | }; |
- | |
Line 189... | Line 150... | ||
189 | 150 | ||
190 | static void radeon_lock_cursor(struct drm_crtc *crtc, bool lock) |
151 | static void radeon_lock_cursor(struct drm_crtc *crtc, bool lock) |
191 | { |
152 | { |
192 | struct radeon_device *rdev = crtc->dev->dev_private; |
153 | struct radeon_device *rdev = crtc->dev->dev_private; |
Line 309... | Line 270... | ||
309 | void __stdcall restore_cursor(int x, int y) |
270 | void __stdcall restore_cursor(int x, int y) |
310 | { |
271 | { |
311 | };><>><>><>><>><>><>=>><>><>>>>> |
272 | }; |
Line -... | Line 273... | ||
- | 273 | ||
- | 274 | static char *manufacturer_name(unsigned char *x) |
|
- | 275 | { |
|
- | 276 | static char name[4]; |
|
- | 277 | ||
- | 278 | name[0] = ((x[0] & 0x7C) >> 2) + '@'; |
|
- | 279 | name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'; |
|
- | 280 | name[2] = (x[1] & 0x1F) + '@'; |
|
- | 281 | name[3] = 0; |
|
- | 282 | ||
- | 283 | return name; |
|
- | 284 | } |
|
- | 285 | ||
- | 286 | bool set_mode(struct drm_device *dev, int width, int height) |
|
- | 287 | { |
|
- | 288 | struct drm_connector *connector; |
|
- | 289 | ||
- | 290 | bool ret = false; |
|
- | 291 | ||
- | 292 | ENTER(); |
|
- | 293 | ||
- | 294 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
|
- | 295 | { |
|
- | 296 | struct drm_display_mode *mode; |
|
- | 297 | ||
- | 298 | struct drm_encoder *encoder; |
|
- | 299 | struct drm_crtc *crtc; |
|
- | 300 | ||
- | 301 | if( connector->status != connector_status_connected) |
|
- | 302 | continue; |
|
- | 303 | ||
- | 304 | encoder = connector->encoder; |
|
- | 305 | if( encoder == NULL) |
|
- | 306 | continue; |
|
- | 307 | ||
- | 308 | crtc = encoder->crtc; |
|
- | 309 | ||
- | 310 | if(crtc == NULL) |
|
- | 311 | continue; |
|
- | 312 | ||
- | 313 | list_for_each_entry(mode, &connector->modes, head) |
|
- | 314 | { |
|
- | 315 | char *con_name, *enc_name; |
|
- | 316 | ||
- | 317 | struct drm_framebuffer *fb; |
|
- | 318 | ||
- | 319 | if (drm_mode_width(mode) == width && |
|
- | 320 | drm_mode_height(mode) == height) |
|
- | 321 | { |
|
- | 322 | char con_edid[128]; |
|
- | 323 | ||
- | 324 | fb = list_first_entry(&dev->mode_config.fb_kernel_list, |
|
- | 325 | struct drm_framebuffer, filp_head); |
|
- | 326 | ||
- | 327 | memcpy(con_edid, connector->edid_blob_ptr->data, 128); |
|
- | 328 | ||
- | 329 | dbgprintf("Manufacturer: %s Model %x Serial Number %u\n", |
|
- | 330 | manufacturer_name(con_edid + 0x08), |
|
- | 331 | (unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)), |
|
- | 332 | (unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8) |
|
- | 333 | + (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24))); |
|
- | 334 | ||
- | 335 | ||
- | 336 | con_name = drm_get_connector_name(connector); |
|
- | 337 | enc_name = drm_get_encoder_name(encoder); |
|
- | 338 | ||
- | 339 | dbgprintf("set mode %d %d connector %s encoder %s\n", |
|
- | 340 | width, height, con_name, enc_name); |
|
- | 341 | ||
- | 342 | fb->width = width; |
|
- | 343 | fb->height = height; |
|
- | 344 | fb->pitch = radeon_align_pitch(dev->dev_private, width, 32, false) * ((32 + 1) / 8); |
|
- | 345 | ||
- | 346 | crtc->fb = fb; |
|
- | 347 | crtc->enabled = true; |
|
- | 348 | rdisplay->crtc = crtc; |
|
- | 349 | ||
- | 350 | ret = drm_crtc_helper_set_mode(crtc, mode, 0, 0, fb); |
|
- | 351 | ||
- | 352 | rdisplay->width = fb->width; |
|
- | 353 | rdisplay->height = fb->height; |
|
- | 354 | rdisplay->pitch = fb->pitch; |
|
- | 355 | ||
- | 356 | sysSetScreen(fb->width, fb->height, fb->pitch); |
|
- | 357 | ||
- | 358 | if (ret == true) |
|
- | 359 | { |
|
- | 360 | dbgprintf("new mode %d %d pitch %d\n",fb->width, fb->height, fb->pitch); |
|
- | 361 | } |
|
- | 362 | else |
|
- | 363 | { |
|
- | 364 | DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
|
- | 365 | fb->width, fb->height, crtc); |
|
- | 366 | }; |
|
- | 367 | ||
- | 368 | LEAVE(); |
|
- | 369 | ||
- | 370 | return ret; |
|
- | 371 | }; |
|
- | 372 | } |
|
- | 373 | }; |
|
- | 374 | LEAVE(); |
|
- | 375 | return ret; |
|
- | 376 | }; |
|
- | 377 | ||
- | 378 | ||
- | 379 | int init_display(struct radeon_device *rdev, mode_t *usermode) |
|
- | 380 | { |
|
- | 381 | cursor_t *cursor; |
|
- | 382 | ||
- | 383 | ENTER(); |
|
- | 384 | ||
- | 385 | rdisplay = GetDisplay(); |
|
- | 386 | ||
- | 387 | rdisplay->ddev = rdev->ddev; |
|
- | 388 | ||
- | 389 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
|
- | 390 | { |
|
- | 391 | init_cursor(cursor); |
|
- | 392 | }; |
|
- | 393 | ||
- | 394 | if( (usermode->width != 0) && |
|
- | 395 | (usermode->height != 0) ) |
|
- | 396 | { |
|
- | 397 | set_mode(rdev->ddev, usermode->width, usermode->height); |
|
- | 398 | } |
|
- | 399 | else |
|
- | 400 | set_mode(rdev->ddev, 800, 600); |
|
- | 401 | ||
- | 402 | select_cursor(rdisplay->cursor); |
|
- | 403 | radeon_show_cursor(rdisplay->crtc); |
|
- | 404 | ||
- | 405 | rdisplay->init_cursor = init_cursor; |
|
- | 406 | rdisplay->select_cursor = select_cursor; |
|
- | 407 | rdisplay->show_cursor = NULL; |
|
- | 408 | rdisplay->move_cursor = move_cursor; |
|
- | 409 | rdisplay->restore_cursor = restore_cursor; |
|
- | 410 | ||
- | 411 | LEAVE(); |
|
- | 412 | ||
- | 413 | return 1; |
|
- | 414 | }; |
|
- | 415 | ||
- | 416 | static int my_atoi(char **cmd) |
|
- | 417 | { |
|
- | 418 | char* p = *cmd; |
|
- | 419 | int val = 0; |
|
- | 420 | ||
- | 421 | for (;; *p++) { |
|
- | 422 | switch (*p) { |
|
- | 423 | case '0' ... '9': |
|
- | 424 | val = 10*val+(*p-'0'); |
|
- | 425 | break; |
|
- | 426 | default: |
|
- | 427 | *cmd = p; |
|
- | 428 | return val; |
|
- | 429 | } |
|
- | 430 | } |
|
- | 431 | } |
|
- | 432 | ||
- | 433 | char* parse_mode(char *p, mode_t *mode) |
|
- | 434 | { |
|
- | 435 | char c; |
|
- | 436 | ||
- | 437 | while( (c = *p++) == ' '); |
|
- | 438 | ||
- | 439 | if( c ) |
|
- | 440 | { |
|
- | 441 | p--; |
|
- | 442 | ||
- | 443 | mode->width = my_atoi(&p); |
|
- | 444 | p++; |
|
- | 445 | ||
- | 446 | mode->height = my_atoi(&p); |
|
- | 447 | p++; |
|
- | 448 | ||
- | 449 | mode->freq = my_atoi(&p); |
|
- | 450 | } |
|
- | 451 | ||
- | 452 | return p; |
|
- | 453 | }; |
|
- | 454 | ||
- | 455 | char* parse_path(char *p, char *log) |
|
- | 456 | { |
|
- | 457 | char c; |
|
- | 458 | ||
- | 459 | while( (c = *p++) == ' '); |
|
- | 460 | p--; |
|
- | 461 | while( (c = *log++ = *p++) && (c != ' ')); |
|
- | 462 | *log = 0; |
|
- | 463 | ||
- | 464 | return p; |
|
- | 465 | }; |
|
- | 466 | ||
- | 467 | void parse_cmdline(char *cmdline, mode_t *mode, char *log) |
|
- | 468 | { |
|
- | 469 | char *p = cmdline; |
|
- | 470 | ||
- | 471 | char c = *p++; |
|
- | 472 | ||
- | 473 | while( c ) |
|
- | 474 | { |
|
- | 475 | if( c == '-') |
|
- | 476 | { |
|
- | 477 | switch(*p++) |
|
- | 478 | { |
|
- | 479 | case 'm': |
|
- | 480 | p = parse_mode(p, mode); |
|
- | 481 | break; |
|
- | 482 | ||
- | 483 | case 'l': |
|
- | 484 | p = parse_path(p, log); |
|
- | 485 | break; |
|
- | 486 | }; |
|
- | 487 | }; |
|
- | 488 | c = *p++; |
|
- | 489 | }; |
|
- | 490 | };><>><>><>><>><>><>><>><>><>><>><>=>><>><>>>>> |