version 1.1.1.2, 2018/04/24 16:53:39
|
version 1.1.1.3, 2018/04/24 17:24:47
|
Line 14
|
Line 14
|
* GNU General Public License for more details. |
* GNU General Public License for more details. |
* |
* |
* You should have received a copy of the GNU General Public License along |
* You should have received a copy of the GNU General Public License along |
* with this program; if not, write to the Free Software Foundation, Inc., |
* with this program; if not, see <http://www.gnu.org/licenses/>. |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
*/ |
*/ |
#include "hw.h" |
#include "hw.h" |
#include "console.h" |
#include "console.h" |
#include "omap.h" |
#include "omap.h" |
|
#include "framebuffer.h" |
|
|
struct omap_lcd_panel_s { |
struct omap_lcd_panel_s { |
qemu_irq irq; |
qemu_irq irq; |
Line 68 static void omap_lcd_interrupts(struct o
|
Line 68 static void omap_lcd_interrupts(struct o
|
|
|
#include "pixel_ops.h" |
#include "pixel_ops.h" |
|
|
typedef void draw_line_func( |
#define draw_line_func drawfn |
uint8_t *d, const uint8_t *s, int width, const uint16_t *pal); |
|
|
|
#define DEPTH 8 |
#define DEPTH 8 |
#include "omap_lcd_template.h" |
#include "omap_lcd_template.h" |
Line 80 typedef void draw_line_func(
|
Line 79 typedef void draw_line_func(
|
#define DEPTH 32 |
#define DEPTH 32 |
#include "omap_lcd_template.h" |
#include "omap_lcd_template.h" |
|
|
static draw_line_func *draw_line_table2[33] = { |
static draw_line_func draw_line_table2[33] = { |
[0 ... 32] = 0, |
[0 ... 32] = 0, |
[8] = draw_line2_8, |
[8] = draw_line2_8, |
[15] = draw_line2_15, |
[15] = draw_line2_15, |
[16] = draw_line2_16, |
[16] = draw_line2_16, |
[32] = draw_line2_32, |
[32] = draw_line2_32, |
}, *draw_line_table4[33] = { |
}, draw_line_table4[33] = { |
[0 ... 32] = 0, |
[0 ... 32] = 0, |
[8] = draw_line4_8, |
[8] = draw_line4_8, |
[15] = draw_line4_15, |
[15] = draw_line4_15, |
[16] = draw_line4_16, |
[16] = draw_line4_16, |
[32] = draw_line4_32, |
[32] = draw_line4_32, |
}, *draw_line_table8[33] = { |
}, draw_line_table8[33] = { |
[0 ... 32] = 0, |
[0 ... 32] = 0, |
[8] = draw_line8_8, |
[8] = draw_line8_8, |
[15] = draw_line8_15, |
[15] = draw_line8_15, |
[16] = draw_line8_16, |
[16] = draw_line8_16, |
[32] = draw_line8_32, |
[32] = draw_line8_32, |
}, *draw_line_table12[33] = { |
}, draw_line_table12[33] = { |
[0 ... 32] = 0, |
[0 ... 32] = 0, |
[8] = draw_line12_8, |
[8] = draw_line12_8, |
[15] = draw_line12_15, |
[15] = draw_line12_15, |
[16] = draw_line12_16, |
[16] = draw_line12_16, |
[32] = draw_line12_32, |
[32] = draw_line12_32, |
}, *draw_line_table16[33] = { |
}, draw_line_table16[33] = { |
[0 ... 32] = 0, |
[0 ... 32] = 0, |
[8] = draw_line16_8, |
[8] = draw_line16_8, |
[15] = draw_line16_15, |
[15] = draw_line16_15, |
Line 115 static draw_line_func *draw_line_table2[
|
Line 114 static draw_line_func *draw_line_table2[
|
static void omap_update_display(void *opaque) |
static void omap_update_display(void *opaque) |
{ |
{ |
struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque; |
struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque; |
draw_line_func *draw_line; |
draw_line_func draw_line; |
int size, dirty[2], minline, maxline, height; |
int size, height, first, last; |
int line, width, linesize, step, bpp, frame_offset; |
int width, linesize, step, bpp, frame_offset; |
ram_addr_t frame_base, scanline, newline, x; |
target_phys_addr_t frame_base; |
uint8_t *s, *d; |
|
|
|
if (!omap_lcd || omap_lcd->plm == 1 || |
if (!omap_lcd || omap_lcd->plm == 1 || |
!omap_lcd->enable || !ds_get_bits_per_pixel(omap_lcd->state)) |
!omap_lcd->enable || !ds_get_bits_per_pixel(omap_lcd->state)) |
Line 127 static void omap_update_display(void *op
|
Line 125 static void omap_update_display(void *op
|
|
|
frame_offset = 0; |
frame_offset = 0; |
if (omap_lcd->plm != 2) { |
if (omap_lcd->plm != 2) { |
memcpy(omap_lcd->palette, phys_ram_base + |
cpu_physical_memory_read(omap_lcd->dma->phys_framebuffer[ |
omap_lcd->dma->phys_framebuffer[ |
omap_lcd->dma->current_frame], |
omap_lcd->dma->current_frame], 0x200); |
(void *)omap_lcd->palette, 0x200); |
switch (omap_lcd->palette[0] >> 12 & 7) { |
switch (omap_lcd->palette[0] >> 12 & 7) { |
case 3 ... 7: |
case 3 ... 7: |
frame_offset += 0x200; |
frame_offset += 0x200; |
Line 202 static void omap_update_display(void *op
|
Line 200 static void omap_update_display(void *op
|
if (!ds_get_bits_per_pixel(omap_lcd->state)) |
if (!ds_get_bits_per_pixel(omap_lcd->state)) |
return; |
return; |
|
|
line = 0; |
first = 0; |
height = omap_lcd->height; |
height = omap_lcd->height; |
if (omap_lcd->subpanel & (1 << 31)) { |
if (omap_lcd->subpanel & (1 << 31)) { |
if (omap_lcd->subpanel & (1 << 29)) |
if (omap_lcd->subpanel & (1 << 29)) |
line = (omap_lcd->subpanel >> 16) & 0x3ff; |
first = (omap_lcd->subpanel >> 16) & 0x3ff; |
else |
else |
height = (omap_lcd->subpanel >> 16) & 0x3ff; |
height = (omap_lcd->subpanel >> 16) & 0x3ff; |
/* TODO: fill the rest of the panel with DPD */ |
/* TODO: fill the rest of the panel with DPD */ |
} |
} |
|
|
step = width * bpp >> 3; |
step = width * bpp >> 3; |
scanline = frame_base + step * line; |
|
s = (uint8_t *) (phys_ram_base + scanline); |
|
d = ds_get_data(omap_lcd->state); |
|
linesize = ds_get_linesize(omap_lcd->state); |
linesize = ds_get_linesize(omap_lcd->state); |
|
framebuffer_update_display(omap_lcd->state, |
dirty[0] = dirty[1] = |
frame_base, width, height, |
cpu_physical_memory_get_dirty(scanline, VGA_DIRTY_FLAG); |
step, linesize, 0, |
minline = height; |
omap_lcd->invalidate, |
maxline = line; |
draw_line, omap_lcd->palette, |
for (; line < height; line ++) { |
&first, &last); |
newline = scanline + step; |
if (first >= 0) { |
for (x = scanline + TARGET_PAGE_SIZE; x < newline; |
dpy_update(omap_lcd->state, 0, first, width, last - first + 1); |
x += TARGET_PAGE_SIZE) { |
|
dirty[1] = cpu_physical_memory_get_dirty(x, VGA_DIRTY_FLAG); |
|
dirty[0] |= dirty[1]; |
|
} |
|
if (dirty[0] || omap_lcd->invalidate) { |
|
draw_line(d, s, width, omap_lcd->palette); |
|
if (line < minline) |
|
minline = line; |
|
maxline = line + 1; |
|
} |
|
scanline = newline; |
|
dirty[0] = dirty[1]; |
|
s += step; |
|
d += linesize; |
|
} |
|
|
|
if (maxline >= minline) { |
|
dpy_update(omap_lcd->state, 0, minline, width, maxline); |
|
cpu_physical_memory_reset_dirty(frame_base + step * minline, |
|
frame_base + step * maxline, VGA_DIRTY_FLAG); |
|
} |
} |
|
omap_lcd->invalidate = 0; |
} |
} |
|
|
static int ppm_save(const char *filename, uint8_t *data, |
static int ppm_save(const char *filename, uint8_t *data, |
Line 336 static void omap_lcd_update(struct omap_
|
Line 313 static void omap_lcd_update(struct omap_
|
return; |
return; |
} |
} |
|
|
if (s->dma->src == imif) { |
s->dma->phys_framebuffer[0] = s->dma->src_f1_top; |
/* Framebuffers are in SRAM */ |
s->dma->phys_framebuffer[1] = s->dma->src_f2_top; |
s->dma->phys_framebuffer[0] = s->imif_base + |
|
s->dma->src_f1_top - OMAP_IMIF_BASE; |
|
|
|
s->dma->phys_framebuffer[1] = s->imif_base + |
|
s->dma->src_f2_top - OMAP_IMIF_BASE; |
|
} else { |
|
/* Framebuffers are in RAM */ |
|
s->dma->phys_framebuffer[0] = s->emiff_base + |
|
s->dma->src_f1_top - OMAP_EMIFF_BASE; |
|
|
|
s->dma->phys_framebuffer[1] = s->emiff_base + |
|
s->dma->src_f2_top - OMAP_EMIFF_BASE; |
|
} |
|
|
|
if (s->plm != 2 && !s->palette_done) { |
if (s->plm != 2 && !s->palette_done) { |
memcpy(s->palette, phys_ram_base + |
cpu_physical_memory_read( |
s->dma->phys_framebuffer[s->dma->current_frame], 0x200); |
s->dma->phys_framebuffer[s->dma->current_frame], |
|
(void *)s->palette, 0x200); |
s->palette_done = 1; |
s->palette_done = 1; |
omap_lcd_interrupts(s); |
omap_lcd_interrupts(s); |
} |
} |
Line 484 struct omap_lcd_panel_s *omap_lcdc_init(
|
Line 449 struct omap_lcd_panel_s *omap_lcdc_init(
|
s->emiff_base = emiff_base; |
s->emiff_base = emiff_base; |
omap_lcdc_reset(s); |
omap_lcdc_reset(s); |
|
|
iomemtype = cpu_register_io_memory(0, omap_lcdc_readfn, |
iomemtype = cpu_register_io_memory(omap_lcdc_readfn, |
omap_lcdc_writefn, s); |
omap_lcdc_writefn, s); |
cpu_register_physical_memory(base, 0x100, iomemtype); |
cpu_register_physical_memory(base, 0x100, iomemtype); |
|
|