mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
drm/vkms: Use const for input pointers in pixel_read an pixel_write functions
As the pixel_read and pixel_write function should never modify the input buffer, mark those pointers const. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com> Reviewed-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: José Expósito <jose.exposito89@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241118-yuv-v14-4-2dbc2f1e222c@bootlin.com Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
This commit is contained in:
parent
b21b580e57
commit
51091b4ab2
|
|
@ -61,7 +61,7 @@ struct line_buffer {
|
|||
* @out_pixel: destination address to write the pixel
|
||||
* @in_pixel: pixel to write
|
||||
*/
|
||||
typedef void (*pixel_write_t)(u8 *out_pixel, struct pixel_argb_u16 *in_pixel);
|
||||
typedef void (*pixel_write_t)(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel);
|
||||
|
||||
struct vkms_writeback_job {
|
||||
struct iosys_map data[DRM_FORMAT_MAX_PLANES];
|
||||
|
|
@ -76,7 +76,7 @@ struct vkms_writeback_job {
|
|||
* @in_pixel: pointer to the pixel to read
|
||||
* @out_pixel: pointer to write the converted pixel
|
||||
*/
|
||||
typedef void (*pixel_read_t)(u8 *in_pixel, struct pixel_argb_u16 *out_pixel);
|
||||
typedef void (*pixel_read_t)(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel);
|
||||
|
||||
/**
|
||||
* struct vkms_plane_state - Driver specific plane state
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static int get_x_position(const struct vkms_frame_info *frame_info, int limit, i
|
|||
* They are used in the vkms_compose_row() function to handle multiple formats.
|
||||
*/
|
||||
|
||||
static void ARGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
static void ARGB8888_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
{
|
||||
/*
|
||||
* The 257 is the "conversion ratio". This number is obtained by the
|
||||
|
|
@ -89,7 +89,7 @@ static void ARGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
|||
out_pixel->b = (u16)in_pixel[0] * 257;
|
||||
}
|
||||
|
||||
static void XRGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
static void XRGB8888_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
{
|
||||
out_pixel->a = (u16)0xffff;
|
||||
out_pixel->r = (u16)in_pixel[2] * 257;
|
||||
|
|
@ -97,7 +97,7 @@ static void XRGB8888_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
|||
out_pixel->b = (u16)in_pixel[0] * 257;
|
||||
}
|
||||
|
||||
static void ARGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
static void ARGB16161616_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
{
|
||||
__le16 *pixel = (__le16 *)in_pixel;
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ static void ARGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pi
|
|||
out_pixel->b = le16_to_cpu(pixel[0]);
|
||||
}
|
||||
|
||||
static void XRGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
static void XRGB16161616_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
{
|
||||
__le16 *pixel = (__le16 *)in_pixel;
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ static void XRGB16161616_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pi
|
|||
out_pixel->b = le16_to_cpu(pixel[0]);
|
||||
}
|
||||
|
||||
static void RGB565_to_argb_u16(u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
static void RGB565_to_argb_u16(const u8 *in_pixel, struct pixel_argb_u16 *out_pixel)
|
||||
{
|
||||
__le16 *pixel = (__le16 *)in_pixel;
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ void vkms_compose_row(struct line_buffer *stage_buffer, struct vkms_plane_state
|
|||
* They are used in vkms_writeback_row() to convert and store a pixel from the src_buffer to
|
||||
* the writeback buffer.
|
||||
*/
|
||||
static void argb_u16_to_ARGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
||||
static void argb_u16_to_ARGB8888(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
|
||||
{
|
||||
/*
|
||||
* This sequence below is important because the format's byte order is
|
||||
|
|
@ -191,7 +191,7 @@ static void argb_u16_to_ARGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
|||
out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257);
|
||||
}
|
||||
|
||||
static void argb_u16_to_XRGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
||||
static void argb_u16_to_XRGB8888(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
|
||||
{
|
||||
out_pixel[3] = 0xff;
|
||||
out_pixel[2] = DIV_ROUND_CLOSEST(in_pixel->r, 257);
|
||||
|
|
@ -199,7 +199,7 @@ static void argb_u16_to_XRGB8888(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
|||
out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257);
|
||||
}
|
||||
|
||||
static void argb_u16_to_ARGB16161616(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
||||
static void argb_u16_to_ARGB16161616(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
|
||||
{
|
||||
__le16 *pixel = (__le16 *)out_pixel;
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ static void argb_u16_to_ARGB16161616(u8 *out_pixel, struct pixel_argb_u16 *in_pi
|
|||
pixel[0] = cpu_to_le16(in_pixel->b);
|
||||
}
|
||||
|
||||
static void argb_u16_to_XRGB16161616(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
||||
static void argb_u16_to_XRGB16161616(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
|
||||
{
|
||||
__le16 *pixel = (__le16 *)out_pixel;
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ static void argb_u16_to_XRGB16161616(u8 *out_pixel, struct pixel_argb_u16 *in_pi
|
|||
pixel[0] = cpu_to_le16(in_pixel->b);
|
||||
}
|
||||
|
||||
static void argb_u16_to_RGB565(u8 *out_pixel, struct pixel_argb_u16 *in_pixel)
|
||||
static void argb_u16_to_RGB565(u8 *out_pixel, const struct pixel_argb_u16 *in_pixel)
|
||||
{
|
||||
__le16 *pixel = (__le16 *)out_pixel;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user