summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/vmware/xorg
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-12-14 22:11:17 +0100
committerJakob Bornecrantz <jakob@vmware.com>2009-12-14 22:12:20 +0100
commitfb06d8f0977b19068d65daca88f58da09ed13b5c (patch)
treeee15e594695c72be93ff20960a86bcf22f3afee2 /src/gallium/winsys/drm/vmware/xorg
parent69346c56a17ba9a74b7f2226c0b4d5ce0bbb1f15 (diff)
vmware/xorg: Use new stream ioctl
Diffstat (limited to 'src/gallium/winsys/drm/vmware/xorg')
-rw-r--r--src/gallium/winsys/drm/vmware/xorg/vmw_driver.h11
-rw-r--r--src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c56
-rw-r--r--src/gallium/winsys/drm/vmware/xorg/vmw_video.c13
3 files changed, 73 insertions, 7 deletions
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
index 7265f767a5..3efe851a4b 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
@@ -73,8 +73,6 @@ void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
* vmw_ioctl.c
*/
-int vmw_ioctl_supports_overlay(struct vmw_driver *vmw);
-
int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot);
struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw,
@@ -90,5 +88,14 @@ void vmw_ioctl_buffer_unmap(struct vmw_driver *vmw,
void vmw_ioctl_buffer_destroy(struct vmw_driver *vmw,
struct vmw_dma_buffer *buf);
+int vmw_ioctl_supports_streams(struct vmw_driver *vmw);
+
+int vmw_ioctl_num_streams(struct vmw_driver *vmw,
+ uint32_t *ntot, uint32_t *nfree);
+
+int vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id);
+
+int vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out);
+
#endif
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
index 0d1a0fcee6..ab2b5fadc4 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
@@ -75,12 +75,12 @@ vmw_ioctl_get_param(struct vmw_driver *vmw, uint32_t param, uint64_t *out)
}
int
-vmw_ioctl_supports_overlay(struct vmw_driver *vmw)
+vmw_ioctl_supports_streams(struct vmw_driver *vmw)
{
uint64_t value;
int ret;
- ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_OVERLAY_IOCTL, &value);
+ ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_STREAMS, &value);
if (ret)
return ret;
@@ -88,6 +88,58 @@ vmw_ioctl_supports_overlay(struct vmw_driver *vmw)
}
int
+vmw_ioctl_num_streams(struct vmw_driver *vmw,
+ uint32_t *ntot, uint32_t *nfree)
+{
+ uint64_t v1, v2;
+ int ret;
+
+ ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_STREAMS, &v1);
+ if (ret)
+ return ret;
+
+ ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_FREE_STREAMS, &v2);
+ if (ret)
+ return ret;
+
+ *ntot = (uint32_t)v1;
+ *nfree = (uint32_t)v2;
+
+ return 0;
+}
+
+int
+vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out)
+{
+ struct drm_vmw_stream_arg s_arg;
+ int ret;
+
+ ret = drmCommandRead(vmw->fd, DRM_VMW_CLAIM_STREAM,
+ &s_arg, sizeof(s_arg));
+
+ if (ret)
+ return -1;
+
+ *out = s_arg.stream_id;
+ return 0;
+}
+
+int
+vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id)
+{
+ struct drm_vmw_stream_arg s_arg;
+ int ret;
+
+ memset(&s_arg, 0, sizeof(s_arg));
+ s_arg.stream_id = stream_id;
+
+ ret = drmCommandRead(vmw->fd, DRM_VMW_CLAIM_STREAM,
+ &s_arg, sizeof(s_arg));
+
+ return 0;
+}
+
+int
vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot)
{
struct drm_vmw_cursor_bypass_arg arg;
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
index 5674e4f352..c0a7ac9e45 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
@@ -273,11 +273,17 @@ vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL;
XF86VideoAdaptorPtr newAdaptor = NULL;
int numAdaptors;
+ unsigned int ntot, nfree;
debug_printf("%s: enter\n", __func__);
- if (vmw_ioctl_supports_overlay(vmw) != 0) {
- debug_printf("No overlay ioctl support\n");
+ if (vmw_ioctl_num_streams(vmw, &ntot, &nfree) != 0) {
+ debug_printf("No stream ioctl support\n");
+ return FALSE;
+ }
+
+ if (nfree == 0) {
+ debug_printf("No free streams\n");
return FALSE;
}
@@ -353,6 +359,7 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) {
/* make sure the port is stoped as well */
vmw_xv_stop_video(pScrn, &video->port[i], TRUE);
+ vmw_ioctl_unref_stream(vmw, video->port[i].streamId);
}
/* XXX: I'm sure this function is missing code for turning off Xv */
@@ -448,7 +455,7 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
adaptor->pPortPrivates = video->port_ptr;
for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) {
- video->port[i].streamId = i;
+ vmw_ioctl_claim_stream(vmw, &video->port[i].streamId);
video->port[i].play = vmw_video_port_init;
video->port[i].flags = SVGA_VIDEO_FLAG_COLORKEY;
video->port[i].colorKey = VMWARE_VIDEO_COLORKEY;