Subversion Repositories Kolibri OS

Rev

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

Rev 4075 Rev 4080
Line 98... Line 98...
98
}
98
}
Line 99... Line 99...
99
 
99
 
100
/**
100
/**
101
 * Send the fifo command to create a screen.
101
 * Send the fifo command to create a screen.
102
 */
102
 */
103
static int vmw_sou_fifo_create(struct vmw_private *dev_priv,
103
int vmw_sou_fifo_create(struct vmw_private *dev_priv,
104
			       struct vmw_screen_object_unit *sou,
104
			       struct vmw_screen_object_unit *sou,
105
			       uint32_t x, uint32_t y,
105
			       uint32_t x, uint32_t y,
106
			       struct drm_display_mode *mode)
106
			       struct drm_display_mode *mode)
107
{
107
{
Line 112... Line 112...
112
			uint32_t cmdType;
112
			uint32_t cmdType;
113
		} header;
113
		} header;
114
		SVGAScreenObject obj;
114
		SVGAScreenObject obj;
115
	} *cmd;
115
	} *cmd;
Line 116... Line 116...
116
 
116
 
-
 
117
//   BUG_ON(!sou->buffer);
-
 
118
 
Line 117... Line 119...
117
	BUG_ON(!sou->buffer);
119
    ENTER();
118
 
120
 
119
	fifo_size = sizeof(*cmd);
121
	fifo_size = sizeof(*cmd);
120
	cmd = vmw_fifo_reserve(dev_priv, fifo_size);
122
	cmd = vmw_fifo_reserve(dev_priv, fifo_size);
Line 139... Line 141...
139
		cmd->obj.root.x = sou->base.gui_x;
141
		cmd->obj.root.x = sou->base.gui_x;
140
		cmd->obj.root.y = sou->base.gui_y;
142
		cmd->obj.root.y = sou->base.gui_y;
141
	}
143
	}
Line 142... Line 144...
142
 
144
 
143
	/* Ok to assume that buffer is pinned in vram */
145
	/* Ok to assume that buffer is pinned in vram */
-
 
146
//   vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr);
-
 
147
 
-
 
148
    cmd->obj.backingStore.ptr.gmrId = SVGA_GMR_FRAMEBUFFER;
144
	vmw_bo_get_guest_ptr(&sou->buffer->base, &cmd->obj.backingStore.ptr);
149
    cmd->obj.backingStore.ptr.offset = 0;
Line 145... Line 150...
145
	cmd->obj.backingStore.pitch = mode->hdisplay * 4;
150
	cmd->obj.backingStore.pitch = mode->hdisplay * 4;
Line 146... Line 151...
146
 
151
 
Line -... Line 152...
-
 
152
	vmw_fifo_commit(dev_priv, fifo_size);
-
 
153
 
147
	vmw_fifo_commit(dev_priv, fifo_size);
154
	sou->defined = true;
148
 
155
 
Line 149... Line 156...
149
	sou->defined = true;
156
    LEAVE();
150
 
157
 
Line 435... Line 442...
435
	struct drm_device *dev = dev_priv->dev;
442
	struct drm_device *dev = dev_priv->dev;
436
	struct drm_connector *connector;
443
	struct drm_connector *connector;
437
	struct drm_encoder *encoder;
444
	struct drm_encoder *encoder;
438
	struct drm_crtc *crtc;
445
	struct drm_crtc *crtc;
Line -... Line 446...
-
 
446
 
-
 
447
    ENTER();
439
 
448
 
440
	sou = kzalloc(sizeof(*sou), GFP_KERNEL);
449
	sou = kzalloc(sizeof(*sou), GFP_KERNEL);
441
	if (!sou)
450
	if (!sou)
Line 442... Line 451...
442
		return -ENOMEM;
451
		return -ENOMEM;
Line 469... Line 478...
469
	drm_mode_crtc_set_gamma_size(crtc, 256);
478
	drm_mode_crtc_set_gamma_size(crtc, 256);
Line 470... Line 479...
470
 
479
 
471
	drm_object_attach_property(&connector->base,
480
	drm_object_attach_property(&connector->base,
472
				      dev->mode_config.dirty_info_property,
481
				      dev->mode_config.dirty_info_property,
473
				      1);
482
				      1);
474
 
483
    LEAVE();
475
	return 0;
484
	return 0;
Line 476... Line 485...
476
}
485
}
477
 
486
 
Line 570... Line 579...
570
	BUG_ON(!sou->base.is_implicit);
579
	BUG_ON(!sou->base.is_implicit);
Line 571... Line 580...
571
 
580
 
572
	dev_priv->sou_priv->implicit_fb =
581
	dev_priv->sou_priv->implicit_fb =
573
		vmw_framebuffer_to_vfb(sou->base.crtc.fb);
582
		vmw_framebuffer_to_vfb(sou->base.crtc.fb);
-
 
583
}
-
 
584
 
-
 
585
#include "bitmap.h"
-
 
586
 
-
 
587
typedef struct
-
 
588
{
-
 
589
    kobj_t     header;
-
 
590
 
-
 
591
    uint32_t  *data;
-
 
592
    uint32_t   hot_x;
-
 
593
    uint32_t   hot_y;
-
 
594
 
-
 
595
    struct list_head   list;
-
 
596
//    struct drm_i915_gem_object  *cobj;
-
 
597
}cursor_t;
-
 
598
 
-
 
599
 
-
 
600
struct tag_display
-
 
601
{
-
 
602
    int  x;
-
 
603
    int  y;
-
 
604
    int  width;
-
 
605
    int  height;
-
 
606
    int  bpp;
-
 
607
    int  vrefresh;
-
 
608
    int  pitch;
-
 
609
    int  lfb;
-
 
610
 
-
 
611
    int  supported_modes;
-
 
612
    struct drm_device    *ddev;
-
 
613
    struct drm_connector *connector;
-
 
614
    struct drm_crtc      *crtc;
-
 
615
 
-
 
616
    struct list_head   cursors;
-
 
617
 
-
 
618
    cursor_t   *cursor;
-
 
619
    int       (*init_cursor)(cursor_t*);
-
 
620
    cursor_t* (__stdcall *select_cursor)(cursor_t*);
-
 
621
    void      (*show_cursor)(int show);
-
 
622
    void      (__stdcall *move_cursor)(cursor_t *cursor, int x, int y);
-
 
623
    void      (__stdcall *restore_cursor)(int x, int y);
-
 
624
    void      (*disable_mouse)(void);
-
 
625
    u32  mask_seqno;
-
 
626
    u32  check_mouse;
-
 
627
    u32  check_m_pixel;
-
 
628
    u32  dirty;
-
 
629
    void (*update)(void);
-
 
630
};
-
 
631
 
-
 
632
extern struct drm_device *main_device;
-
 
633
 
-
 
634
bool set_mode(struct drm_device *dev, struct drm_connector *connector,
-
 
635
              videomode_t *reqmode, bool strict)
-
 
636
{
-
 
637
    struct drm_display_mode  *mode = NULL, *tmpmode;
-
 
638
    struct vmw_private *dev_priv = vmw_priv(main_device);
-
 
639
    struct vmw_screen_object_unit *sou;
-
 
640
    display_t *os_display;
-
 
641
 
-
 
642
    bool ret = false;
-
 
643
 
-
 
644
    ENTER();
-
 
645
 
-
 
646
//    dbgprintf("width %d height %d vrefresh %d\n",
-
 
647
//               reqmode->width, reqmode->height, reqmode->freq);
-
 
648
 
-
 
649
    list_for_each_entry(tmpmode, &connector->modes, head)
-
 
650
    {
-
 
651
        if( (drm_mode_width(tmpmode)    == reqmode->width)  &&
-
 
652
            (drm_mode_height(tmpmode)   == reqmode->height) &&
-
 
653
            (drm_mode_vrefresh(tmpmode) == reqmode->freq) )
-
 
654
        {
-
 
655
            mode = tmpmode;
-
 
656
            goto do_set;
-
 
657
        }
-
 
658
    };
-
 
659
 
-
 
660
    if( (mode == NULL) && (strict == false) )
-
 
661
    {
-
 
662
        list_for_each_entry(tmpmode, &connector->modes, head)
-
 
663
        {
-
 
664
            if( (drm_mode_width(tmpmode)  == reqmode->width)  &&
-
 
665
                (drm_mode_height(tmpmode) == reqmode->height) )
-
 
666
            {
-
 
667
                mode = tmpmode;
-
 
668
                goto do_set;
-
 
669
            }
-
 
670
        };
-
 
671
    };
-
 
672
 
-
 
673
do_set:
-
 
674
 
-
 
675
    if( mode != NULL )
-
 
676
    {
-
 
677
        struct drm_framebuffer   *fb;
-
 
678
        struct drm_encoder       *encoder;
-
 
679
        struct drm_crtc          *crtc;
-
 
680
 
-
 
681
//        char  con_edid[128];
-
 
682
        const char *con_name;
-
 
683
        const char *enc_name;
-
 
684
 
-
 
685
        encoder = connector->encoder;
-
 
686
        crtc = encoder->crtc;
-
 
687
 
-
 
688
 
-
 
689
//        fb = list_first_entry(&dev->mode_config.fb_kernel_list,
-
 
690
//                              struct drm_framebuffer, filp_head);
-
 
691
 
-
 
692
//        memcpy(con_edid, connector->edid_blob_ptr->data, 128);
-
 
693
 
-
 
694
//        dbgprintf("Manufacturer: %s Model %x Serial Number %u\n",
-
 
695
//        manufacturer_name(con_edid + 0x08),
-
 
696
//        (unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)),
-
 
697
//        (unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8)
-
 
698
//            + (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24)));
-
 
699
 
-
 
700
        con_name = drm_get_connector_name(connector);
-
 
701
        enc_name = drm_get_encoder_name(encoder);
-
 
702
 
-
 
703
        dbgprintf("set mode %d %d connector %s encoder %s\n",
-
 
704
                   mode->hdisplay, mode->vdisplay, con_name, enc_name);
-
 
705
 
-
 
706
        os_display = GetDisplay();
-
 
707
 
-
 
708
#if 0
-
 
709
        sou = vmw_crtc_to_sou(crtc);
-
 
710
        sou->defined = true;
-
 
711
 
-
 
712
        ret = vmw_sou_fifo_destroy(dev_priv, sou);
-
 
713
        if (unlikely(ret != 0))
-
 
714
            return ret;
-
 
715
 
-
 
716
        ret = vmw_sou_fifo_create(dev_priv, sou, 0, 0, mode);
-
 
717
 
-
 
718
#else   /*   sledgehammer  */
-
 
719
 
-
 
720
        vmw_write(dev_priv,SVGA_REG_WIDTH,  mode->hdisplay);
-
 
721
        vmw_write(dev_priv,SVGA_REG_HEIGHT, mode->vdisplay);
-
 
722
        vmw_write(dev_priv,SVGA_REG_BITS_PER_PIXEL, 32);
-
 
723
        ret = 0;
-
 
724
#endif
-
 
725
        if (ret == 0)
-
 
726
        {
-
 
727
            os_display->width    = mode->hdisplay;
-
 
728
            os_display->height   = mode->vdisplay;
-
 
729
            os_display->pitch    = mode->hdisplay*4;
-
 
730
            os_display->vrefresh = drm_mode_vrefresh(mode);
-
 
731
 
-
 
732
            sysSetScreen(os_display->width, os_display->height, os_display->pitch);
-
 
733
 
-
 
734
            dbgprintf("new mode %d x %d pitch %d\n",
-
 
735
                       os_display->width, os_display->height, os_display->pitch);
-
 
736
        }
-
 
737
        else
-
 
738
            DRM_ERROR("failed to set mode %d_%d on crtc %p\n",
-
 
739
                       os_display->width, os_display->height, crtc);
-
 
740
    }
-
 
741
 
-
 
742
    LEAVE();
-
 
743
    return ret;