[pkg-fso-commits] [SCM] xf86-video-glamo, SMedia Glamo video driver for X.Org branch, master, updated. upstream/0.0.0+20100630.git16af3c00-2-gcb9ed17

Thomas White taw at bitwiz.org.uk
Sat Aug 27 16:15:44 UTC 2011


The following commit has been merged in the master branch:
commit 797a16b6b053803640cfe94465cddc07fcb045ee
Author: Martin Jansa <Martin.Jansa at gmail.com>
Date:   Fri Oct 29 11:19:08 2010 +0200

    glamo-drm: define GLAMO_CMDQ_MAX_COUNT instead of magic constant 1024
    
    * fix check for full queue, because size != count here
    * make sure we have enough space in queue for 2 resp. 4 more commands in
      GlamoDRMAddCommand resp. GlamoDRMAddCommandBO
    
    Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
    Signed-off-by: Thomas White <taw at bitwiz.org.uk>

diff --git a/src/glamo-drm.c b/src/glamo-drm.c
index aac93bb..01e8510 100644
--- a/src/glamo-drm.c
+++ b/src/glamo-drm.c
@@ -32,6 +32,8 @@
 
 #include "glamo.h"
 
+/* How many commands can be stored before forced dispatch */
+#define GLAMO_CMDQ_MAX_COUNT 1024
 
 /* Submit the prepared command sequence to the kernel */
 void GlamoDRMDispatch(GlamoPtr pGlamo)
@@ -60,7 +62,7 @@ void GlamoDRMDispatch(GlamoPtr pGlamo)
 
 void GlamoDRMAddCommand(GlamoPtr pGlamo, uint16_t reg, uint16_t val)
 {
-	if ( pGlamo->cmdq_drm_used == pGlamo->cmdq_drm_size ) {
+	if ( pGlamo->cmdq_drm_used >= GLAMO_CMDQ_MAX_COUNT - 2 ) {
 		xf86DrvMsg(pGlamo->pScreen->myNum, X_INFO,
 		           "Forced command cache flush.\n");
 		GlamoDRMDispatch(pGlamo);
@@ -74,7 +76,8 @@ void GlamoDRMAddCommand(GlamoPtr pGlamo, uint16_t reg, uint16_t val)
 
 void GlamoDRMAddCommandBO(GlamoPtr pGlamo, uint16_t reg, struct glamo_bo *bo)
 {
-	if ( pGlamo->cmdq_drm_used == pGlamo->cmdq_drm_size ) {
+	if ( pGlamo->cmdq_drm_used >= GLAMO_CMDQ_MAX_COUNT - 4 ||
+	       pGlamo->cmdq_obj_used >= GLAMO_CMDQ_MAX_COUNT) {
 		xf86DrvMsg(pGlamo->pScreen->myNum, X_INFO,
 		           "Forced command cache flush.\n");
 		GlamoDRMDispatch(pGlamo);
@@ -98,10 +101,13 @@ void GlamoDRMAddCommandBO(GlamoPtr pGlamo, uint16_t reg, struct glamo_bo *bo)
 
 void GlamoDRMInit(GlamoPtr pGlamo)
 {
-	pGlamo->cmdq_objs = malloc(1024);
-	pGlamo->cmdq_obj_pos = malloc(1024);
+	pGlamo->cmdq_objs = malloc(GLAMO_CMDQ_MAX_COUNT);
+	pGlamo->cmdq_obj_pos = malloc(GLAMO_CMDQ_MAX_COUNT);
 	pGlamo->cmdq_obj_used = 0;
 	pGlamo->cmdq_drm_used = 0;
-	pGlamo->cmdq_drm_size = 4 * 1024;
+	/* we're using 2bytes per entry (uint16_t) that's why we need to allocate
+	 * GLAMO_CMDQ_MAX_COUNT * 2 bytes
+	 */
+	pGlamo->cmdq_drm_size = 2 * GLAMO_CMDQ_MAX_COUNT;
 	pGlamo->cmdq_drm = malloc(pGlamo->cmdq_drm_size);
 }

-- 
xf86-video-glamo, SMedia Glamo video driver for X.Org



More information about the pkg-fso-commits mailing list