Skip to content

Commit

Permalink
added more scene dependencies, added tinywl
Browse files Browse the repository at this point in the history
  • Loading branch information
WillPower3309 committed Jul 11, 2023
1 parent 74e85d8 commit 9eaa07a
Show file tree
Hide file tree
Showing 40 changed files with 4,034 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# scenefx

44 changes: 44 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
description = "scenefx development environment";

inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};

nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};

outputs = { self, nixpkgs, flake-compat, ... }:
let
pkgsFor = system:
import nixpkgs {
inherit system;
overlays = [ ];
};

targetSystems = [ "aarch64-linux" "x86_64-linux" ];
in
{
devShells = nixpkgs.lib.genAttrs targetSystems (system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
name = "scenefx-shell";
depsBuildBuild = with pkgs; [ pkg-config ];
inputsFrom = [ pkgs.wlroots_0_16 ];

nativeBuildInputs = with pkgs; [
cmake
meson
ninja
pkg-config
wayland-scanner
scdoc
hwdata
];

# shellHook = with pkgs; ''(
# mkdir -p "$PWD/subprojects"
# cd "$PWD/subprojects"
# cp -R --no-preserve=mode,ownership ${wlroots_0_16.src} wlroots
# )'';
};
});
};
}

1 change: 1 addition & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude_files = ['meson.build', 'config.h.in', 'version.h.in']
84 changes: 84 additions & 0 deletions include/types/wlr_buffer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#ifndef TYPES_WLR_BUFFER
#define TYPES_WLR_BUFFER

#include <wlr/types/wlr_buffer.h>

struct wlr_shm_client_buffer {
struct wlr_buffer base;

uint32_t format;
size_t stride;

// The following fields are NULL if the client has destroyed the wl_buffer
struct wl_resource *resource;
struct wl_shm_buffer *shm_buffer;

// This is used to keep the backing storage alive after the client has
// destroyed the wl_buffer
struct wl_shm_pool *saved_shm_pool;
void *saved_data;

struct wl_listener resource_destroy;
struct wl_listener release;
};

struct wlr_shm_client_buffer *shm_client_buffer_get_or_create(
struct wl_resource *resource);

/**
* A read-only buffer that holds a data pointer.
*
* This is suitable for passing raw pixel data to a function that accepts a
* wlr_buffer.
*/
struct wlr_readonly_data_buffer {
struct wlr_buffer base;

const void *data;
uint32_t format;
size_t stride;

void *saved_data;
};

/**
* Wraps a read-only data pointer into a wlr_buffer. The data pointer may be
* accessed until readonly_data_buffer_drop() is called.
*/
struct wlr_readonly_data_buffer *readonly_data_buffer_create(uint32_t format,
size_t stride, uint32_t width, uint32_t height, const void *data);
/**
* Drops ownership of the buffer (see wlr_buffer_drop() for more details) and
* perform a copy of the data pointer if a consumer still has the buffer locked.
*/
bool readonly_data_buffer_drop(struct wlr_readonly_data_buffer *buffer);

struct wlr_dmabuf_buffer {
struct wlr_buffer base;
struct wlr_dmabuf_attributes dmabuf;
bool saved;
};

/**
* Wraps a DMA-BUF into a wlr_buffer. The DMA-BUF may be accessed until
* dmabuf_buffer_drop() is called.
*/
struct wlr_dmabuf_buffer *dmabuf_buffer_create(
struct wlr_dmabuf_attributes *dmabuf);
/**
* Drops ownership of the buffer (see wlr_buffer_drop() for more details) and
* takes a reference to the DMA-BUF (by dup'ing its file descriptors) if a
* consumer still has the buffer locked.
*/
bool dmabuf_buffer_drop(struct wlr_dmabuf_buffer *buffer);

/**
* Check whether a buffer is fully opaque.
*
* When true is returned, the buffer is guaranteed to be fully opaque, but the
* reverse is not true: false may be returned in cases where the buffer is fully
* opaque.
*/
bool buffer_is_opaque(struct wlr_buffer *buffer);

#endif
8 changes: 8 additions & 0 deletions include/types/wlr_scene.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef TYPES_WLR_SCENE_H
#define TYPES_WLR_SCENE_H

#include <wlr/types/wlr_scene.h>

struct wlr_scene *scene_node_get_root(struct wlr_scene_node *node);

#endif
18 changes: 18 additions & 0 deletions include/util/array.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef UTIL_ARRAY_H
#define UTIL_ARRAY_H

#include <stdlib.h>
#include <stdbool.h>
#include <wayland-util.h>

/**
* Remove a chunk of memory of the specified size at the specified offset.
*/
void array_remove_at(struct wl_array *arr, size_t offset, size_t size);

/**
* Grow or shrink the array to fit the specifized size.
*/
bool array_realloc(struct wl_array *arr, size_t size);

#endif
11 changes: 11 additions & 0 deletions include/util/env.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef UTIL_ENV_H
#define UTIL_ENV_H

#include <stdbool.h>
#include <unistd.h>

bool env_parse_bool(const char *option);

ssize_t env_parse_switch(const char *option, const char **switches);

#endif
27 changes: 27 additions & 0 deletions include/util/time.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef UTIL_TIME_H
#define UTIL_TIME_H

#include <time.h>

/**
* Get the current time, in milliseconds.
*/
uint32_t get_current_time_msec(void);

/**
* Convert a timespec to milliseconds.
*/
int64_t timespec_to_msec(const struct timespec *a);

/**
* Convert nanoseconds to a timespec.
*/
void timespec_from_nsec(struct timespec *r, int64_t nsec);

/**
* Subtracts timespec `b` from timespec `a`, and stores the difference in `r`.
*/
void timespec_sub(struct timespec *r, const struct timespec *a,
const struct timespec *b);

#endif
Loading

0 comments on commit 9eaa07a

Please sign in to comment.