From 298413dce82fa1a8f2294f9992bea6048038aad2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 9 Jul 2020 00:33:19 +0200 Subject: [PATCH] Cleanups --- Makefile.common | 3 +- gfx/drivers/fpga_gfx.c | 116 +------------------- gfx/drivers_context/fpga_ctx.c | 190 --------------------------------- gfx/drivers_context/wgl_ctx.c | 5 +- 4 files changed, 5 insertions(+), 309 deletions(-) delete mode 100644 gfx/drivers_context/fpga_ctx.c diff --git a/Makefile.common b/Makefile.common index 69ed7c2e99..c5f8c6afd9 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2029,8 +2029,7 @@ ifeq ($(HAVE_NETWORKING), 1) endif ifneq ($(findstring FPGA,$(OS)),) - OBJ += gfx/drivers/fpga_gfx.o \ - gfx/drivers_context/fpga_ctx.o + OBJ += gfx/drivers/fpga_gfx.o endif ifneq ($(findstring Win32,$(OS)),) diff --git a/gfx/drivers/fpga_gfx.c b/gfx/drivers/fpga_gfx.c index 2e6ebd7c58..c0c54a7875 100644 --- a/gfx/drivers/fpga_gfx.c +++ b/gfx/drivers/fpga_gfx.c @@ -103,12 +103,7 @@ static void fpga_gfx_create(fpga_t *fpga) static void *fpga_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { - unsigned full_x, full_y; - gfx_ctx_input_t inp; - gfx_ctx_mode_t mode; const gfx_ctx_driver_t *ctx_driver = NULL; - unsigned win_width = 0, win_height = 0; - unsigned temp_width = 0, temp_height = 0; settings_t *settings = config_get_ptr(); fpga_t *fpga = (fpga_t*)calloc(1, sizeof(*fpga)); @@ -128,71 +123,11 @@ static void *fpga_gfx_init(const video_info_t *video, fpga_gfx_create(fpga); - ctx_driver = video_context_driver_init_first(fpga, - settings->arrays.video_context_driver, - GFX_CTX_FPGA_API, 1, 0, false); - if (!ctx_driver) - goto error; - - video_context_driver_set((const gfx_ctx_driver_t*)ctx_driver); - - RARCH_LOG("[FPGA]: Found FPGA context: %s\n", ctx_driver->ident); - - video_context_driver_get_video_size(&mode); - - full_x = mode.width; - full_y = mode.height; - mode.width = 0; - mode.height = 0; - - RARCH_LOG("[FPGA]: Detecting screen resolution %ux%u.\n", full_x, full_y); - - win_width = video->width; - win_height = video->height; - - if (video->fullscreen && (win_width == 0) && (win_height == 0)) - { - win_width = full_x; - win_height = full_y; - } - - mode.width = win_width; - mode.height = win_height; - mode.fullscreen = video->fullscreen; - - if (!video_context_driver_set_video_mode(&mode)) - goto error; - - mode.width = 0; - mode.height = 0; - - video_context_driver_get_video_size(&mode); - - temp_width = mode.width; - temp_height = mode.height; - mode.width = 0; - mode.height = 0; - - /* Get real known video size, which might have been altered by context. */ - - if (temp_width != 0 && temp_height != 0) - video_driver_set_size(temp_width, temp_height); - - video_driver_get_size(&temp_width, &temp_height); - - RARCH_LOG("[FPGA]: Using resolution %ux%u\n", temp_width, temp_height); - - inp.input = input; - inp.input_data = input_data; - - video_context_driver_input_driver(&inp); - RARCH_LOG("[FPGA]: Init complete.\n"); return fpga; error: - video_context_driver_destroy(); if (fpga) free(fpga); return NULL; @@ -202,7 +137,6 @@ static bool fpga_gfx_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info) { - gfx_ctx_mode_t mode; const void *frame_to_copy = frame; unsigned width = 0; unsigned height = 0; @@ -251,8 +185,6 @@ static bool fpga_gfx_frame(void *data, const void *frame, draw = false; } - video_context_driver_get_video_size(&mode); - if (draw) { if (bits == 16) @@ -317,25 +249,6 @@ static void fpga_gfx_set_nonblock_state(void *a, bool b, bool c, unsigned d) { } static bool fpga_gfx_alive(void *data) { - gfx_ctx_size_t size_data; - unsigned temp_width = 0; - unsigned temp_height = 0; - bool quit = false; - bool resize = false; - - /* Needed because some context drivers don't track their sizes */ - video_driver_get_size(&temp_width, &temp_height); - - size_data.quit = &quit; - size_data.resize = &resize; - size_data.width = &temp_width; - size_data.height = &temp_height; - - video_context_driver_check_window(&size_data); - - if (temp_width != 0 && temp_height != 0) - video_driver_set_size(temp_width, temp_height); - return true; } @@ -369,8 +282,6 @@ static void fpga_gfx_free(void *data) free(fpga->menu_frame); fpga->menu_frame = NULL; - video_context_driver_free(); - free(fpga); fpga->regOp.only_mmap = 0; @@ -449,34 +360,13 @@ static void fpga_set_osd_msg(void *data, } static void fpga_get_video_output_size(void *data, - unsigned *width, unsigned *height) -{ - gfx_ctx_size_t size_data; - size_data.width = width; - size_data.height = height; - video_context_driver_get_video_output_size(&size_data); -} - -static void fpga_get_video_output_prev(void *data) -{ - video_context_driver_get_video_output_prev(); -} - -static void fpga_get_video_output_next(void *data) -{ - video_context_driver_get_video_output_next(); -} + unsigned *width, unsigned *height) { } +static void fpga_get_video_output_prev(void *data) { } +static void fpga_get_video_output_next(void *data) { } static void fpga_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { - gfx_ctx_mode_t mode; - - mode.width = width; - mode.height = height; - mode.fullscreen = fullscreen; - - video_context_driver_set_video_mode(&mode); } static const video_poke_interface_t fpga_poke_interface = { diff --git a/gfx/drivers_context/fpga_ctx.c b/gfx/drivers_context/fpga_ctx.c deleted file mode 100644 index 66b1c030dc..0000000000 --- a/gfx/drivers_context/fpga_ctx.c +++ /dev/null @@ -1,190 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2011-2017 - Daniel De Matteis - * Copyright (C) 2016-2017 - Brad Parker - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -/* FPGA context. */ - -#include -#include - -#include - -#ifdef HAVE_CONFIG_H -#include "../../config.h" -#endif - -#include "../../configuration.h" -#include "../../dynamic.h" -#include "../../verbosity.h" -#include "../video_driver.h" -#include "../common/fpga_common.h" - -static unsigned g_resize_width = FB_WIDTH; -static unsigned g_resize_height = FB_HEIGHT; - -static void gfx_ctx_fpga_check_window(void *data, bool *quit, - bool *resize, unsigned *width, unsigned *height) -{ -} - -static bool gfx_ctx_fpga_set_resize(void *data, - unsigned width, unsigned height) -{ - (void)data; - (void)width; - (void)height; - - return false; -} - -static void gfx_ctx_fpga_update_title(void *data) -{ - char title[128]; - - title[0] = '\0'; - - video_driver_get_window_title(title, sizeof(title)); -} - -static void gfx_ctx_fpga_get_video_size(void *data, - unsigned *width, unsigned *height) -{ - (void)data; - - *width = g_resize_width; - *height = g_resize_height; -} - -static void *gfx_ctx_fpga_init(void *video_driver) -{ - (void)video_driver; - - return (void*)"fpga"; -} - -static void gfx_ctx_fpga_destroy(void *data) -{ - (void)data; -} - -static bool gfx_ctx_fpga_set_video_mode(void *data, - unsigned width, unsigned height, - bool fullscreen) -{ - if (false) - goto error; - - return true; - -error: - gfx_ctx_fpga_destroy(data); - return false; -} - - -static void gfx_ctx_fpga_input_driver(void *data, - const char *joypad_name, - const input_driver_t **input, void **input_data) -{ -} - -static bool gfx_ctx_fpga_has_focus(void *data) -{ - return true; -} - -static bool gfx_ctx_fpga_suppress_screensaver(void *data, bool enable) -{ - return true; -} - -static bool gfx_ctx_fpga_has_windowed(void *data) -{ - (void)data; - - return true; -} - -static bool gfx_ctx_fpga_get_metrics(void *data, - enum display_metric_types type, float *value) -{ - return true; -} - -static bool gfx_ctx_fpga_bind_api(void *data, - enum gfx_ctx_api api, unsigned major, unsigned minor) -{ - (void)data; - - return true; -} - -static void gfx_ctx_fpga_show_mouse(void *data, bool state) -{ - (void)data; -} - -static void gfx_ctx_fpga_swap_interval(void *data, unsigned interval) -{ - (void)data; - (void)interval; -} - -static void gfx_ctx_fpga_set_flags(void *data, uint32_t flags) -{ - (void)data; - (void)flags; -} - -static uint32_t gfx_ctx_fpga_get_flags(void *data) -{ - uint32_t flags = 0; - BIT32_SET(flags, GFX_CTX_FLAGS_NONE); - return flags; -} - -const gfx_ctx_driver_t gfx_ctx_fpga = { - gfx_ctx_fpga_init, - gfx_ctx_fpga_destroy, - gfx_ctx_fpga_bind_api, - gfx_ctx_fpga_swap_interval, - gfx_ctx_fpga_set_video_mode, - gfx_ctx_fpga_get_video_size, - NULL, /* get_video_output_size */ - NULL, /* get_video_output_prev */ - NULL, /* get_video_output_next */ - gfx_ctx_fpga_get_metrics, - NULL, - gfx_ctx_fpga_update_title, - gfx_ctx_fpga_check_window, - gfx_ctx_fpga_set_resize, - gfx_ctx_fpga_has_focus, - gfx_ctx_fpga_suppress_screensaver, - gfx_ctx_fpga_has_windowed, - NULL, /* swap_buffers */ - gfx_ctx_fpga_input_driver, - NULL, - NULL, - NULL, - gfx_ctx_fpga_show_mouse, - "fpga", - gfx_ctx_fpga_get_flags, - gfx_ctx_fpga_set_flags, - NULL, - NULL, - NULL -}; - diff --git a/gfx/drivers_context/wgl_ctx.c b/gfx/drivers_context/wgl_ctx.c index 50adccee9a..f47ee6130b 100644 --- a/gfx/drivers_context/wgl_ctx.c +++ b/gfx/drivers_context/wgl_ctx.c @@ -282,14 +282,11 @@ static void create_gl_context(HWND hwnd, bool *quit) if (pcreate_context) { int i; - int (*versions)[2]; int gl_versions[][2] = {{4, 6}, {4, 5}, {4, 4}, {4, 3}, {4, 2}, {4, 1}, {4, 0}, {3, 3}, {3, 2}, {3, 1}, {3, 0}}; int gl_version_rows = ARRAY_SIZE(gl_versions); - int version_rows = 0; HGLRC context = NULL; int version_rows = gl_version_rows; - - versions = gl_versions; + int (*versions)[2] = gl_versions; /* only try higher versions when core_context is true */ if (!core_context)