提交 90844f00 编写于 作者: E Eric Engestrom 提交者: Daniel Vetter

drm: make drm_get_format_name thread-safe

Signed-off-by: NEric Engestrom <eric@engestrom.ch>
[danvet: Clarify that the returned pointer must be freed with
kfree().]
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 fc93ff60
...@@ -2071,6 +2071,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2071,6 +2071,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
u32 tmp, viewport_w, viewport_h; u32 tmp, viewport_w, viewport_h;
int r; int r;
bool bypass_lut = false; bool bypass_lut = false;
const char *format_name;
/* no fb bound */ /* no fb bound */
if (!atomic && !crtc->primary->fb) { if (!atomic && !crtc->primary->fb) {
...@@ -2182,8 +2183,9 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2182,8 +2183,9 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true; bypass_lut = true;
break; break;
default: default:
DRM_ERROR("Unsupported screen format %s\n", format_name = drm_get_format_name(target_fb->pixel_format);
drm_get_format_name(target_fb->pixel_format)); DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -2046,6 +2046,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2046,6 +2046,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
u32 tmp, viewport_w, viewport_h; u32 tmp, viewport_w, viewport_h;
int r; int r;
bool bypass_lut = false; bool bypass_lut = false;
const char *format_name;
/* no fb bound */ /* no fb bound */
if (!atomic && !crtc->primary->fb) { if (!atomic && !crtc->primary->fb) {
...@@ -2157,8 +2158,9 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2157,8 +2158,9 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true; bypass_lut = true;
break; break;
default: default:
DRM_ERROR("Unsupported screen format %s\n", format_name = drm_get_format_name(target_fb->pixel_format);
drm_get_format_name(target_fb->pixel_format)); DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1952,6 +1952,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1952,6 +1952,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
u32 viewport_w, viewport_h; u32 viewport_w, viewport_h;
int r; int r;
bool bypass_lut = false; bool bypass_lut = false;
const char *format_name;
/* no fb bound */ /* no fb bound */
if (!atomic && !crtc->primary->fb) { if (!atomic && !crtc->primary->fb) {
...@@ -2056,8 +2057,9 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -2056,8 +2057,9 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true; bypass_lut = true;
break; break;
default: default:
DRM_ERROR("Unsupported screen format %s\n", format_name = drm_get_format_name(target_fb->pixel_format);
drm_get_format_name(target_fb->pixel_format)); DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -837,8 +837,9 @@ static int drm_atomic_plane_check(struct drm_plane *plane, ...@@ -837,8 +837,9 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
/* Check whether this plane supports the fb pixel format. */ /* Check whether this plane supports the fb pixel format. */
ret = drm_plane_check_pixel_format(plane, state->fb->pixel_format); ret = drm_plane_check_pixel_format(plane, state->fb->pixel_format);
if (ret) { if (ret) {
DRM_DEBUG_ATOMIC("Invalid pixel format %s\n", const char *format_name = drm_get_format_name(state->fb->pixel_format);
drm_get_format_name(state->fb->pixel_format)); DRM_DEBUG_ATOMIC("Invalid pixel format %s\n", format_name);
kfree(format_name);
return ret; return ret;
} }
......
...@@ -2592,8 +2592,9 @@ static int __setplane_internal(struct drm_plane *plane, ...@@ -2592,8 +2592,9 @@ static int __setplane_internal(struct drm_plane *plane,
/* Check whether this plane supports the fb pixel format. */ /* Check whether this plane supports the fb pixel format. */
ret = drm_plane_check_pixel_format(plane, fb->pixel_format); ret = drm_plane_check_pixel_format(plane, fb->pixel_format);
if (ret) { if (ret) {
DRM_DEBUG_KMS("Invalid pixel format %s\n", const char *format_name = drm_get_format_name(fb->pixel_format);
drm_get_format_name(fb->pixel_format)); DRM_DEBUG_KMS("Invalid pixel format %s\n", format_name);
kfree(format_name);
goto out; goto out;
} }
...@@ -2902,8 +2903,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -2902,8 +2903,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
ret = drm_plane_check_pixel_format(crtc->primary, ret = drm_plane_check_pixel_format(crtc->primary,
fb->pixel_format); fb->pixel_format);
if (ret) { if (ret) {
DRM_DEBUG_KMS("Invalid pixel format %s\n", const char *format_name = drm_get_format_name(fb->pixel_format);
drm_get_format_name(fb->pixel_format)); DRM_DEBUG_KMS("Invalid pixel format %s\n", format_name);
kfree(format_name);
goto out; goto out;
} }
} }
...@@ -3279,6 +3281,7 @@ int drm_mode_addfb(struct drm_device *dev, ...@@ -3279,6 +3281,7 @@ int drm_mode_addfb(struct drm_device *dev,
static int format_check(const struct drm_mode_fb_cmd2 *r) static int format_check(const struct drm_mode_fb_cmd2 *r)
{ {
uint32_t format = r->pixel_format & ~DRM_FORMAT_BIG_ENDIAN; uint32_t format = r->pixel_format & ~DRM_FORMAT_BIG_ENDIAN;
const char *format_name;
switch (format) { switch (format) {
case DRM_FORMAT_C8: case DRM_FORMAT_C8:
...@@ -3343,8 +3346,9 @@ static int format_check(const struct drm_mode_fb_cmd2 *r) ...@@ -3343,8 +3346,9 @@ static int format_check(const struct drm_mode_fb_cmd2 *r)
case DRM_FORMAT_YVU444: case DRM_FORMAT_YVU444:
return 0; return 0;
default: default:
DRM_DEBUG_KMS("invalid pixel format %s\n", format_name = drm_get_format_name(r->pixel_format);
drm_get_format_name(r->pixel_format)); DRM_DEBUG_KMS("invalid pixel format %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -3355,8 +3359,9 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r) ...@@ -3355,8 +3359,9 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
ret = format_check(r); ret = format_check(r);
if (ret) { if (ret) {
DRM_DEBUG_KMS("bad framebuffer format %s\n", const char *format_name = drm_get_format_name(r->pixel_format);
drm_get_format_name(r->pixel_format)); DRM_DEBUG_KMS("bad framebuffer format %s\n", format_name);
kfree(format_name);
return ret; return ret;
} }
......
...@@ -39,16 +39,14 @@ static char printable_char(int c) ...@@ -39,16 +39,14 @@ static char printable_char(int c)
* drm_get_format_name - return a string for drm fourcc format * drm_get_format_name - return a string for drm fourcc format
* @format: format to compute name of * @format: format to compute name of
* *
* Note that the buffer used by this function is globally shared and owned by * Note that the buffer returned by this function is owned by the caller
* the function itself. * and will need to be freed using kfree().
*
* FIXME: This isn't really multithreading safe.
*/ */
const char *drm_get_format_name(uint32_t format) const char *drm_get_format_name(uint32_t format)
{ {
static char buf[32]; char *buf = kmalloc(32, GFP_KERNEL);
snprintf(buf, sizeof(buf), snprintf(buf, 32,
"%c%c%c%c %s-endian (0x%08x)", "%c%c%c%c %s-endian (0x%08x)",
printable_char(format & 0xff), printable_char(format & 0xff),
printable_char((format >> 8) & 0xff), printable_char((format >> 8) & 0xff),
...@@ -73,6 +71,8 @@ EXPORT_SYMBOL(drm_get_format_name); ...@@ -73,6 +71,8 @@ EXPORT_SYMBOL(drm_get_format_name);
void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
int *bpp) int *bpp)
{ {
const char *format_name;
switch (format) { switch (format) {
case DRM_FORMAT_C8: case DRM_FORMAT_C8:
case DRM_FORMAT_RGB332: case DRM_FORMAT_RGB332:
...@@ -127,8 +127,9 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, ...@@ -127,8 +127,9 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
*bpp = 32; *bpp = 32;
break; break;
default: default:
DRM_DEBUG_KMS("unsupported pixel format %s\n", format_name = drm_get_format_name(format);
drm_get_format_name(format)); DRM_DEBUG_KMS("unsupported pixel format %s\n", format_name);
kfree(format_name);
*depth = 0; *depth = 0;
*bpp = 0; *bpp = 0;
break; break;
......
...@@ -608,15 +608,17 @@ static void ade_rdma_set(void __iomem *base, struct drm_framebuffer *fb, ...@@ -608,15 +608,17 @@ static void ade_rdma_set(void __iomem *base, struct drm_framebuffer *fb,
u32 ch, u32 y, u32 in_h, u32 fmt) u32 ch, u32 y, u32 in_h, u32 fmt)
{ {
struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, 0); struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, 0);
const char *format_name;
u32 reg_ctrl, reg_addr, reg_size, reg_stride, reg_space, reg_en; u32 reg_ctrl, reg_addr, reg_size, reg_stride, reg_space, reg_en;
u32 stride = fb->pitches[0]; u32 stride = fb->pitches[0];
u32 addr = (u32)obj->paddr + y * stride; u32 addr = (u32)obj->paddr + y * stride;
DRM_DEBUG_DRIVER("rdma%d: (y=%d, height=%d), stride=%d, paddr=0x%x\n", DRM_DEBUG_DRIVER("rdma%d: (y=%d, height=%d), stride=%d, paddr=0x%x\n",
ch + 1, y, in_h, stride, (u32)obj->paddr); ch + 1, y, in_h, stride, (u32)obj->paddr);
format_name = drm_get_format_name(fb->pixel_format);
DRM_DEBUG_DRIVER("addr=0x%x, fb:%dx%d, pixel_format=%d(%s)\n", DRM_DEBUG_DRIVER("addr=0x%x, fb:%dx%d, pixel_format=%d(%s)\n",
addr, fb->width, fb->height, fmt, addr, fb->width, fb->height, fmt, format_name);
drm_get_format_name(fb->pixel_format)); kfree(format_name);
/* get reg offset */ /* get reg offset */
reg_ctrl = RD_CH_CTRL(ch); reg_ctrl = RD_CH_CTRL(ch);
......
...@@ -3113,6 +3113,7 @@ static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc) ...@@ -3113,6 +3113,7 @@ static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc)
for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) { for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
struct drm_plane_state *state; struct drm_plane_state *state;
struct drm_plane *plane = &intel_plane->base; struct drm_plane *plane = &intel_plane->base;
const char *format_name;
if (!plane->state) { if (!plane->state) {
seq_puts(m, "plane->state is NULL!\n"); seq_puts(m, "plane->state is NULL!\n");
...@@ -3121,6 +3122,12 @@ static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc) ...@@ -3121,6 +3122,12 @@ static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc)
state = plane->state; state = plane->state;
if (state->fb) {
format_name = drm_get_format_name(state->fb->pixel_format);
} else {
format_name = kstrdup("N/A", GFP_KERNEL);
}
seq_printf(m, "\t--Plane id %d: type=%s, crtc_pos=%4dx%4d, crtc_size=%4dx%4d, src_pos=%d.%04ux%d.%04u, src_size=%d.%04ux%d.%04u, format=%s, rotation=%s\n", seq_printf(m, "\t--Plane id %d: type=%s, crtc_pos=%4dx%4d, crtc_size=%4dx%4d, src_pos=%d.%04ux%d.%04u, src_size=%d.%04ux%d.%04u, format=%s, rotation=%s\n",
plane->base.id, plane->base.id,
plane_type(intel_plane->base.type), plane_type(intel_plane->base.type),
...@@ -3134,8 +3141,10 @@ static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc) ...@@ -3134,8 +3141,10 @@ static void intel_plane_info(struct seq_file *m, struct intel_crtc *intel_crtc)
((state->src_w & 0xffff) * 15625) >> 10, ((state->src_w & 0xffff) * 15625) >> 10,
(state->src_h >> 16), (state->src_h >> 16),
((state->src_h & 0xffff) * 15625) >> 10, ((state->src_h & 0xffff) * 15625) >> 10,
state->fb ? drm_get_format_name(state->fb->pixel_format) : "N/A", format_name,
plane_rotation(state->rotation)); plane_rotation(state->rotation));
kfree(format_name);
} }
} }
......
...@@ -143,6 +143,7 @@ static int intel_plane_atomic_check(struct drm_plane *plane, ...@@ -143,6 +143,7 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
crtc_state->base.enable ? crtc_state->pipe_src_h : 0; crtc_state->base.enable ? crtc_state->pipe_src_h : 0;
if (state->fb && intel_rotation_90_or_270(state->rotation)) { if (state->fb && intel_rotation_90_or_270(state->rotation)) {
const char *format_name;
if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) { state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) {
DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n"); DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n");
...@@ -157,8 +158,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane, ...@@ -157,8 +158,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
switch (state->fb->pixel_format) { switch (state->fb->pixel_format) {
case DRM_FORMAT_C8: case DRM_FORMAT_C8:
case DRM_FORMAT_RGB565: case DRM_FORMAT_RGB565:
DRM_DEBUG_KMS("Unsupported pixel format %s for 90/270!\n", format_name = drm_get_format_name(state->fb->pixel_format);
drm_get_format_name(state->fb->pixel_format)); DRM_DEBUG_KMS("Unsupported pixel format %s for 90/270!\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
default: default:
......
...@@ -12258,6 +12258,7 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, ...@@ -12258,6 +12258,7 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
DRM_DEBUG_KMS("planes on this crtc\n"); DRM_DEBUG_KMS("planes on this crtc\n");
list_for_each_entry(plane, &dev->mode_config.plane_list, head) { list_for_each_entry(plane, &dev->mode_config.plane_list, head) {
const char *format_name;
intel_plane = to_intel_plane(plane); intel_plane = to_intel_plane(plane);
if (intel_plane->pipe != crtc->pipe) if (intel_plane->pipe != crtc->pipe)
continue; continue;
...@@ -12270,11 +12271,12 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, ...@@ -12270,11 +12271,12 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
continue; continue;
} }
format_name = drm_get_format_name(fb->pixel_format);
DRM_DEBUG_KMS("[PLANE:%d:%s] enabled", DRM_DEBUG_KMS("[PLANE:%d:%s] enabled",
plane->base.id, plane->name); plane->base.id, plane->name);
DRM_DEBUG_KMS("\tFB:%d, fb = %ux%u format = %s", DRM_DEBUG_KMS("\tFB:%d, fb = %ux%u format = %s",
fb->base.id, fb->width, fb->height, fb->base.id, fb->width, fb->height, format_name);
drm_get_format_name(fb->pixel_format));
DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n", DRM_DEBUG_KMS("\tscaler:%d src %dx%d+%d+%d dst %dx%d+%d+%d\n",
state->scaler_id, state->scaler_id,
state->base.src.x1 >> 16, state->base.src.x1 >> 16,
...@@ -12284,6 +12286,8 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc, ...@@ -12284,6 +12286,8 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
state->base.dst.x1, state->base.dst.y1, state->base.dst.x1, state->base.dst.y1,
drm_rect_width(&state->base.dst), drm_rect_width(&state->base.dst),
drm_rect_height(&state->base.dst)); drm_rect_height(&state->base.dst));
kfree(format_name);
} }
} }
...@@ -14911,6 +14915,7 @@ static int intel_framebuffer_init(struct drm_device *dev, ...@@ -14911,6 +14915,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
unsigned int aligned_height; unsigned int aligned_height;
int ret; int ret;
u32 pitch_limit, stride_alignment; u32 pitch_limit, stride_alignment;
const char *format_name;
WARN_ON(!mutex_is_locked(&dev->struct_mutex)); WARN_ON(!mutex_is_locked(&dev->struct_mutex));
...@@ -14985,16 +14990,18 @@ static int intel_framebuffer_init(struct drm_device *dev, ...@@ -14985,16 +14990,18 @@ static int intel_framebuffer_init(struct drm_device *dev,
break; break;
case DRM_FORMAT_XRGB1555: case DRM_FORMAT_XRGB1555:
if (INTEL_INFO(dev)->gen > 3) { if (INTEL_INFO(dev)->gen > 3) {
DRM_DEBUG("unsupported pixel format: %s\n", format_name = drm_get_format_name(mode_cmd->pixel_format);
drm_get_format_name(mode_cmd->pixel_format)); DRM_DEBUG("unsupported pixel format: %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
break; break;
case DRM_FORMAT_ABGR8888: case DRM_FORMAT_ABGR8888:
if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev) && if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev) &&
INTEL_INFO(dev)->gen < 9) { INTEL_INFO(dev)->gen < 9) {
DRM_DEBUG("unsupported pixel format: %s\n", format_name = drm_get_format_name(mode_cmd->pixel_format);
drm_get_format_name(mode_cmd->pixel_format)); DRM_DEBUG("unsupported pixel format: %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
break; break;
...@@ -15002,15 +15009,17 @@ static int intel_framebuffer_init(struct drm_device *dev, ...@@ -15002,15 +15009,17 @@ static int intel_framebuffer_init(struct drm_device *dev,
case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_XBGR2101010:
if (INTEL_INFO(dev)->gen < 4) { if (INTEL_INFO(dev)->gen < 4) {
DRM_DEBUG("unsupported pixel format: %s\n", format_name = drm_get_format_name(mode_cmd->pixel_format);
drm_get_format_name(mode_cmd->pixel_format)); DRM_DEBUG("unsupported pixel format: %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
break; break;
case DRM_FORMAT_ABGR2101010: case DRM_FORMAT_ABGR2101010:
if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) {
DRM_DEBUG("unsupported pixel format: %s\n", format_name = drm_get_format_name(mode_cmd->pixel_format);
drm_get_format_name(mode_cmd->pixel_format)); DRM_DEBUG("unsupported pixel format: %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
break; break;
...@@ -15019,14 +15028,16 @@ static int intel_framebuffer_init(struct drm_device *dev, ...@@ -15019,14 +15028,16 @@ static int intel_framebuffer_init(struct drm_device *dev,
case DRM_FORMAT_YVYU: case DRM_FORMAT_YVYU:
case DRM_FORMAT_VYUY: case DRM_FORMAT_VYUY:
if (INTEL_INFO(dev)->gen < 5) { if (INTEL_INFO(dev)->gen < 5) {
DRM_DEBUG("unsupported pixel format: %s\n", format_name = drm_get_format_name(mode_cmd->pixel_format);
drm_get_format_name(mode_cmd->pixel_format)); DRM_DEBUG("unsupported pixel format: %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
break; break;
default: default:
DRM_DEBUG("unsupported pixel format: %s\n", format_name = drm_get_format_name(mode_cmd->pixel_format);
drm_get_format_name(mode_cmd->pixel_format)); DRM_DEBUG("unsupported pixel format: %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -1154,6 +1154,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1154,6 +1154,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
u32 tmp, viewport_w, viewport_h; u32 tmp, viewport_w, viewport_h;
int r; int r;
bool bypass_lut = false; bool bypass_lut = false;
const char *format_name;
/* no fb bound */ /* no fb bound */
if (!atomic && !crtc->primary->fb) { if (!atomic && !crtc->primary->fb) {
...@@ -1257,8 +1258,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1257,8 +1258,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true; bypass_lut = true;
break; break;
default: default:
DRM_ERROR("Unsupported screen format %s\n", format_name = drm_get_format_name(target_fb->pixel_format);
drm_get_format_name(target_fb->pixel_format)); DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
...@@ -1469,6 +1471,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1469,6 +1471,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
u32 viewport_w, viewport_h; u32 viewport_w, viewport_h;
int r; int r;
bool bypass_lut = false; bool bypass_lut = false;
const char *format_name;
/* no fb bound */ /* no fb bound */
if (!atomic && !crtc->primary->fb) { if (!atomic && !crtc->primary->fb) {
...@@ -1558,8 +1561,9 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, ...@@ -1558,8 +1561,9 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
bypass_lut = true; bypass_lut = true;
break; break;
default: default:
DRM_ERROR("Unsupported screen format %s\n", format_name = drm_get_format_name(target_fb->pixel_format);
drm_get_format_name(target_fb->pixel_format)); DRM_ERROR("Unsupported screen format %s\n", format_name);
kfree(format_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -32,6 +32,6 @@ int drm_format_horz_chroma_subsampling(uint32_t format); ...@@ -32,6 +32,6 @@ int drm_format_horz_chroma_subsampling(uint32_t format);
int drm_format_vert_chroma_subsampling(uint32_t format); int drm_format_vert_chroma_subsampling(uint32_t format);
int drm_format_plane_width(int width, uint32_t format, int plane); int drm_format_plane_width(int width, uint32_t format, int plane);
int drm_format_plane_height(int height, uint32_t format, int plane); int drm_format_plane_height(int height, uint32_t format, int plane);
const char *drm_get_format_name(uint32_t format); const char *drm_get_format_name(uint32_t format) __malloc;
#endif /* __DRM_FOURCC_H__ */ #endif /* __DRM_FOURCC_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册