Subversion Repositories Kolibri OS

Rev

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

Rev 4569 Rev 4570
Line 38... Line 38...
38
 
38
 
39
/**
39
/**
40
 * Clip @num_rects number of @rects against @clip storing the
40
 * Clip @num_rects number of @rects against @clip storing the
41
 * results in @out_rects and the number of passed rects in @out_num.
41
 * results in @out_rects and the number of passed rects in @out_num.
42
 */
42
 */
43
void vmw_clip_cliprects(struct drm_clip_rect *rects,
43
static void vmw_clip_cliprects(struct drm_clip_rect *rects,
44
			int num_rects,
44
			int num_rects,
45
			struct vmw_clip_rect clip,
45
			struct vmw_clip_rect clip,
46
			SVGASignedRect *out_rects,
46
			SVGASignedRect *out_rects,
47
			int *out_num)
47
			int *out_num)
Line 78... Line 78...
78
	drm_crtc_cleanup(&du->crtc);
78
	drm_crtc_cleanup(&du->crtc);
79
	drm_encoder_cleanup(&du->encoder);
79
	drm_encoder_cleanup(&du->encoder);
80
	drm_connector_cleanup(&du->connector);
80
	drm_connector_cleanup(&du->connector);
81
}
81
}
Line 82... Line -...
82
 
-
 
83
#if 0
82
 
84
/*
83
/*
85
 * Display Unit Cursor functions
84
 * Display Unit Cursor functions
Line 86... Line 85...
86
 */
85
 */
Line 93... Line 92...
93
		u32 cmd;
92
		u32 cmd;
94
		SVGAFifoCmdDefineAlphaCursor cursor;
93
		SVGAFifoCmdDefineAlphaCursor cursor;
95
	} *cmd;
94
	} *cmd;
96
	u32 image_size = width * height * 4;
95
	u32 image_size = width * height * 4;
97
	u32 cmd_size = sizeof(*cmd) + image_size;
96
	u32 cmd_size = sizeof(*cmd) + image_size;
-
 
97
    u32 *dst;
-
 
98
    int i, j;
Line 98... Line 99...
98
 
99
 
99
	if (!image)
100
	if (!image)
Line 100... Line 101...
100
		return -EINVAL;
101
		return -EINVAL;
Line 105... Line 106...
105
		return -ENOMEM;
106
		return -ENOMEM;
106
	}
107
	}
Line 107... Line 108...
107
 
108
 
Line -... Line 109...
-
 
109
	memset(cmd, 0, sizeof(*cmd));
-
 
110
 
-
 
111
    dst = (u32*)&cmd[1];
-
 
112
 
-
 
113
    for(i = 0; i < 32; i++)
-
 
114
    {
-
 
115
        for(j = 0; j < 32; j++)
-
 
116
            *dst++ = *image++;
-
 
117
        for( ; j < 64; j++)
108
	memset(cmd, 0, sizeof(*cmd));
118
            *dst++ = 0;
-
 
119
    }
Line 109... Line 120...
109
 
120
    for(i = 0; i < 64*(64-32); i++)
110
	memcpy(&cmd[1], image, image_size);
121
        *image++ = 0;
111
 
122
 
112
	cmd->cmd = cpu_to_le32(SVGA_CMD_DEFINE_ALPHA_CURSOR);
123
	cmd->cmd = cpu_to_le32(SVGA_CMD_DEFINE_ALPHA_CURSOR);
Line 119... Line 130...
119
	vmw_fifo_commit(dev_priv, cmd_size);
130
	vmw_fifo_commit(dev_priv, cmd_size);
Line 120... Line 131...
120
 
131
 
121
	return 0;
132
	return 0;
Line -... Line 133...
-
 
133
}
122
}
134
 
123
 
135
#if 0
124
int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv,
136
int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv,
125
			     struct vmw_dma_buffer *dmabuf,
137
			     struct vmw_dma_buffer *dmabuf,
126
			     u32 width, u32 height,
138
			     u32 width, u32 height,
Line 154... Line 166...
154
err_unreserve:
166
err_unreserve:
155
	ttm_bo_unreserve(&dmabuf->base);
167
	ttm_bo_unreserve(&dmabuf->base);
Line 156... Line 168...
156
 
