Skip to content

Commit 0dfcf80

Browse files
dhobsongLaurent Pinchart
authored andcommitted
drm: rcar-du: Add more formats to DRM_MODE_BLEND_PIXEL_NONE support
Add additional pixel formats for which blending is disabled when DRM_MODE_BLEND_PIXEL_NONE is set. Refactor the fourcc selection into a separate function to handle the increased number of formats. Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
1 parent 6e6c74a commit 0dfcf80

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

drivers/gpu/drm/renesas/rcar-du/rcar_du_vsp.c

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,37 @@ static const u32 rcar_du_vsp_formats_gen4[] = {
177177
DRM_FORMAT_Y212,
178178
};
179179

180+
static u32 rcar_du_vsp_state_get_format(struct rcar_du_vsp_plane_state *state)
181+
{
182+
u32 fourcc = state->format->fourcc;
183+
184+
if (state->state.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) {
185+
switch (fourcc) {
186+
case DRM_FORMAT_ARGB1555:
187+
fourcc = DRM_FORMAT_XRGB1555;
188+
break;
189+
190+
case DRM_FORMAT_ARGB4444:
191+
fourcc = DRM_FORMAT_XRGB4444;
192+
break;
193+
194+
case DRM_FORMAT_ARGB8888:
195+
fourcc = DRM_FORMAT_XRGB8888;
196+
break;
197+
198+
case DRM_FORMAT_BGRA8888:
199+
fourcc = DRM_FORMAT_BGRX8888;
200+
break;
201+
202+
case DRM_FORMAT_RGBA1010102:
203+
fourcc = DRM_FORMAT_RGBX1010102;
204+
break;
205+
}
206+
}
207+
208+
return fourcc;
209+
}
210+
180211
static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
181212
{
182213
struct rcar_du_vsp_plane_state *state =
@@ -190,7 +221,7 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
190221
.alpha = state->state.alpha >> 8,
191222
.zpos = state->state.zpos,
192223
};
193-
u32 fourcc = state->format->fourcc;
224+
u32 fourcc = rcar_du_vsp_state_get_format(state);
194225
unsigned int i;
195226

196227
cfg.src.left = state->state.src.x1 >> 16;
@@ -207,22 +238,6 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
207238
cfg.mem[i] = sg_dma_address(state->sg_tables[i].sgl)
208239
+ fb->offsets[i];
209240

210-
if (state->state.pixel_blend_mode == DRM_MODE_BLEND_PIXEL_NONE) {
211-
switch (fourcc) {
212-
case DRM_FORMAT_ARGB1555:
213-
fourcc = DRM_FORMAT_XRGB1555;
214-
break;
215-
216-
case DRM_FORMAT_ARGB4444:
217-
fourcc = DRM_FORMAT_XRGB4444;
218-
break;
219-
220-
case DRM_FORMAT_ARGB8888:
221-
fourcc = DRM_FORMAT_XRGB8888;
222-
break;
223-
}
224-
}
225-
226241
format = rcar_du_format_info(fourcc);
227242
cfg.pixelformat = format->v4l2;
228243

0 commit comments

Comments
 (0)