summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2011-08-24 14:07:06 +0800
committerChia-I Wu <olvaffe@gmail.com>2011-08-24 14:52:40 +0800
commitdb29afe66e49efc4f28016154ca46541fd640359 (patch)
tree9032f4a3403eb39acc588aa550be0c8a1a2df028
parent64591d8f71b902b32d07122e91a1e1a3129dab61 (diff)
downloadexternal_drm_gralloc-db29afe66e49efc4f28016154ca46541fd640359.zip
external_drm_gralloc-db29afe66e49efc4f28016154ca46541fd640359.tar.gz
external_drm_gralloc-db29afe66e49efc4f28016154ca46541fd640359.tar.bz2
vmwgfx: assorted fixes
Based on trial and error, we know - drm_kms_wait_for_post() hangs the VM - drmModeDirtyFB() should be called whenever the front buffer changes - drmModePageFlip() is not supported They might not be entirely correct, but fixing them makes drm_gralloc work.
-rw-r--r--Android.mk2
-rw-r--r--gralloc_drm_kms.c9
-rw-r--r--gralloc_drm_pipe.c17
-rw-r--r--gralloc_drm_priv.h2
4 files changed, 24 insertions, 6 deletions
diff --git a/Android.mk b/Android.mk
index 6f154cd..f2ec111 100644
--- a/Android.mk
+++ b/Android.mk
@@ -138,6 +138,8 @@ LOCAL_CFLAGS += -DENABLE_PIPE_VMWGFX
LOCAL_STATIC_LIBRARIES += \
libmesa_pipe_svga \
libmesa_winsys_svga
+LOCAL_C_INCLUDES += \
+ external/mesa/src/gallium/drivers/svga/include
endif
LOCAL_STATIC_LIBRARIES += \
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index 6b4a63d..9dc917b 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -85,10 +85,8 @@ static int drm_kms_set_crtc(struct gralloc_drm_t *drm, int fb_id)
return ret;
}
-#ifdef DRM_MODE_FEATURE_DIRTYFB
- if (drm->mode_dirty_fb)
+ if (drm->mode_quirk_vmwgfx)
ret = drmModeDirtyFB(drm->fd, fb_id, &drm->clip, 1);
-#endif
return ret;
}
@@ -150,6 +148,9 @@ static void drm_kms_wait_for_post(struct gralloc_drm_t *drm, int flip)
drmVBlank vbl;
int ret;
+ if (drm->mode_quirk_vmwgfx)
+ return;
+
flip = !!flip;
memset(&vbl, 0, sizeof(vbl));
@@ -257,6 +258,8 @@ int gralloc_drm_bo_post(struct gralloc_drm_bo_t *bo)
bo, 0, 0,
bo->handle->width,
bo->handle->height);
+ if (drm->mode_quirk_vmwgfx)
+ ret = drmModeDirtyFB(drm->fd, drm->current_front->fb_id, &drm->clip, 1);
ret = 0;
break;
case DRM_SWAP_SETCRTC:
diff --git a/gralloc_drm_pipe.c b/gralloc_drm_pipe.c
index ff07c0f..2b39815 100644
--- a/gralloc_drm_pipe.c
+++ b/gralloc_drm_pipe.c
@@ -346,8 +346,14 @@ static void pipe_init_kms_features(struct gralloc_drm_drv_t *drv, struct gralloc
break;
}
- drm->mode_dirty_fb = (strcmp(pm->driver, "vmwgfx") == 0);
- drm->swap_mode = DRM_SWAP_FLIP;
+ if (strcmp(pm->driver, "vmwgfx") == 0) {
+ drm->mode_quirk_vmwgfx = 1;
+ drm->swap_mode = DRM_SWAP_COPY;
+ }
+ else {
+ drm->mode_quirk_vmwgfx = 0;
+ drm->swap_mode = DRM_SWAP_FLIP;
+ }
drm->mode_sync_flip = 1;
drm->swap_interval = 1;
drm->vblank_secondary = 0;
@@ -373,6 +379,7 @@ static void pipe_destroy(struct gralloc_drm_drv_t *drv)
#include "r600/r600_public.h"
/* for vmwgfx */
#include "svga/drm/svga_drm_public.h"
+#include "svga/svga_winsys.h"
#include "svga/svga_public.h"
/* for debug */
#include "target-helpers/inline_debug_helper.h"
@@ -463,6 +470,12 @@ static int pipe_get_pci_id(struct pipe_manager *pm,
*device = 0;
err = 0;
}
+ else if (strcmp(name, "vmwgfx") == 0) {
+ *vendor = 0x15ad;
+ /* assume SVGA II */
+ *device = 0x0405;
+ err = 0;
+ }
else {
err = -EINVAL;
}
diff --git a/gralloc_drm_priv.h b/gralloc_drm_priv.h
index ada152d..1da3e4a 100644
--- a/gralloc_drm_priv.h
+++ b/gralloc_drm_priv.h
@@ -56,7 +56,7 @@ struct gralloc_drm_t {
int fb_format;
enum drm_swap_mode swap_mode;
int swap_interval;
- int mode_dirty_fb;
+ int mode_quirk_vmwgfx;
int mode_sync_flip; /* page flip should block */
int vblank_secondary;