168
 
157
	return ret;
169
	return ret;
158
}
170
}
Line 159... Line 171...
159
 
171
#endif
160
 
172
 
161
void vmw_cursor_update_position(struct vmw_private *dev_priv,
173
void vmw_cursor_update_position(struct vmw_private *dev_priv,
162
				bool show, int x, int y)
174
				bool show, int x, int y)
Line 169... Line 181...
169
	iowrite32(y, fifo_mem + SVGA_FIFO_CURSOR_Y);
181
	iowrite32(y, fifo_mem + SVGA_FIFO_CURSOR_Y);
170
	count = ioread32(fifo_mem + SVGA_FIFO_CURSOR_COUNT);
182
	count = ioread32(fifo_mem + SVGA_FIFO_CURSOR_COUNT);
171
	iowrite32(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT);
183
	iowrite32(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT);
172
}
184
}
Line -... Line 185...
-
 
185
 
173
 
186
#if 0
174
int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
187
int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
175
			   uint32_t handle, uint32_t width, uint32_t height)
188
			   uint32_t handle, uint32_t width, uint32_t height)
176
{
189
{
177
	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
190
	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
Line 422... Line 435...
422
	struct vmw_dma_buffer *buffer;
435
	struct vmw_dma_buffer *buffer;
423
	struct list_head head;
436
	struct list_head head;
424
	struct drm_master *master;
437
	struct drm_master *master;
425
};
438
};
Line 426... Line 439...
426
 
439
 
427
void vmw_framebuffer_surface_destroy(struct drm_framebuffer *framebuffer)
440
static void vmw_framebuffer_surface_destroy(struct drm_framebuffer *framebuffer)
428
{
441
{
429
	struct vmw_framebuffer_surface *vfbs =
442
	struct vmw_framebuffer_surface *vfbs =
430
		vmw_framebuffer_to_vfbs(framebuffer);
443
		vmw_framebuffer_to_vfbs(framebuffer);
Line 431... Line 444...
431
//   struct vmw_master *vmaster = vmw_master(vfbs->master);
444
	struct vmw_master *vmaster = vmw_master(vfbs->master);
432
 
445
 
433
 
446
 
Line 434... Line -...
434
//   mutex_lock(&vmaster->fb_surf_mutex);
-
 
435
//   list_del(&vfbs->head);
-
 
436
//   mutex_unlock(&vmaster->fb_surf_mutex);
-
 
437
 
-
 
Line 438... Line 447...
438
//   drm_master_put(&vfbs->master);
447
	mutex_lock(&vmaster->fb_surf_mutex);
439
//   drm_framebuffer_cleanup(framebuffer);
448
	list_del(&vfbs->head);
Line 440... Line 449...
440
//   vmw_surface_unreference(&vfbs->surface);
449
	mutex_unlock(&vmaster->fb_surf_mutex);
Line 588... Line 597...
588
	kfree(tmp);
597
	kfree(tmp);
Line 589... Line 598...
589
 
598
 
590
	return ret;
599
	return ret;
Line 591... Line 600...
591
}
600
}
592
 
601
 
593
int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
602
static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
594
				  struct drm_file *file_priv,
603
				  struct drm_file *file_priv,
595
				  unsigned flags, unsigned color,
604
				  unsigned flags, unsigned color,
596
				  struct drm_clip_rect *clips,
605
				  struct drm_clip_rect *clips,
597
				  unsigned num_clips)
606
				  unsigned num_clips)
