Skip to content

Commit

Permalink
backend: Export/import the Backend config as JSON
Browse files Browse the repository at this point in the history
Add a new helper BackEnd::GetJsonConfig() to return a JSON string of
the current Backend register configuration and tile data. The parameters
are the actual register values to be programmed into the hardware, and
currently all dumped as unsigned.

Add a check for the environment variable LIBPISP_CONFIG_DUMP, and if if
it is set, use the filename provided to dump the config/tile JSON output
as a one-shot operation.

Add a new helper BackEnd::SetJsonConfig() to read a JSON string and
import the Backend register configuration. Tile data does not get
imported, and will need a BackEnd::Prepare() call to re-generate the
tile data.

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Nov 7, 2023
1 parent 4b19cee commit 0035b40
Show file tree
Hide file tree
Showing 4 changed files with 581 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libpisp/backend/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once

#include <map>
#include <string>
#include <vector>

#include "common/shm_mutex.hpp"
Expand Down Expand Up @@ -130,6 +131,9 @@ class BackEnd

unsigned int GetMaxDownscale() const;

std::string GetJsonConfig(pisp_be_tiles_config *config);
void SetJsonConfig(const std::string &json_config);

void lock()
{
mutex_.lock();
Expand Down Expand Up @@ -175,6 +179,7 @@ class BackEnd
std::vector<std::pair<double, std::string>> resample_select_list_;
pisp_be_sharpen_config default_sharpen_;
pisp_be_sh_fc_combine_config default_shfc_;
std::string last_dump_file_;
};

} // namespace libpisp
Loading

0 comments on commit 0035b40

Please sign in to comment.