(gfx_display) Make gfx_display_set_fb_size - get rid of the small

getter/setter functions - also finally take this opportunity to stop
setting framebuffer width/height/pitch for menu drivers that don't
use a framebuffer texture at all
This commit is contained in:
twinaphex 2021-08-26 18:26:44 +02:00
parent 6d9ee4c161
commit 618cfacd59
8 changed files with 27 additions and 51 deletions

View File

@ -534,9 +534,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
new_fb_pitch = new_fb_width * 2; new_fb_pitch = new_fb_width * 2;
gfx_display_set_width(new_fb_width); gfx_display_set_framebuf(new_fb_width, new_fb_height, new_fb_pitch);
gfx_display_set_height(new_fb_height);
gfx_display_set_framebuffer_pitch(new_fb_pitch);
GX_SetViewportJitter(0, 0, gx_mode.fbWidth, gx_mode.efbHeight, 0, 1, 1); GX_SetViewportJitter(0, 0, gx_mode.fbWidth, gx_mode.efbHeight, 0, 1, 1);
GX_SetDispCopySrc(0, 0, gx_mode.fbWidth, gx_mode.efbHeight); GX_SetDispCopySrc(0, 0, gx_mode.fbWidth, gx_mode.efbHeight);

View File

@ -531,8 +531,12 @@ void gfx_display_draw_quad(
void *data, void *data,
unsigned video_width, unsigned video_width,
unsigned video_height, unsigned video_height,
int x, int y, unsigned w, unsigned h, int x,
unsigned width, unsigned height, int y,
unsigned w,
unsigned h,
unsigned width,
unsigned height,
float *color, float *color,
uintptr_t *texture) uintptr_t *texture)
{ {
@ -1092,24 +1096,17 @@ void gfx_display_get_fb_size(unsigned *fb_width,
*fb_pitch = p_disp->framebuf_pitch; *fb_pitch = p_disp->framebuf_pitch;
} }
/* Set the display framebuffer's width. */ /* Set the display framebuffer's dimensions. */
void gfx_display_set_width(unsigned width) void gfx_display_set_fb_size(
{ unsigned width,
gfx_display_t *p_disp = disp_get_ptr(); unsigned height,
p_disp->framebuf_width = width; size_t pitch
} )
/* Set the display framebuffer's height. */
void gfx_display_set_height(unsigned height)
{ {
gfx_display_t *p_disp = disp_get_ptr(); gfx_display_t *p_disp = disp_get_ptr();
p_disp->framebuf_width = width;
p_disp->framebuf_height = height; p_disp->framebuf_height = height;
} p_disp->framebuf_pitch = pitch;
void gfx_display_set_framebuffer_pitch(size_t pitch)
{
gfx_display_t *p_disp = disp_get_ptr();
p_disp->framebuf_pitch = pitch;
} }
void gfx_display_set_msg_force(bool state) void gfx_display_set_msg_force(bool state)
@ -1274,9 +1271,8 @@ void gfx_display_init_white_texture(uintptr_t white_texture)
TEXTURE_FILTER_NEAREST, &gfx_display_white_texture); TEXTURE_FILTER_NEAREST, &gfx_display_white_texture);
} }
void gfx_display_free(void) void gfx_display_free(gfx_display_t *p_disp)
{ {
gfx_display_t *p_disp = disp_get_ptr();
video_coord_array_free(&p_disp->dispca); video_coord_array_free(&p_disp->dispca);
p_disp->msg_force = false; p_disp->msg_force = false;
@ -1288,9 +1284,8 @@ void gfx_display_free(void)
p_disp->dispctx = NULL; p_disp->dispctx = NULL;
} }
void gfx_display_init(void) void gfx_display_init(gfx_display_t *p_disp)
{ {
gfx_display_t *p_disp = disp_get_ptr();
video_coord_array_t *p_dispca = &p_disp->dispca; video_coord_array_t *p_dispca = &p_disp->dispca;
p_disp->has_windowed = video_driver_has_windowed(); p_disp->has_windowed = video_driver_has_windowed();

View File

@ -223,9 +223,9 @@ struct gfx_display
bool framebuf_dirty; bool framebuf_dirty;
}; };
void gfx_display_free(void); void gfx_display_free(gfx_display_t *p_disp);
void gfx_display_init(void); void gfx_display_init(gfx_display_t *p_disp);
void gfx_display_draw_cursor( void gfx_display_draw_cursor(
gfx_display_t *p_disp, gfx_display_t *p_disp,
@ -258,11 +258,10 @@ void gfx_display_scissor_begin(
void gfx_display_font_free(font_data_t *font); void gfx_display_font_free(font_data_t *font);
void gfx_display_set_width(unsigned width);
void gfx_display_get_fb_size(unsigned *fb_width, unsigned *fb_height, void gfx_display_get_fb_size(unsigned *fb_width, unsigned *fb_height,
size_t *fb_pitch); size_t *fb_pitch);
void gfx_display_set_height(unsigned height);
void gfx_display_set_framebuffer_pitch(size_t pitch); void gfx_display_set_fb_size(unsigned width, unsigned height, size_t pitch);
void gfx_display_set_msg_force(bool state); void gfx_display_set_msg_force(bool state);
bool gfx_display_init_first_driver(gfx_display_t *p_disp, bool gfx_display_init_first_driver(gfx_display_t *p_disp,

View File

@ -791,9 +791,6 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
gfx_display_set_width(width);
gfx_display_set_height(height);
gfx_display_init_white_texture(gfx_display_white_texture); gfx_display_init_white_texture(gfx_display_white_texture);
file_list_initialize(&ozone->horizontal_list); file_list_initialize(&ozone->horizontal_list);

View File

@ -5695,9 +5695,10 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui,
return false; return false;
/* Configure 'menu display' settings */ /* Configure 'menu display' settings */
gfx_display_set_width(rgui->frame_buf.width); gfx_display_set_fb_size(
gfx_display_set_height(rgui->frame_buf.height); rgui->frame_buf.width,
gfx_display_set_framebuffer_pitch(rgui->frame_buf.width * sizeof(uint16_t)); rgui->frame_buf.height,
rgui->frame_buf.width * sizeof(uint16_t));
/* Determine terminal layout */ /* Determine terminal layout */
rgui->term_layout.start_x = (3 * 5) + 1; rgui->term_layout.start_x = (3 * 5) + 1;

View File

@ -3366,13 +3366,6 @@ static void *stripes_init(void **userdata, bool video_is_threaded)
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
/* TODO/FIXME - we don't use framebuffer at all
* for XMB, we should refactor this dependency
* away. */
gfx_display_set_width(width);
gfx_display_set_height(height);
gfx_display_init_white_texture(gfx_display_white_texture); gfx_display_init_white_texture(gfx_display_white_texture);
file_list_initialize(&stripes->horizontal_list); file_list_initialize(&stripes->horizontal_list);

View File

@ -5833,13 +5833,6 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL); menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
/* TODO/FIXME - we don't use framebuffer at all
* for XMB, we should refactor this dependency
* away. */
gfx_display_set_width(width);
gfx_display_set_height(height);
gfx_display_init_white_texture(gfx_display_white_texture); gfx_display_init_white_texture(gfx_display_white_texture);
file_list_initialize(&xmb->horizontal_list); file_list_initialize(&xmb->horizontal_list);

View File

@ -4787,7 +4787,7 @@ static bool menu_driver_init_internal(
settings)) settings))
return false; return false;
gfx_display_init(); gfx_display_init(&p_rarch->dispgfx);
/* TODO/FIXME - can we get rid of this? Is this needed? */ /* TODO/FIXME - can we get rid of this? Is this needed? */
configuration_set_string(settings, configuration_set_string(settings,
@ -5395,7 +5395,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
} }
gfx_animation_deinit(&p_rarch->anim); gfx_animation_deinit(&p_rarch->anim);
gfx_display_free(); gfx_display_free(&p_rarch->dispgfx);
menu_entries_settings_deinit(menu_st); menu_entries_settings_deinit(menu_st);
menu_entries_list_deinit(p_rarch->menu_driver_ctx, menu_st); menu_entries_list_deinit(p_rarch->menu_driver_ctx, menu_st);