598
{
607
{
599
	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
608
	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
600
//   struct vmw_master *vmaster = vmw_master(file_priv->master);
609
	struct vmw_master *vmaster = vmw_master(file_priv->master);
601
	struct vmw_framebuffer_surface *vfbs =
610
	struct vmw_framebuffer_surface *vfbs =
602
		vmw_framebuffer_to_vfbs(framebuffer);
611
		vmw_framebuffer_to_vfbs(framebuffer);
Line 603... Line 612...
603
	struct drm_clip_rect norect;
612
	struct drm_clip_rect norect;
604
	int ret, inc = 1;
613
	int ret, inc = 1;
Line 605... Line 614...
605
 
614
 
606
//   if (unlikely(vfbs->master != file_priv->master))
615
	if (unlikely(vfbs->master != file_priv->master))
607
//       return -EINVAL;
616
		return -EINVAL;
Line -... Line 617...
-
 
617
 
-
 
618
	/* Require ScreenObject support for 3D */
608
 
619
	if (!dev_priv->sou_priv)
609
	/* Require ScreenObject support for 3D */
620
		return -EINVAL;
-
 
621
 
610
	if (!dev_priv->sou_priv)
622
	drm_modeset_lock_all(dev_priv->dev);
-
 
623
 
Line 611... Line 624...
611
		return -EINVAL;
624
	ret = ttm_read_lock(&vmaster->lock, true);
612
 
625
	if (unlikely(ret != 0)) {
613
//   ret = ttm_read_lock(&vmaster->lock, true);
626
		drm_modeset_unlock_all(dev_priv->dev);
614
//   if (unlikely(ret != 0))
627
		return ret;
Line 627... Line 640...
627
 
640
 
628
	ret = do_surface_dirty_sou(dev_priv, file_priv, &vfbs->base,
641
	ret = do_surface_dirty_sou(dev_priv, file_priv, &vfbs->base,
629
				   flags, color,
642
				   flags, color,
Line 630... Line 643...
630
				   clips, num_clips, inc, NULL);
643
				   clips, num_clips, inc, NULL);
-
 
644
 
-
 
645
	ttm_read_unlock(&vmaster->lock);
-
 
646
 
631
 
647
	drm_modeset_unlock_all(dev_priv->dev);
632
//   ttm_read_unlock(&vmaster->lock);
648
 
Line 633... Line 649...
633
	return 0;
649
	return 0;
634
}
650
}
Line 647... Line 663...
647
 
663
 
648
{
664
{
649
	struct drm_device *dev = dev_priv->dev;
665
	struct drm_device *dev = dev_priv->dev;
650
	struct vmw_framebuffer_surface *vfbs;
666
	struct vmw_framebuffer_surface *vfbs;
651
	enum SVGA3dSurfaceFormat format;
667
	enum SVGA3dSurfaceFormat format;
652
//   struct vmw_master *vmaster = vmw_master(file_priv->master);
668
	struct vmw_master *vmaster = vmw_master(file_priv->master);
Line 653... Line 669...
653
	int ret;
669
	int ret;
654
 
670
 
655
	/* 3D is only supported on HWv8 hosts which supports screen objects */
671
	/* 3D is only supported on HWv8 hosts which supports screen objects */
Line 720... Line 736...
720
	vfbs->base.base.height = mode_cmd->height;
736
	vfbs->base.base.height = mode_cmd->height;
721
	vfbs->surface = surface;
737
	vfbs->surface = surface;
722
	vfbs->base.user_handle = mode_cmd->handle;
738
	vfbs->base.user_handle = mode_cmd->handle;
723
//   vfbs->master = drm_master_get(file_priv->master);
739
//   vfbs->master = drm_master_get(file_priv->master);
Line 724... Line 740...
724
 
740
 
725
//   mutex_lock(&vmaster->fb_surf_mutex);
741
	mutex_lock(&vmaster->fb_surf_mutex);
726
//   list_add_tail(&vfbs->head, &vmaster->fb_surf);
742
	list_add_tail(&vfbs->head, &vmaster->fb_surf);
Line 727... Line 743...
727
//   mutex_unlock(&vmaster->fb_surf_mutex);
743
	mutex_unlock(&vmaster->fb_surf_mutex);
Line 728... Line 744...
728
 
744
 
729
	*out = &vfbs->base;
745
	*out = &vfbs->base;
Line 753... Line 769...
753
struct vmw_framebuffer_dmabuf {
769
struct vmw_framebuffer_dmabuf {
754
	struct vmw_framebuffer base;
770
	struct vmw_framebuffer base;
755
	struct vmw_dma_buffer *buffer;
771
	struct vmw_dma_buffer *buffer;
756
};
772
};
Line 757... Line 773...
757
 
773
 
758
void vmw_framebuffer_dmabuf_destroy(struct drm_framebuffer *framebuffer)
774
static void vmw_framebuffer_dmabuf_destroy(struct drm_framebuffer *framebuffer)
759
{
775
{
760
	struct vmw_framebuffer_dmabuf *vfbd =
776
	struct vmw_framebuffer_dmabuf *vfbd =
Line 761... Line 777...
761
		vmw_framebuffer_to_vfbd(framebuffer);
777
		vmw_framebuffer_to_vfbd(framebuffer);
Line 939... Line 955...
939
	kfree(blits);
955
	kfree(blits);
Line 940... Line 956...
940
 
956
 
941
	return ret;
957
	return ret;
Line 942... Line 958...
942
}
958
}
943
 
959
 
944
int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
960
static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
945
				 struct drm_file *file_priv,
961
				 struct drm_file *file_priv,
946
				 unsigned flags, unsigned color,
962
				 unsigned flags, unsigned color,
947
				 struct drm_clip_rect *clips,
963
				 struct drm_clip_rect *clips,
948
				 unsigned num_clips)
964
				 unsigned num_clips)
949
{
965
{
950
	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
966
	struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
951
//   struct vmw_master *vmaster = vmw_master(file_priv->master);
967
	struct vmw_master *vmaster = vmw_master(file_priv->master);
952
	struct vmw_framebuffer_dmabuf *vfbd =
968
	struct vmw_framebuffer_dmabuf *vfbd =
953
		vmw_framebuffer_to_vfbd(framebuffer);
969
		vmw_framebuffer_to_vfbd(framebuffer);
Line -... Line 970...
-
 
970
	struct drm_clip_rect norect;
-
 
971
	int ret, increment = 1;
954
	struct drm_clip_rect norect;
972
 
955
	int ret, increment = 1;
973
	drm_modeset_lock_all(dev_priv->dev);
-
 
974
 
956
 
975
	ret = ttm_read_lock(&vmaster->lock, true);
-
 
976
	if (unlikely(ret != 0)) {
Line 957... Line 977...
957
//   ret = ttm_read_lock(&vmaster->lock, true);
977
		drm_modeset_unlock_all(dev_priv->dev);
958
//   if (unlikely(ret != 0))
978
		return ret;
959
//       return ret;
979
	}
960
 
980
 
Line 977... Line 997...
977
		ret = do_dmabuf_dirty_sou(file_priv, dev_priv, &vfbd->base,
997
		ret = do_dmabuf_dirty_sou(file_priv, dev_priv, &vfbd->base,
978
					  flags, color,
998
					  flags, color,
979
					  clips, num_clips, increment, NULL);
999
					  clips, num_clips, increment, NULL);
980
	}
1000
	}
Line 981... Line 1001...
981
 
1001
 
-
 
1002
	ttm_read_unlock(&vmaster->lock);
-
 
1003
 
-
 
1004
	drm_modeset_unlock_all(dev_priv->dev);
982
//   ttm_read_unlock(&vmaster->lock);
1005
 
983
	return ret;
1006
	return ret;
Line 984... Line 1007...
984
}
1007
}
985
 
