Re: [Mesa-dev] [PATCH v4 4/6] nouveau: Add framebuffer modifier support
On Wed, Mar 07, 2018 at 01:15:35PM -0500, Ilia Mirkin wrote: > On Wed, Mar 7, 2018 at 10:53 AM, Thierry Reding >wrote: > > From: Thierry Reding > > > > This adds support for framebuffer modifiers to Nouveau. This will be > > used by the Tegra driver to share metadata about the format of buffers > > (such as the tiling mode or compression). > > > > Changes in v2: > > - remove unused parameters to nouveau_buffer_create() > > - move format modifier query code to nvc0 backend > > - restrict format modifiers to 2D textures > > - implement ->query_dmabuf_modifiers() > > > > Changes in v4: > > - add UAPI include path on meson builds > > > > Acked-by: Emil Velikov > > Tested-by: Andre Heider > > Signed-off-by: Thierry Reding > > --- > > src/gallium/drivers/nouveau/Android.mk | 3 + > > src/gallium/drivers/nouveau/Makefile.am | 1 + > > src/gallium/drivers/nouveau/meson.build | 4 +- > > src/gallium/drivers/nouveau/nouveau_screen.c | 4 ++ > > src/gallium/drivers/nouveau/nv30/nv30_resource.c | 2 + > > src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 81 > > +++- > > src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 59 - > > src/gallium/drivers/nouveau/nvc0/nvc0_resource.h | 3 +- > > 8 files changed, 152 insertions(+), 5 deletions(-) > > > > diff --git a/src/gallium/drivers/nouveau/Android.mk > > b/src/gallium/drivers/nouveau/Android.mk > > index 2de22e73ec18..a446774a86e8 100644 > > --- a/src/gallium/drivers/nouveau/Android.mk > > +++ b/src/gallium/drivers/nouveau/Android.mk > > @@ -36,6 +36,9 @@ LOCAL_SRC_FILES := \ > > $(NVC0_CODEGEN_SOURCES) \ > > $(NVC0_C_SOURCES) > > > > +LOCAL_C_INCLUDES := \ > > + $(MESA_TOP)/include/drm-uapi > > + > > LOCAL_SHARED_LIBRARIES := libdrm_nouveau > > LOCAL_MODULE := libmesa_pipe_nouveau > > > > diff --git a/src/gallium/drivers/nouveau/Makefile.am > > b/src/gallium/drivers/nouveau/Makefile.am > > index 91547178e397..f6126b544811 100644 > > --- a/src/gallium/drivers/nouveau/Makefile.am > > +++ b/src/gallium/drivers/nouveau/Makefile.am > > @@ -24,6 +24,7 @@ include Makefile.sources > > include $(top_srcdir)/src/gallium/Automake.inc > > > > AM_CPPFLAGS = \ > > + -I$(top_srcdir)/include/drm-uapi \ > > $(GALLIUM_DRIVER_CFLAGS) \ > > $(LIBDRM_CFLAGS) \ > > $(NOUVEAU_CFLAGS) > > diff --git a/src/gallium/drivers/nouveau/meson.build > > b/src/gallium/drivers/nouveau/meson.build > > index e44be2616e70..242ee0e0001b 100644 > > --- a/src/gallium/drivers/nouveau/meson.build > > +++ b/src/gallium/drivers/nouveau/meson.build > > @@ -207,7 +207,9 @@ files_libnouveau = files( > > libnouveau = static_library( > >'nouveau', > >[files_libnouveau], > > - include_directories : [inc_src, inc_include, inc_gallium, > > inc_gallium_aux], > > + include_directories : [ > > +inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_drm_uapi > > + ], > >c_args : [c_vis_args], > >cpp_args : [cpp_vis_args], > >dependencies : [dep_libdrm, dep_libdrm_nouveau], > > diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c > > b/src/gallium/drivers/nouveau/nouveau_screen.c > > index c144b39b2dd2..b84ef13ebe7f 100644 > > --- a/src/gallium/drivers/nouveau/nouveau_screen.c > > +++ b/src/gallium/drivers/nouveau/nouveau_screen.c > > @@ -1,3 +1,5 @@ > > +#include > > + > > #include "pipe/p_defines.h" > > #include "pipe/p_screen.h" > > #include "pipe/p_state.h" > > @@ -23,6 +25,8 @@ > > #include "nouveau_mm.h" > > #include "nouveau_buffer.h" > > > > +#include "nvc0/nvc0_resource.h" > > Pretty sure I've mentioned before that this was undesirable (and also > seemingly unnecessary). Did you forget to fix it, or did you send the > wrong version of the patch? Ugh... yeah, looks like I ended up squashing the fix for this into a patch unrelated to this series. Fixed for v5, sorry. Thierry signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v4 4/6] nouveau: Add framebuffer modifier support
On Wed, Mar 7, 2018 at 10:53 AM, Thierry Redingwrote: > From: Thierry Reding > > This adds support for framebuffer modifiers to Nouveau. This will be > used by the Tegra driver to share metadata about the format of buffers > (such as the tiling mode or compression). > > Changes in v2: > - remove unused parameters to nouveau_buffer_create() > - move format modifier query code to nvc0 backend > - restrict format modifiers to 2D textures > - implement ->query_dmabuf_modifiers() > > Changes in v4: > - add UAPI include path on meson builds > > Acked-by: Emil Velikov > Tested-by: Andre Heider > Signed-off-by: Thierry Reding > --- > src/gallium/drivers/nouveau/Android.mk | 3 + > src/gallium/drivers/nouveau/Makefile.am | 1 + > src/gallium/drivers/nouveau/meson.build | 4 +- > src/gallium/drivers/nouveau/nouveau_screen.c | 4 ++ > src/gallium/drivers/nouveau/nv30/nv30_resource.c | 2 + > src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 81 > +++- > src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 59 - > src/gallium/drivers/nouveau/nvc0/nvc0_resource.h | 3 +- > 8 files changed, 152 insertions(+), 5 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/Android.mk > b/src/gallium/drivers/nouveau/Android.mk > index 2de22e73ec18..a446774a86e8 100644 > --- a/src/gallium/drivers/nouveau/Android.mk > +++ b/src/gallium/drivers/nouveau/Android.mk > @@ -36,6 +36,9 @@ LOCAL_SRC_FILES := \ > $(NVC0_CODEGEN_SOURCES) \ > $(NVC0_C_SOURCES) > > +LOCAL_C_INCLUDES := \ > + $(MESA_TOP)/include/drm-uapi > + > LOCAL_SHARED_LIBRARIES := libdrm_nouveau > LOCAL_MODULE := libmesa_pipe_nouveau > > diff --git a/src/gallium/drivers/nouveau/Makefile.am > b/src/gallium/drivers/nouveau/Makefile.am > index 91547178e397..f6126b544811 100644 > --- a/src/gallium/drivers/nouveau/Makefile.am > +++ b/src/gallium/drivers/nouveau/Makefile.am > @@ -24,6 +24,7 @@ include Makefile.sources > include $(top_srcdir)/src/gallium/Automake.inc > > AM_CPPFLAGS = \ > + -I$(top_srcdir)/include/drm-uapi \ > $(GALLIUM_DRIVER_CFLAGS) \ > $(LIBDRM_CFLAGS) \ > $(NOUVEAU_CFLAGS) > diff --git a/src/gallium/drivers/nouveau/meson.build > b/src/gallium/drivers/nouveau/meson.build > index e44be2616e70..242ee0e0001b 100644 > --- a/src/gallium/drivers/nouveau/meson.build > +++ b/src/gallium/drivers/nouveau/meson.build > @@ -207,7 +207,9 @@ files_libnouveau = files( > libnouveau = static_library( >'nouveau', >[files_libnouveau], > - include_directories : [inc_src, inc_include, inc_gallium, inc_gallium_aux], > + include_directories : [ > +inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_drm_uapi > + ], >c_args : [c_vis_args], >cpp_args : [cpp_vis_args], >dependencies : [dep_libdrm, dep_libdrm_nouveau], > diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c > b/src/gallium/drivers/nouveau/nouveau_screen.c > index c144b39b2dd2..b84ef13ebe7f 100644 > --- a/src/gallium/drivers/nouveau/nouveau_screen.c > +++ b/src/gallium/drivers/nouveau/nouveau_screen.c > @@ -1,3 +1,5 @@ > +#include > + > #include "pipe/p_defines.h" > #include "pipe/p_screen.h" > #include "pipe/p_state.h" > @@ -23,6 +25,8 @@ > #include "nouveau_mm.h" > #include "nouveau_buffer.h" > > +#include "nvc0/nvc0_resource.h" Pretty sure I've mentioned before that this was undesirable (and also seemingly unnecessary). Did you forget to fix it, or did you send the wrong version of the patch? -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v4 4/6] nouveau: Add framebuffer modifier support
From: Thierry RedingThis adds support for framebuffer modifiers to Nouveau. This will be used by the Tegra driver to share metadata about the format of buffers (such as the tiling mode or compression). Changes in v2: - remove unused parameters to nouveau_buffer_create() - move format modifier query code to nvc0 backend - restrict format modifiers to 2D textures - implement ->query_dmabuf_modifiers() Changes in v4: - add UAPI include path on meson builds Acked-by: Emil Velikov Tested-by: Andre Heider Signed-off-by: Thierry Reding --- src/gallium/drivers/nouveau/Android.mk | 3 + src/gallium/drivers/nouveau/Makefile.am | 1 + src/gallium/drivers/nouveau/meson.build | 4 +- src/gallium/drivers/nouveau/nouveau_screen.c | 4 ++ src/gallium/drivers/nouveau/nv30/nv30_resource.c | 2 + src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 81 +++- src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 59 - src/gallium/drivers/nouveau/nvc0/nvc0_resource.h | 3 +- 8 files changed, 152 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nouveau/Android.mk b/src/gallium/drivers/nouveau/Android.mk index 2de22e73ec18..a446774a86e8 100644 --- a/src/gallium/drivers/nouveau/Android.mk +++ b/src/gallium/drivers/nouveau/Android.mk @@ -36,6 +36,9 @@ LOCAL_SRC_FILES := \ $(NVC0_CODEGEN_SOURCES) \ $(NVC0_C_SOURCES) +LOCAL_C_INCLUDES := \ + $(MESA_TOP)/include/drm-uapi + LOCAL_SHARED_LIBRARIES := libdrm_nouveau LOCAL_MODULE := libmesa_pipe_nouveau diff --git a/src/gallium/drivers/nouveau/Makefile.am b/src/gallium/drivers/nouveau/Makefile.am index 91547178e397..f6126b544811 100644 --- a/src/gallium/drivers/nouveau/Makefile.am +++ b/src/gallium/drivers/nouveau/Makefile.am @@ -24,6 +24,7 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc AM_CPPFLAGS = \ + -I$(top_srcdir)/include/drm-uapi \ $(GALLIUM_DRIVER_CFLAGS) \ $(LIBDRM_CFLAGS) \ $(NOUVEAU_CFLAGS) diff --git a/src/gallium/drivers/nouveau/meson.build b/src/gallium/drivers/nouveau/meson.build index e44be2616e70..242ee0e0001b 100644 --- a/src/gallium/drivers/nouveau/meson.build +++ b/src/gallium/drivers/nouveau/meson.build @@ -207,7 +207,9 @@ files_libnouveau = files( libnouveau = static_library( 'nouveau', [files_libnouveau], - include_directories : [inc_src, inc_include, inc_gallium, inc_gallium_aux], + include_directories : [ +inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_drm_uapi + ], c_args : [c_vis_args], cpp_args : [cpp_vis_args], dependencies : [dep_libdrm, dep_libdrm_nouveau], diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index c144b39b2dd2..b84ef13ebe7f 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -1,3 +1,5 @@ +#include + #include "pipe/p_defines.h" #include "pipe/p_screen.h" #include "pipe/p_state.h" @@ -23,6 +25,8 @@ #include "nouveau_mm.h" #include "nouveau_buffer.h" +#include "nvc0/nvc0_resource.h" + /* XXX this should go away */ #include "state_tracker/drm_driver.h" diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c index ff34f6e5f9fa..386bd3459bd3 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c @@ -23,6 +23,8 @@ * */ +#include + #include "util/u_format.h" #include "util/u_inlines.h" diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c index 27674f72a7c0..7983c4030876 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c @@ -20,8 +20,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include + #include "pipe/p_state.h" #include "pipe/p_defines.h" +#include "state_tracker/drm_driver.h" #include "util/u_inlines.h" #include "util/u_format.h" @@ -233,9 +236,79 @@ nvc0_miptree_init_layout_tiled(struct nv50_miptree *mt) } } +static uint64_t nvc0_miptree_get_modifier(struct nv50_miptree *mt) +{ + union nouveau_bo_config *config = >base.bo->config; + uint64_t modifier; + + if (mt->layout_3d) + return DRM_FORMAT_MOD_INVALID; + + switch (config->nvc0.memtype) { + case 0x00: + modifier = DRM_FORMAT_MOD_LINEAR; + break; + + case 0xfe: + switch (NVC0_TILE_MODE_Y(config->nvc0.tile_mode)) { + case 0: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB; + break; + + case 1: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB; + break; + + case 2: + modifier = DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB; + break; + + case 3: + modifier =