Skip to content

Support bt820 REGION instruction (_eve) #10405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions shared-bindings/_eve/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
{ MP_ROM_QSTR(MP_QSTR_PaletteSource), MP_ROM_PTR(&palettesource_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_PaletteSourceH), MP_ROM_PTR(&palettesourceh_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_PointSize), MP_ROM_PTR(&pointsize_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_Region), MP_ROM_PTR(&region_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_RestoreContext), MP_ROM_PTR(&restorecontext_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_Return), MP_ROM_PTR(&return_obj) }, \
{ MP_ROM_QSTR(MP_QSTR_SaveContext), MP_ROM_PTR(&savecontext_obj) }, \
Expand Down Expand Up @@ -1061,8 +1062,29 @@ static mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
common_hal__eve_PointSize(EVEHAL(self), size);
return mp_const_none;
}

static MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);

//| def Region(self, y: int, h: int, dest: int) -> None:
//| """Specify a cull region in the display list
//|
//| :param int y: Starting Y band in the render buffer. Range 0-63
//| :param int h: Y height in the render buffer. Range 0-63
//| :param int dest: destination address in the display list if the raster is outside the region
//|
//| """
//| ...
//|

static mp_obj_t _region(size_t n_args, const mp_obj_t *args) {
uint32_t y = mp_obj_get_int_truncated(args[1]);
uint32_t h = mp_obj_get_int_truncated(args[2]);
uint32_t dest = mp_obj_get_int_truncated(args[3]);
common_hal__eve_Region(EVEHAL(args[0]), y, h, dest);
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(region_obj, 4, 4, _region);

//| def VertexTranslateX(self, x: float) -> None:
//| """Set the vertex transformation's x translation component
//|
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/_eve/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void common_hal__eve_Nop(common_hal__eve_t *eve);
void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr);
void common_hal__eve_PaletteSourceH(common_hal__eve_t *eve, uint32_t addr);
void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size);
void common_hal__eve_Region(common_hal__eve_t *eve, uint32_t y, uint32_t h, uint32_t dest);
void common_hal__eve_RestoreContext(common_hal__eve_t *eve);
void common_hal__eve_Return(common_hal__eve_t *eve);
void common_hal__eve_SaveContext(common_hal__eve_t *eve);
Expand Down
5 changes: 5 additions & 0 deletions shared-module/_eve/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size) {
}


void common_hal__eve_Region(common_hal__eve_t *eve, uint32_t y, uint32_t h, uint32_t dest) {
C4(eve, ((52 << 24) | ((y & 0x3f) << 18) | ((h & 0x3f) << 12) | (dest & 0xfff)));
}


void common_hal__eve_RestoreContext(common_hal__eve_t *eve) {
C4(eve, ((35 << 24)));
}
Expand Down