1008
 
Line 1670... Line 1693...
1670
 
1693
 
1671
/*
1694
/*
1672
 * Small shared kms functions.
1695
 * Small shared kms functions.
Line 1673... Line 1696...
1673
 */
1696
 */
1674
 
1697
 
1675
int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
1698
static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num,
1676
			 struct drm_vmw_rect *rects)
1699
			 struct drm_vmw_rect *rects)
1677
{
1700
{
1678
	struct drm_device *dev = dev_priv->dev;
1701
	struct drm_device *dev = dev_priv->dev;
Line 1715... Line 1738...
1715
}
1738
}
Line 1716... Line 1739...
1716
 
1739
 
1717
#if 0
1740
#if 0
1718
int vmw_du_page_flip(struct drm_crtc *crtc,
1741
int vmw_du_page_flip(struct drm_crtc *crtc,
1719
		     struct drm_framebuffer *fb,
1742
		     struct drm_framebuffer *fb,
-
 
1743
		     struct drm_pending_vblank_event *event,
1720
		     struct drm_pending_vblank_event *event)
1744
		     uint32_t page_flip_flags)
1721
{
1745
{
1722
	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
1746
	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
1723
	struct drm_framebuffer *old_fb = crtc->fb;
1747
	struct drm_framebuffer *old_fb = crtc->fb;
1724
	struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(fb);
1748
	struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(fb);