aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-08-24 13:17:48 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-08-24 13:17:48 +0100
commita02755ece0c0652480ed9d9f2f0355fdc3632fdb (patch)
treecb1b48f435e3a8d8e1060913ef0f3a759499086c /hw/misc
parent6e0fafe2ef02378c696e7cf84ef41511e3b3b81a (diff)
downloadqemu-a02755ece0c0652480ed9d9f2f0355fdc3632fdb.zip
qemu-a02755ece0c0652480ed9d9f2f0355fdc3632fdb.tar.gz
qemu-a02755ece0c0652480ed9d9f2f0355fdc3632fdb.tar.bz2
hw/misc/bcm2835_fb: Move config fields to their own struct
The handling of framebuffer properties in the bcm2835_property code is a bit clumsy, because for each of the many fb related properties we try to track the value we're about to set and whether we're going to be setting a value, and then we hand all the new values off to the framebuffer via a function which takes them all as separate arguments. It would be simpler if the property code could easily copy all the framebuffer's current settings, update them with the new specified values and then ask the framebuffer to switch to the new set. As the first part of this refactoring, pull all the fb config settings fields in BCM2835FBState out into their own struct. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180814144436.679-2-peter.maydell@linaro.org
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/bcm2835_property.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 70eaafd..c79f358 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -141,10 +141,10 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
/* Frame buffer */
case 0x00040001: /* Allocate buffer */
- stl_le_phys(&s->dma_as, value + 12, s->fbdev->base);
- tmp_xres = newxres != NULL ? *newxres : s->fbdev->xres;
- tmp_yres = newyres != NULL ? *newyres : s->fbdev->yres;
- tmp_bpp = newbpp != NULL ? *newbpp : s->fbdev->bpp;
+ stl_le_phys(&s->dma_as, value + 12, s->fbdev->config.base);
+ tmp_xres = newxres != NULL ? *newxres : s->fbdev->config.xres;
+ tmp_yres = newyres != NULL ? *newyres : s->fbdev->config.yres;
+ tmp_bpp = newbpp != NULL ? *newbpp : s->fbdev->config.bpp;
stl_le_phys(&s->dma_as, value + 16,
tmp_xres * tmp_yres * tmp_bpp / 8);
resplen = 8;
@@ -157,8 +157,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
break;
case 0x00040003: /* Get display width/height */
case 0x00040004:
- tmp_xres = newxres != NULL ? *newxres : s->fbdev->xres;
- tmp_yres = newyres != NULL ? *newyres : s->fbdev->yres;
+ tmp_xres = newxres != NULL ? *newxres : s->fbdev->config.xres;
+ tmp_yres = newyres != NULL ? *newyres : s->fbdev->config.yres;
stl_le_phys(&s->dma_as, value + 12, tmp_xres);
stl_le_phys(&s->dma_as, value + 16, tmp_yres);
resplen = 8;
@@ -176,7 +176,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
resplen = 8;
break;
case 0x00040005: /* Get depth */
- tmp_bpp = newbpp != NULL ? *newbpp : s->fbdev->bpp;
+ tmp_bpp = newbpp != NULL ? *newbpp : s->fbdev->config.bpp;
stl_le_phys(&s->dma_as, value + 12, tmp_bpp);
resplen = 4;
break;
@@ -189,7 +189,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
resplen = 4;
break;
case 0x00040006: /* Get pixel order */
- tmp_pixo = newpixo != NULL ? *newpixo : s->fbdev->pixo;
+ tmp_pixo = newpixo != NULL ? *newpixo : s->fbdev->config.pixo;
stl_le_phys(&s->dma_as, value + 12, tmp_pixo);
resplen = 4;
break;
@@ -202,7 +202,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
resplen = 4;
break;
case 0x00040007: /* Get alpha */
- tmp_alpha = newalpha != NULL ? *newalpha : s->fbdev->alpha;
+ tmp_alpha = newalpha != NULL ? *newalpha : s->fbdev->config.alpha;
stl_le_phys(&s->dma_as, value + 12, tmp_alpha);
resplen = 4;
break;
@@ -215,14 +215,16 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
resplen = 4;
break;
case 0x00040008: /* Get pitch */
- tmp_xres = newxres != NULL ? *newxres : s->fbdev->xres;
- tmp_bpp = newbpp != NULL ? *newbpp : s->fbdev->bpp;
+ tmp_xres = newxres != NULL ? *newxres : s->fbdev->config.xres;
+ tmp_bpp = newbpp != NULL ? *newbpp : s->fbdev->config.bpp;
stl_le_phys(&s->dma_as, value + 12, tmp_xres * tmp_bpp / 8);
resplen = 4;
break;
case 0x00040009: /* Get virtual offset */
- tmp_xoffset = newxoffset != NULL ? *newxoffset : s->fbdev->xoffset;
- tmp_yoffset = newyoffset != NULL ? *newyoffset : s->fbdev->yoffset;
+ tmp_xoffset = newxoffset != NULL ?
+ *newxoffset : s->fbdev->config.xoffset;
+ tmp_yoffset = newyoffset != NULL ?
+ *newyoffset : s->fbdev->config.yoffset;
stl_le_phys(&s->dma_as, value + 12, tmp_xoffset);
stl_le_phys(&s->dma_as, value + 16, tmp_yoffset);
resplen = 8;