summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-01-02 16:18:29 +0600
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-01-06 19:47:53 +0600
commitdbaab9759ba31edf63cf73eda86ba931d88e8cce (patch)
tree3219e152626206e1ec63f117cb4b1c5d85653972 /hw/kdrive
parent7ee14154b230b931d294288e1291c4fc617b1354 (diff)
kdrive: Extract common part of fbdevPutColors and fbdevEnable
Put framebuffer colormap updating code in separate function for brevity. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/fbdev/fbdev.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index 37bda17a2..cd904872b 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -651,6 +651,21 @@ fbdevPreserve (KdCardInfo *card)
{
}
+static int
+fbdevUpdateFbColormap(FbdevPriv *priv, int minidx, int maxidx)
+{
+ struct fb_cmap cmap;
+
+ cmap.start = minidx;
+ cmap.len = maxidx - minidx + 1;
+ cmap.red = &priv->red[minidx];
+ cmap.green = &priv->green[minidx];
+ cmap.blue = &priv->blue[minidx];
+ cmap.transp = 0;
+
+ return ioctl(priv->fd, FBIOPUTCMAP, &cmap);
+}
+
Bool
fbdevEnable (ScreenPtr pScreen)
{
@@ -670,7 +685,6 @@ fbdevEnable (ScreenPtr pScreen)
if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR)
{
- struct fb_cmap cmap;
int i;
for (i = 0;
@@ -682,13 +696,8 @@ fbdevEnable (ScreenPtr pScreen)
priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1);
priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1);
}
- cmap.start = 0;
- cmap.len = i;
- cmap.red = &priv->red[0];
- cmap.green = &priv->green[0];
- cmap.blue = &priv->blue[0];
- cmap.transp = 0;
- ioctl (priv->fd, FBIOPUTCMAP, &cmap);
+
+ fbdevUpdateFbColormap(priv, 0, i);
}
return TRUE;
}
@@ -744,6 +753,9 @@ fbdevCardFini (KdCardInfo *card)
xfree (priv);
}
+/*
+ * Retrieve actual colormap and return selected n entries in pdefs.
+ */
void
fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
{
@@ -785,12 +797,14 @@ fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
}
}
+/*
+ * Change colormap by updating n entries described in pdefs.
+ */
void
fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
{
KdScreenPriv(pScreen);
FbdevPriv *priv = pScreenPriv->card->driver;
- struct fb_cmap cmap;
int p;
int min, max;
@@ -808,11 +822,6 @@ fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
max = p;
pdefs++;
}
- cmap.start = min;
- cmap.len = max - min + 1;
- cmap.red = &priv->red[min];
- cmap.green = &priv->green[min];
- cmap.blue = &priv->blue[min];
- cmap.transp = 0;
- ioctl (priv->fd, FBIOPUTCMAP, &cmap);
+
+ fbdevUpdateFbColormap(priv, min, max);
}