Skip to content

Commit a45873a

Browse files
authored
Merge pull request #10405 from jamesbowman/main
Support bt820 REGION instruction (_eve)
2 parents 742304a + 5903b67 commit a45873a

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

shared-bindings/_eve/__init__.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
970970
{ MP_ROM_QSTR(MP_QSTR_PaletteSource), MP_ROM_PTR(&palettesource_obj) }, \
971971
{ MP_ROM_QSTR(MP_QSTR_PaletteSourceH), MP_ROM_PTR(&palettesourceh_obj) }, \
972972
{ MP_ROM_QSTR(MP_QSTR_PointSize), MP_ROM_PTR(&pointsize_obj) }, \
973+
{ MP_ROM_QSTR(MP_QSTR_Region), MP_ROM_PTR(&region_obj) }, \
973974
{ MP_ROM_QSTR(MP_QSTR_RestoreContext), MP_ROM_PTR(&restorecontext_obj) }, \
974975
{ MP_ROM_QSTR(MP_QSTR_Return), MP_ROM_PTR(&return_obj) }, \
975976
{ MP_ROM_QSTR(MP_QSTR_SaveContext), MP_ROM_PTR(&savecontext_obj) }, \
@@ -1061,8 +1062,29 @@ static mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
10611062
common_hal__eve_PointSize(EVEHAL(self), size);
10621063
return mp_const_none;
10631064
}
1065+
10641066
static MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
10651067

1068+
//| def Region(self, y: int, h: int, dest: int) -> None:
1069+
//| """Specify a cull region in the display list
1070+
//|
1071+
//| :param int y: Starting Y band in the render buffer. Range 0-63
1072+
//| :param int h: Y height in the render buffer. Range 0-63
1073+
//| :param int dest: destination address in the display list if the raster is outside the region
1074+
//|
1075+
//| """
1076+
//| ...
1077+
//|
1078+
1079+
static mp_obj_t _region(size_t n_args, const mp_obj_t *args) {
1080+
uint32_t y = mp_obj_get_int_truncated(args[1]);
1081+
uint32_t h = mp_obj_get_int_truncated(args[2]);
1082+
uint32_t dest = mp_obj_get_int_truncated(args[3]);
1083+
common_hal__eve_Region(EVEHAL(args[0]), y, h, dest);
1084+
return mp_const_none;
1085+
}
1086+
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(region_obj, 4, 4, _region);
1087+
10661088
//| def VertexTranslateX(self, x: float) -> None:
10671089
//| """Set the vertex transformation's x translation component
10681090
//|

shared-bindings/_eve/__init__.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void common_hal__eve_Nop(common_hal__eve_t *eve);
4949
void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr);
5050
void common_hal__eve_PaletteSourceH(common_hal__eve_t *eve, uint32_t addr);
5151
void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size);
52+
void common_hal__eve_Region(common_hal__eve_t *eve, uint32_t y, uint32_t h, uint32_t dest);
5253
void common_hal__eve_RestoreContext(common_hal__eve_t *eve);
5354
void common_hal__eve_Return(common_hal__eve_t *eve);
5455
void common_hal__eve_SaveContext(common_hal__eve_t *eve);

shared-module/_eve/__init__.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size) {
246246
}
247247

248248

249+
void common_hal__eve_Region(common_hal__eve_t *eve, uint32_t y, uint32_t h, uint32_t dest) {
250+
C4(eve, ((52 << 24) | ((y & 0x3f) << 18) | ((h & 0x3f) << 12) | (dest & 0xfff)));
251+
}
252+
253+
249254
void common_hal__eve_RestoreContext(common_hal__eve_t *eve) {
250255
C4(eve, ((35 << 24)));
251256
}

0 commit comments

Comments
 (0)