Skip to content
Snippets Groups Projects
Select Git revision
  • 8c9b93f065e8258dfb0fb33503811beec50e82b4
  • main default protected
  • phhw
  • captouch-threshold
  • t
  • dos
  • test2
  • test
  • slewtest
  • simtest
  • view-think
  • vm-pending
  • media-buf
  • scope
  • passthrough
  • wave
  • vsync
  • dos-main-patch-50543
  • json-error
  • rahix/big-flow3r
  • pippin/media_framework
  • v1.3.0
  • v1.2.0
  • v1.2.0+rc1
  • v1.1.1
  • v1.1.0
  • v1.1.0+rc1
  • v1.0.0
  • v1.0.0+rc6
  • v1.0.0+rc5
  • v1.0.0+rc4
  • v1.0.0+rc3
  • v1.0.0+rc2
  • v1.0.0+rc1
34 results

st3m_gfx.c

Blame
  • Forked from flow3r / flow3r firmware
    Source project has a limited visibility.
    • pippin's avatar
      8c9b93f0
      st3m_gfx: fix initial mode set · 8c9b93f0
      pippin authored and pippin's avatar pippin committed
      This makes initial call to st3m_gfx_set_mode(st3m_gfx_default) do something,
      doesn't matter for the current configured default mode, but is neccesary in
      8bpp modes.
      8c9b93f0
      History
      st3m_gfx: fix initial mode set
      pippin authored and pippin's avatar pippin committed
      This makes initial call to st3m_gfx_set_mode(st3m_gfx_default) do something,
      doesn't matter for the current configured default mode, but is neccesary in
      8bpp modes.
    st3m_gfx.c 28.79 KiB
    #include "st3m_gfx.h"
    // Submit a filled ctx descriptor to the rasterization pipeline.
    
    #include <string.h>
    
    #include <pthread.h>
    #include "esp_log.h"
    #include "esp_system.h"
    #include "esp_task.h"
    #include "esp_timer.h"
    #include "freertos/FreeRTOS.h"
    #include "freertos/queue.h"
    
    // clang-format off
    #include "ctx_config.h"
    #include "ctx.h"
    // clang-format on
    
    #include "flow3r_bsp.h"
    #include "st3m_counter.h"
    #include "st3m_version.h"
    
    #define ST3M_GFX_DEFAULT_MODE st3m_gfx_16bpp_osd
    
    static EXT_RAM_BSS_ATTR uint16_t fb[240 * 240];
    
    // Get a free drawlist ctx to draw into.
    //
    // ticks_to_wait can be used to limit the time to wait for a free ctx
    // descriptor, or portDELAY_MAX can be specified to wait forever. If the timeout
    // expires, NULL will be returned.
    static Ctx *st3m_gfx_drawctx_free_get(TickType_t ticks_to_wait);
    
    // Submit a filled ctx descriptor to the rasterization pipeline.
    static void st3m_gfx_drawctx_pipe_put(void);
    
    static const char *TAG = "st3m-gfx";
    
    #define N_DRAWLISTS 3
    
    // we keep the OSD buffer the same size as the main framebuffer,
    // allowing us to do different combos of which buffer is osd and not
    #define ST3M_OSD_WIDTH 240
    #define ST3M_OSD_HEIGHT 240
    #define ST3M_OSD_X 0
    #define ST3M_OSD_Y 0
    
    static st3m_gfx_mode _st3m_gfx_mode = st3m_gfx_default + 1;
    
    EXT_RAM_BSS_ATTR static uint8_t
        st3m_osd_fb[ST3M_OSD_WIDTH * ST3M_OSD_HEIGHT * 4];
    EXT_RAM_BSS_ATTR uint16_t st3m_osd_backup[ST3M_OSD_WIDTH * ST3M_OSD_HEIGHT];
    
    // drawlist ctx
    static Ctx *user_ctx[N_DRAWLISTS];
    
    // each frame buffer has an associated rasterizer context
    static Ctx *fb_GRAY8_ctx = NULL;
    static Ctx *fb_GRAYA8_ctx = NULL;
    static Ctx *fb_RGB565_BS_ctx = NULL;
    static Ctx *fb_RGBA8_ctx = NULL;
    
    // corner pixel coordinates for osd clip
    
    static pthread_mutex_t osd_mutex = PTHREAD_MUTEX_INITIALIZER;
    
    static int _st3m_osd_y1[N_DRAWLISTS + 1];
    static int _st3m_osd_x1[N_DRAWLISTS + 1];
    static int _st3m_osd_y0[N_DRAWLISTS + 1];
    static int _st3m_osd_x0[N_DRAWLISTS + 1];