mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 17:48:06 +02:00
backend-drm: do not init color encoding and range props with __COUNT
Let's follow the code design of the other properties: init them with _DEFAULT. In the setter function we ensure they are >= 0 and < COUNT, just like we do with other properties. Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
parent
0024857086
commit
85ee1df12b
2 changed files with 13 additions and 8 deletions
|
|
@ -37,6 +37,7 @@
|
|||
#include <libweston/libweston.h>
|
||||
#include <libweston/backend-drm.h>
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/weston-assert.h"
|
||||
#include "shared/weston-drm-fourcc.h"
|
||||
#include "drm-internal.h"
|
||||
#include "pixel-formats.h"
|
||||
|
|
@ -1258,8 +1259,10 @@ drm_plane_set_color_encoding(struct drm_plane *plane,
|
|||
enum wdrm_plane_color_encoding color_encoding,
|
||||
drmModeAtomicReq *req)
|
||||
{
|
||||
if (color_encoding == WDRM_PLANE_COLOR_ENCODING__COUNT)
|
||||
return 0;
|
||||
struct weston_compositor *wc = plane->base.compositor;
|
||||
|
||||
weston_assert_s32_ge(wc, color_encoding, 0);
|
||||
weston_assert_s32_lt(wc, color_encoding, WDRM_PLANE_COLOR_ENCODING__COUNT);
|
||||
|
||||
if (plane->props[WDRM_PLANE_COLOR_ENCODING].prop_id == 0) {
|
||||
if (color_encoding == WDRM_PLANE_COLOR_ENCODING_DEFAULT)
|
||||
|
|
@ -1268,7 +1271,7 @@ drm_plane_set_color_encoding(struct drm_plane *plane,
|
|||
return -1;
|
||||
}
|
||||
|
||||
assert(drm_plane_supports_color_encoding(plane, color_encoding));
|
||||
weston_assert_true(wc, drm_plane_supports_color_encoding(plane, color_encoding));
|
||||
|
||||
return plane_add_prop(req, plane, WDRM_PLANE_COLOR_ENCODING,
|
||||
color_encoding);
|
||||
|
|
@ -1279,8 +1282,10 @@ drm_plane_set_color_range(struct drm_plane *plane,
|
|||
enum wdrm_plane_color_range color_range,
|
||||
drmModeAtomicReq *req)
|
||||
{
|
||||
if (color_range == WDRM_PLANE_COLOR_RANGE__COUNT)
|
||||
return 0;
|
||||
struct weston_compositor *wc = plane->base.compositor;
|
||||
|
||||
weston_assert_s32_ge(wc, color_range, 0);
|
||||
weston_assert_s32_lt(wc, color_range, WDRM_PLANE_COLOR_RANGE__COUNT);
|
||||
|
||||
if (plane->props[WDRM_PLANE_COLOR_RANGE].prop_id == 0) {
|
||||
if (color_range == WDRM_PLANE_COLOR_RANGE_DEFAULT)
|
||||
|
|
@ -1289,7 +1294,7 @@ drm_plane_set_color_range(struct drm_plane *plane,
|
|||
return -1;
|
||||
}
|
||||
|
||||
assert(drm_plane_supports_color_range(plane, color_range));
|
||||
weston_assert_true(wc, drm_plane_supports_color_range(plane, color_range));
|
||||
|
||||
return plane_add_prop(req, plane, WDRM_PLANE_COLOR_RANGE, color_range);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ drm_plane_state_alloc(struct drm_output_state *state_output,
|
|||
state->alpha = (plane->alpha_max < DRM_PLANE_ALPHA_OPAQUE) ?
|
||||
plane->alpha_max : DRM_PLANE_ALPHA_OPAQUE;
|
||||
|
||||
state->color_encoding = WDRM_PLANE_COLOR_ENCODING__COUNT;
|
||||
state->color_range = WDRM_PLANE_COLOR_RANGE__COUNT;
|
||||
state->color_encoding = WDRM_PLANE_COLOR_ENCODING_DEFAULT;
|
||||
state->color_range = WDRM_PLANE_COLOR_RANGE_DEFAULT;
|
||||
|
||||
/* Here we only add the plane state to the desired link, and not
|
||||
* set the member. Having an output pointer set means that the
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue