Skip to content

Commit

Permalink
api/backend: backend_command doesn't need to be here
Browse files Browse the repository at this point in the history
It's not part of the public backend API.

Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Oct 15, 2024
1 parent e4eef75 commit f326ad6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 43 deletions.
43 changes: 0 additions & 43 deletions include/picom/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,49 +172,6 @@ enum backend_image_capability {
BACKEND_IMAGE_CAP_DST = 1 << 1,
};

enum backend_command_op {
BACKEND_COMMAND_INVALID = -1,
BACKEND_COMMAND_BLIT,
BACKEND_COMMAND_BLUR,
BACKEND_COMMAND_COPY_AREA,
};

/// Symbolic references used as render command source images. The actual `image_handle`
/// will later be filled in by the renderer using this symbolic reference.
enum backend_command_source {
BACKEND_COMMAND_SOURCE_WINDOW,
BACKEND_COMMAND_SOURCE_WINDOW_SAVED,
BACKEND_COMMAND_SOURCE_SHADOW,
BACKEND_COMMAND_SOURCE_BACKGROUND,
};

// TODO(yshui) might need better names

struct backend_command {
enum backend_command_op op;
ivec2 origin;
enum backend_command_source source;
union {
struct {
struct backend_blit_args blit;
/// Region of the screen that will be covered by this blit
/// operations, in screen coordinates.
region_t opaque_region;
};
struct {
image_handle source_image;
const region_t *region;
} copy_area;
struct backend_blur_args blur;
};
/// Source mask for the operation.
/// If the `source_mask` of the operation's argument points to this, a mask image
/// will be created for the operation for the renderer.
struct backend_mask_image source_mask;
/// Target mask for the operation.
region_t target_mask;
};

enum backend_quirk {
/// Backend cannot do blur quickly. The compositor will avoid using blur to create
/// shadows on this backend
Expand Down
43 changes: 43 additions & 0 deletions src/backend/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,49 @@

#include "log.h"

enum backend_command_op {
BACKEND_COMMAND_INVALID = -1,
BACKEND_COMMAND_BLIT,
BACKEND_COMMAND_BLUR,
BACKEND_COMMAND_COPY_AREA,
};

/// Symbolic references used as render command source images. The actual `image_handle`
/// will later be filled in by the renderer using this symbolic reference.
enum backend_command_source {
BACKEND_COMMAND_SOURCE_WINDOW,
BACKEND_COMMAND_SOURCE_WINDOW_SAVED,
BACKEND_COMMAND_SOURCE_SHADOW,
BACKEND_COMMAND_SOURCE_BACKGROUND,
};

// TODO(yshui) might need better names

struct backend_command {
enum backend_command_op op;
ivec2 origin;
enum backend_command_source source;
union {
struct {
struct backend_blit_args blit;
/// Region of the screen that will be covered by this blit
/// operations, in screen coordinates.
region_t opaque_region;
};
struct {
image_handle source_image;
const region_t *region;
} copy_area;
struct backend_blur_args blur;
};
/// Source mask for the operation.
/// If the `source_mask` of the operation's argument points to this, a mask image
/// will be created for the operation for the renderer.
struct backend_mask_image source_mask;
/// Target mask for the operation.
region_t target_mask;
};

bool backend_execute(struct backend_base *backend, image_handle target, unsigned ncmds,
const struct backend_command cmds[ncmds]);

Expand Down
1 change: 1 addition & 0 deletions src/renderer/command_builder.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) Yuxuan Shui <[email protected]>

#include "backend/backend.h"
#include "common.h"
#include "layout.h"
#include "utils/dynarr.h"
Expand Down
1 change: 1 addition & 0 deletions src/renderer/damage.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) Yuxuan Shui <[email protected]>

#include "backend/backend.h"
#include "layout.h"
#include "region.h"
#include "utils/dynarr.h"
Expand Down

0 comments on commit f326ad6

Please sign in to comment.