From: Axel Davy Date: Wed, 10 Apr 2019 21:03:06 +0000 (+0200) Subject: st/nine: Support internal compressed format for surfaces X-Git-Tag: upstream/19.3.0~6795 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b0a7d05575bccaf73f0e558c0ea4cf5aae0a76a;p=platform%2Fupstream%2Fmesa.git st/nine: Support internal compressed format for surfaces Reuse the generic path to support compressed formats. Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 853e5a6..d57d13e 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -481,25 +481,28 @@ NineSurface9_LockRect( struct NineSurface9 *This, if (p_atomic_read(&This->pending_uploads_counter)) nine_csmt_process(This->base.base.device); - if (This->data_internal) { - /* For now we only have uncompressed formats here */ - pLockedRect->Pitch = This->stride_internal; - pLockedRect->pBits = This->data_internal + box.y * This->stride_internal + - util_format_get_stride(This->format_internal, box.x); - } else if (This->data) { + if (This->data_internal || This->data) { + enum pipe_format format = This->base.info.format; + unsigned stride = This->stride; + uint8_t *data = This->data; + if (This->data_internal) { + format = This->format_internal; + stride = This->stride_internal; + data = This->data_internal; + } DBG("returning system memory\n"); /* ATI1 and ATI2 need special handling, because of d3d9 bug. * We must advertise to the application as if it is uncompressed * and bpp 8, and the app has a workaround to work with the fact * that it is actually compressed. */ - if (is_ATI1_ATI2(This->base.info.format)) { + if (is_ATI1_ATI2(format)) { pLockedRect->Pitch = This->desc.Width; - pLockedRect->pBits = This->data + box.y * This->desc.Width + box.x; + pLockedRect->pBits = data + box.y * This->desc.Width + box.x; } else { - pLockedRect->Pitch = This->stride; - pLockedRect->pBits = This->data + - NineSurface9_GetSystemMemOffset(This->base.info.format, - This->stride, + pLockedRect->Pitch = stride; + pLockedRect->pBits = data + + NineSurface9_GetSystemMemOffset(format, + stride, box.x, box.y); }