summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-01-30 15:11:35 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2018-02-09 03:50:11 +0000
commitac087eb40daa8323bce1c16175ac34642dc9c50a (patch)
treea54ad1de6cd01612d00fd360c6d9b2b894984fc4
parent6a7e3a152e55b1ff9c56977638eb18d36aed30f6 (diff)
renderonly: fix dumb BO allocation for non 32bpp formats
Take into account the resource format, instead of applying a hardcoded 32bpp. This not only over-allocates 16bpp formats, but also results in a wrong stride being filled into the handle. Fixes: 848b49b288f ("gallium: add renderonly library") CC: <mesa-stable@lists.freedesktop.org> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Daniel Stone <daniels@collabora.com> (cherry picked from commit 0c71a19fe4368beaaf7ac676403b3079ad658890)
-rw-r--r--src/gallium/auxiliary/renderonly/renderonly.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c
index da91f12b2ea..d31f458845c 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -33,6 +33,7 @@
#include "state_tracker/drm_driver.h"
#include "pipe/p_screen.h"
+#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
@@ -73,7 +74,7 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc,
struct drm_mode_create_dumb create_dumb = {
.width = rsc->width0,
.height = rsc->height0,
- .bpp = 32,
+ .bpp = util_format_get_blocksizebits(rsc->format),
};
struct drm_mode_destroy_dumb destroy_dumb = { };